Does parsing nested quotes make sense for adding to that grammar? I once
ran into a grammar that can parse them to a tree —
https://gist.github.com/rns/23ce8639c4ceb87d70c9

On Mon, Sep 22, 2014 at 10:12 AM, Ron Savage <[email protected]> wrote:

> 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.
>

-- 
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.

Reply via email to