David --
> Treetop.load_from_string <<-G
> grammar S
> rule string
> '"' ('\"' / !'"' .)* '"'
> end
> end
> G
The here-doc is eating one level of escaping, so what treetop sees is:
Treetop.load_from_string <<-G
grammar S
rule string
'"' ('"' / !'"' .)* '"'
end
end
G
SParser.new.parse('"Hi there"')
You need to double the "\" to "\\" so that the string passed to treetop
will contain a single "\" as you want:
Treetop.load_from_string <<-G
grammar S
rule string
'"' ('\\"' / !'"' .)* '"'
end
end
G
SParser.new.parse('"Hi there"')
-- MarkusQ