Validating and non validating parser

Posted by / 16-Sep-2020 14:25

Validating and non validating parser

You may want to use the token type value of a string literal in your actions, for example in the synchronization part of an error-handler.

For string literals that consist of alphabetic characters only, the string literal value will be a constant with a name like LITERAL_xxx, where xxx is the name of the token.

A parser class specification precedes the options and rule definitions of the parser.

Currently, ANTLR does not actually allow Unicode characters within string literals (you have to use the escape). In parser rules, strings represent tokens, and each unique string is assigned a token type.

The subsequent characters may be any letter, digit, or underscore.

A token reference in a parser rule results in matching the specified token.

The optional class preamble is some arbitrary text enclosed in .

The preamble, if it exists, will be output to the generated class file immediately before the definition of the class.

validating and non validating parser-55validating and non validating parser-8validating and non validating parser-13

The subsequent characters may be any letter, digit, or underscore. Curly braces within string and character literals are not action delimiters. Character sequences in (possibly nested) square brackets are rule argument actions.