[antlr-interest] how to quote things?

Benjamin Shropshire shro8822 at vandals.uidaho.edu
Tue Feb 26 16:13:05 PST 2008


I have this in a tree grammer:

     document : ^(DOCUMENT concept["\"\""]+)
              ;

what I'm trying to do is, when I parse a document try to parse a string 
of concepts and pass down the string "" (that is in C notation "\"\""). 
This value then gets used further down to generate some stuff. The 
problem is that I can;t find anything to stuff into the [...]'s that 
gets passed through as something that C# things of as "\"\"".

Antlr keeps adding commas and spaces and whatnot.

example outputs
    concept(", \", \", ");
    concept(', \", \", ');

 The manual has references to using \uXXXX for uni-code but that also 
doesn't work.

    concept(\u, 0022+, \u, 0022);
    concept("\u, 0022+, \u, 0022");

Question 1:  How do I pass the needed string literal to the concept rule?
Question 2: (might be irrelevant depending on 1) Is what I'm doing the 
"correct way" to do things?
Question 3: What was antlr doing there?


More information about the antlr-interest mailing list