Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Construct

Description

Example

(...)*

Kleene closure - matches zero or more occurrences

LETTER DIGIT* - match a LETTER followed by zero or more occurrences of DIGIT

(...)+

Positive Kleene closure - matches one or more occurrences

('0'..'9')+ - match one or more occurrences of a numerical digit
LETTER (LETTER|DIGIT)+ - match a LETTER followed one or more occurrences of either LETTER or DIGIT

fragment

fragment in front of a lexer rule tells antlr this TOKEN is part of another LEXER RULE

Code Block
fragment DIGIT	: '0'..'9' ; 
NUMBER	: (DIGIT)+ ;

How about a more complex ANTLR 3 grammar?

...