[grammarians] [Rubygrammar-grammarians] embedded expressions and dynamic quotes
Mauricio Fernández
mfp at acm.org
Sun Nov 27 04:23:44 EST 2005
On Sat, Nov 26, 2005 at 03:39:52PM -0800, Terence Parr wrote:
> On Nov 26, 2005, at 2:04 PM, Martin Traverso wrote:
> > Double-quoted strings can also be constructed with % or %Q and an
> > delimiter character, according to these rules (from the Pickaxe book).
[...]
>
> 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
--
Mauricio Fernandez
More information about the Rubygrammar-grammarians
mailing list