Not sure I got it right from the beginning, but my attempt, using a "parameterized" subset of the C grammar is at https://gist.github.com/jddurand/8d3238c22731a85eb890 . JD.
Le lundi 22 septembre 2014 09:12:31 UTC+2, Ron Savage a écrit : > > I've developed a grammar (with help from various people of course) for > quoted strings: http://scsys.co.uk:8002/424926 > > Requirements: > > o Strings must be quoted > > o Strings are either single or double quoted > > o The escape character is \ > > o If the string is single quoted, internal single quotes must be escaped > > o If the string is double quoted, internal double quotes must be escaped > > o Any other character may be escaped > > o If a character is escaped, the escape character is preserved in the > output > > o Empty strings are accepted > > ToDo: Make it work with utf8. > > Does anyone see problems, or other input strings which should be tested? > > Jeffrey: This is one of the plug-in grammars Jean-Damien and I talked > about recently. Any chance you can implement: > > my $source = <<'END_OF_GRAMMAR'; > ... > :include /my/grammars/quoted.strings.bnf > ... > END_OF_GRAMMAR > > to include a suitable[*] grammar in situ within a grammar declaration? > > [*] Obviously, here that just means the prefix: > > :default ::= action => [values] > > lexeme default = latm => 1 # Longest Acceptable Token Match. > > :start ::= string_token > > and the suffix: > > # Boilerplate. > > :discard ~ whitespace > whitespace ~ [\s]+ > > END_OF_GRAMMAR > > would not be present in the include file. > > -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
