On May 20, 2014, at 1417 PT, Jeffrey Kegler <[email protected]>
wrote:
> One approach is to make ISO dates lexemes. That way the longest match
> discipline works for you, slurping up all the minus signs before the
> subtraction logic gets to see them. And whitespace won't be allowed, which I
> assume is the intent. I've tried it out in a pull request. Some of your
> tests fail, but I am assuming that's because you're working on that stuff.
>
> -- jeffrey
BTW: I've managed to get whitespace and lexemes working with discard and latm.
However it's purely for balanced quotes and escape/descape stuff. Not sure if
it's 100% related, but does this qualify as "whitespace within lexemes"?
genwrap_qd ::= (quote_d) genword_qd (quote_d)
action => ftp_op_qd
genwrap_qs ::= (quote_s) genword_qs (quote_s)
action => ftp_op_qs
word_qd ~ [^"] | whitespace | escape ["]
word_qs ~ [^'] | whitespace | escape [']
quote_s ~ [']
quote_d ~ ["]
escape ~ '\'
:discard ~ whitespace
whitespace ~ [\s]+
sub ftp_op_qd {
my %xtab = ( q(\") => qq(") );
return [ join '', map +($xtab{$_} || $_), @{$_[1]} ];
}
sub ftp_op_qs {
my %xtab = ( q(\') => qq(') );
return [ join '', map +($xtab{$_} || $_), @{$_[1]} ];
}
I'm also not sure if I'm getting away with some side-effect of discard not
applying if a lexeme uses the same tokens as discard tokens, but whatever makes
it work, please don't make it unwork :-)
--
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.