Hello,

I am trying to parse a simple templating language that may look like this:

"a  aa [T * 2]a a"

Here, the part inside [] should be calculated (T has an integer value) and 
replaced. The other part
is supposed to be left as-is. With those rules, the output should be "a aa 
30a a" (when T is 15).
I want to be able to have whitespace surrounding the '*', so I am sending ' 
' to the hidden channel.
But that breaks the parts outside [] into pieces. Is there a way to capture 
the part outside [] as-is,
with whitespace exactly like written, and the part inside [] is relaxed 
where whitespace to go hidden
channel?

Daniel

Here's my grammar, btw:

parse
        : (IDENT | variable)+ EOF
        ;

variable
        : '[' mult ']'
        ;

// the multiplication is optional
mult
        : IDENT ('*' INTEGER)?
        ;

fragment DIGIT : '0'..'9' ;
INTEGER : DIGIT+ ;

fragment LETTER : 'a'..'z' | 'A'..'Z';
IDENT : LETTER+ ;

WS : ' '+ { $channel = HIDDEN; } ;
 


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to