[grammarians] [Rubygrammar-grammarians] embedded expressions and dynamic quotes

Terence Parr parrt at cs.usfca.edu
Sun Nov 27 14:00:34 EST 2005


On Nov 27, 2005, at 1:23 AM, Mauricio Fernández wrote:
>> Holy crap!  That is VERY tough for a static lexer to deal with.  I
>> wonder if a semantic predicate will help us out here...hmm...
>
> What about this then?
>
> puts "foo #{%	#{<<E1}	.chomp + " bar #{<<E2.chomp}"} baz"
> 1 2 3
> 4 5 6
> E1
> blergh
> E2
>
> Output:
>
> foo 1 2 3
> 4 5 6 bar blergh baz

Yikes!  Can you parse that for me?

Ter


More information about the Rubygrammar-grammarians mailing list