EBNF example doesn't work

76 views
Skip to first unread message

Matthew Lock

unread,
Feb 5, 2014, 7:32:08 PM2/5/14
to eto-...@googlegroups.com
Hello,
I'm trying to get the EBNF example here: https://github.com/picoe/Eto.Parse to work.

When I run the example code, the firstValue and secondValue are empty.

If I inspect the ErrorMessage in the match object it contains the following string:

ErrorMessage: Index=24, Context="ing world >>>)  "
ChildIndex=27, Context=" world )  >>>"
Expected:
letter or digit: Char: Letter or Digit
simple value: Sequence

Matthew Lock

unread,
Feb 5, 2014, 7:40:20 PM2/5/14
to eto-...@googlegroups.com
Just been fiddling further. If I change the code to:


         var firstValue = match["first"].Value;
         var secondValue = match["second"].Value;

Then I get results in firstValue and secondValue as expected, but I still get an error index of 24.

Curtis Wensley

unread,
Feb 5, 2014, 8:24:46 PM2/5/14
to eto-...@googlegroups.com
Hey Matthew,

You are right, the EBNF sample isn't 100% the same as the other samples.. technically it'd be:

var firstValue = match["first"]["optional bracket"]["simple value"].Value;
var secondValue = match["second"]["optional bracket"]["bracket value"]["simple value"].Value;

This is due to not being able to specify which parsers are named or not using ebnf.

One thing to note about the ErrorMessage - it will be set even if the value has succeeded.  Make sure you test match.Success first, before checking the ErrorMessage property.

I'll see what I can do to make the ebnf sample more accurate. 

Hope this helps!
Curtis.

Matthew Lock

unread,
Feb 5, 2014, 8:38:21 PM2/5/14
to eto-...@googlegroups.com
Thanks!
Reply all
Reply to author
Forward
0 new messages