Custom Error Messages

May 10, 2012 at 10:00 PM


I have some code:

var identifier = new IdentifierTerminal("identifier");

var File = new NonTerminal("file", typeof(IDNode));
var Field = new NonTerminal("field", typeof(IDNode));

Column.Rule = File + caret + Field | Field;
File.Rule = identifier;
Field.Rule = identifier;

When I try to parse something like this somefile^somefield everything works good.

When I try to parse something like this somefile^ I get the expected error 

Syntax error, expected: identifier

What I want, is for this error to say: 

Syntax error, expected: field

is this possible?

May 11, 2012 at 5:01 AM

Use Grammar.AddTermsReportGroup method, read xml comments there