[antlr-interest] Syntactic predicates in lexer

Loïc Quéran loic.queran at gmail.com
Wed Oct 14 02:26:41 PDT 2009


Hi,

This is probably a very simple question, but I can't get syntactic
predicates to work in lexer rules:


AssignmentOperatorOrKeywordMarker
  : ':=' => AssignmentOperator
  | ':' => KeywordMarker
  ;

KeywordMarker
  :    ':'
  ;

AssignmentOperator
  :    ':='
  ;

What I want to achieve is to have the lexer produce an assignment operator
':=' token instead of a keyword marker ':' whenever possible.
The error is  "unexpected token: ':='" at AssignmentOperatorOrKeywordMarker
rule definition.

Any help would be welcomed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091014/03c81f07/attachment.html 


More information about the antlr-interest mailing list