[antlr-interest] Is it possible to disallow spaces between operands and operators ?

Gaëtan GARCIA Gaetan.Garcia at ec-nantes.fr
Wed Apr 18 14:14:43 PDT 2012


Hi all,

I'm a beginner in the use of ANTLR. Thanks to Scott Stanchfield's video 
tutorials and using examples from antlr.org, I managed to created my 
first parser. It works fine, but I have the following (small?) problem:

I have a simple rule:

matrixProd
     : matrix( ':' matrix )*
     ;

It allows building things like a:b:c. My problem is that it also allows 
a : b : c, which the target language does not allow. No such problem 
with other operators (+,-,/,*,mod) of the language, though. Do I have a 
way to fix this so the parser reports an error in the presence of extra 
spaces?
Thanks for any input.

           G.G.



More information about the antlr-interest mailing list