Hello,
I use Grammar Designer form TestApplication to generate code for C# semantic parser.
Below is a fragment of Grammar definition file (within Production tags):When I run parser generator, I got a C# code for fragment above:
I should notice that my non-terminal "EmbeddedStatement" has AdditionalConditions (ExpressionConditions).
To my mind, the generated code should be like this:i.e. first-set condition should be only 'Else' token.
is it a defect in parser generator? or I do something wrong?
Thanks,
Nik
I use Grammar Designer form TestApplication to generate code for C# semantic parser.
Below is a fragment of Grammar definition file (within Production tags):
[ 'Else' "EmbeddedStatement<@out falseStatement@>" ]
if ((this.TokenIs(this.LookAheadToken, CSharpTokenID.Else)) || (this.IsCondition1()) ...|| (this.IsLastCodition())) {
if (!this.Match(CSharpTokenID.Else))
return false;
if (!this.MatchEmbeddedStatement(out falseStatement))
return false;
}
To my mind, the generated code should be like this:
if (this.TokenIs(this.LookAheadToken, CSharpTokenID.Else)) {
if (!this.Match(CSharpTokenID.Else))
return false;
if (!this.MatchEmbeddedStatement(out falseStatement))
return false;
}
is it a defect in parser generator? or I do something wrong?
Thanks,
Nik