« Return to Thread: A Beginner's Question concering Brackets.

A Beginner's Question concering Brackets.

by RagnarZero :: Rate this Message:

Reply to Author | View in Thread

Hey, this is my first post here, so hi to everyone :)

I have recently startet to parse a language called XPro in JavaCC (don't mind if you don't know it, it is better that way) and have a problem with a simple case in this language.

I want to parse a line like this:
goal(sometexthere).

i have a token for any character:
<ANYCHAR: ~[]  >

and 2 for the brackets
  <BRACKETOPEN: "(">
|  <BRACKETCLOSE: ").">

and this is how i parse it:

void Brackets() :
{}
{
    <BRACKETOPEN> ( (<ANYCHAR>)*) <BRACKETCLOSE>
}

the problem is, when I try to parse it says to me:
Exception in thread "main" parser.ParseException: Encountered " <ANYCHAR> "( "" at line 10, column 5.
Was expecting:
    "(" ...

I just don't get this, I am sorry if this is stupid, I just began to get to use to the syntax.
I hope you can help me out.

Regards,
RagnarZero

 « Return to Thread: A Beginner's Question concering Brackets.