Aug 26, 2010 at 5:46 AM
Edited Aug 26, 2010 at 6:42 AM
I have run into a slight problem. I have build a grammar that allows for the following two types of statements (simplified):
OptionalBracketSection.Rule = ("[" + Expression + "]") | Empty;
TypeStatement.Rule = TypeKeyword + Identifier + OptionalSquareBracketSection;
LoopStatement.Rule = "[" + Expression + "]" + Identifier + "(" + Identifier + ")";
Now...the problem is this. If have the following:
 ( Test )
The grammar treats it as 'Type blah' and chokes on the '( Test )' - instead of using 'Empty' in the OptionalBracketSection rule. I didn't get any shift-reduce conflicts which scares me (how many more such mess-ups have I made that I don't know about?).
Is there a way to fix this? These statements are wrapped in in a StatementList that uses MakeStarRule, but when I tried to set the delimiter in that to '\n' it didn't seem to fix the problem - surely if I set '\n' as the delimiter it should force the
end of a statement when it encounters one?
edit: Tried adding + NewLine to the end of TypeStatement.Rule, but this causes everything else to keel over.