[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Parsing problem
Hello, everyone.
I hope someone can give me a hand, since this has me completely stumped.
I've reduced the grammar file down to its essentials, I think.
Enclosed is the grammar file and the errors I get on simple inputs.
thanks for any help,
d.
========================================================
--------- grammar file -----------------------
========================================================
Package com.redwood.reportParserFramework;
Helpers
sp = ' ';
letter = ['a'..'z'] | ['A'..'Z'];
digit = ['0'..'9'];
letter_or_digit = letter | digit;
allowed_expresion_char = letter | digit |
'(' | ')' |
'<' | '>' | '=' | '.' | ':';
/*******************************************************************
* Tokens *
*******************************************************************/
Tokens
lparen = '(';
rparen = ')';
white_space = sp*;
report_keywd = '<report>';
identifier = letter letter_or_digit*;
text = (allowed_expresion_char)*;
/*******************************************************************
* Ignored Tokens *
*******************************************************************/
Ignored Tokens
white_space;
/*******************************************************************
* Productions *
*******************************************************************/
Productions
goal = report_def;
report_def =
{keyword}
report_keywd |
{empty}
report_keywd lparen rparen;
===============================================================
======== Output ========================
===============================================================
"<report>" works fine
"<report> " works now, but only now that the file has been shrunk down
"<report> () " does not work - the error reads
com.redwood.reportParserFramework.parser.ParserException: [1,11] "EOF
expected.",
"<report>()" does not work - the error reads:
com.redwood.reportParserFramework.parser.ParserException: [1,1]
"TReportKeywd expected.",
which makes me think that it only recognizes the <report> token when there
is a whitespace after it.