syntax TokenRule = RuleAttributes "token" Name "=" RuleExpression SimpleRuleBody;

TokenRule is the same as SimpleRule with the exception of the following:

TokenRule is specifically treated during error recovery. Besides, the parser will point at the rule, not at its content.

A token may also be described by RegexRule, however the structure of such rules won’t be accessible, which can compromise code highlighting and error recovery. As an example, comments and strings should be described with TokenRule, otherwise the parser will not be able to spot an unclosed string or comment.

For example:

token Identifier = !Keyword IdentifierBody
  regex KeywordToken = "true" | "false" | "null";
  token Keyword = KeywordToken !IdentifierPartCharacters;

See also

token vs. regex