Version 1.4 released!

69 views
Skip to first unread message

Curtis Wensley

unread,
Jan 11, 2015, 6:45:21 PM1/11/15
to eto-...@googlegroups.com
Hi All,

Version 1.4 is now released to nuget! It has some cool new features:

    * Optimize character-only alternations (sets, ranges, and characters) to a single CharacterSet
    * Add w3c ebnf style, which adds character set functionality
    * Add ability to combine various styles for the Ebnf grammar parser
    * Added surrogate pair and range terminals to match a double byte character (thanks to tpluscode's contribution!)
    * Add TagParser to tag a parse tree to control child parsers to require or exclude tags
    * Add Parser.PreventRecursion() fluent method

Enjoy!
Curtis.

Matthew Lock

unread,
Jul 13, 2015, 11:42:43 PM7/13/15
to eto-...@googlegroups.com
Hi,
I've finally upgraded but I can no longer get my grammar to parse. It used to work okay in 1.3.1:

         var ebnf = new EbnfGrammar(EbnfStyle.BracketComments | EbnfStyle.CommaSeparator | EbnfStyle.SemicolonTerminator | EbnfStyle.SquareBracketAsOptional);

         
var grammar = ebnf.Build(@"
            (* := is an extension to define a literal with no whitespace between repeats and sequences *)

            grammar := [ sub_unit_number, ""/"" ], street_number, ws, street_name, ws, street_type;

            sub_unit_number := number;

            street_number := number, [ letter ];
           
            street_name := word, { ws, -street_type, word };

            street_type := ""street"" | ""road"" | ""terrace"";

            word := letter, {letter};
            ws := ? Terminals.WhiteSpace ?, { ? Terminals.WhiteSpace ? };
            number := digit, {digit};
            letter := ? Terminals.Letter ?;
            digit := ? Terminals.Digit ?;            

         "
, "grammar");

I now get the following error:

System.FormatException: Error parsing ebnf:
Index=357, Context="rd, { ws, >>>-street_ty"

Expected:

optional sequence
repeated sequence
grouped sequence
meta identifier: Sequence
Quoted String
special sequence
primary
factor
term

Matthew Lock

unread,
Jul 13, 2015, 11:52:37 PM7/13/15
to eto-...@googlegroups.com
I've managed to get it working with numeric cardinality instead. Does that look right?

       var ebnf = new EbnfGrammar(EbnfStyle.BracketComments | EbnfStyle.CommaSeparator | EbnfStyle.SemicolonTerminator | EbnfStyle.SquareBracketAsOptional | EbnfStyle.NumericCardinality);

         
var grammar = ebnf.Build(@"

            (* := is an extension to define a literal with no whitespace between repeats and sequences *)

            grammar := [ sub_unit_number, ""/"" ], street_number, ws, street_name, ws, street_type;

            sub_unit_number := number;

            street_number := number, [ letter ];
           
            street_name := word, { ws, 0 * (street_type), word };
, "grammar");

Chris Anders

unread,
Jul 14, 2015, 5:18:01 AM7/14/15
to eto-...@googlegroups.com
please make a github release
Reply all
Reply to author
Forward
0 new messages