class Grammar { token ws { \s* } } #### token ww { } #### grammar Calc { token ws { \s* } # rest of your code here without any modifications