[antlr-interest] lexer: embedded quotes assistance

Edwards, Waverly Waverly.Edwards at genesys.com
Fri Aug 24 09:23:31 PDT 2007


Thank you very much Gavin.  This was the key to success!
I would also like to thank Matthew and fyaoxy and there
replies also proved valuable in my education.

Gavin, your solution kept me from pulling out my hair out.
I researched the greedy=false option and how to obtain a string
using it but was far from successful.

I haven't figured out how to get ANTLR to tell me the string is
unterminated but I will.

Based on your rule DBLQUOTE I was able to retrieve the whole
of the quoted material and parse it.  I also didn't need a
NEWLINE or ¬NEWLINE rule as a part of DBLQUOTE.  I made my
adjustments after I received all of the quoted text.

OUTSTANDING!!! 

( You can tell I'm a newbie can't you? )

Attached for anyone's benefit is the final solution with testing
text file.


Thanks again



W.


-----Original Message-----
Gavin Lambert wrote:

[snip]

Not tested, but this ought to do what you want:

DBLQUOTE
   :  '"'
      (~'"' | '""')*
      '"'
   ;

[snip]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: QUOTECONTINUATION.g
Type: application/octet-stream
Size: 1625 bytes
Desc: QUOTECONTINUATION.g
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070824/1e64f08b/attachment.obj 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: quotedText.txt
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20070824/1e64f08b/attachment.txt 


More information about the antlr-interest mailing list