Skip to content

%token_class

ksherlock edited this page Dec 19, 2015 · 1 revision

The %token_class directive

The %token_class directive creates a multi-terminal that acts as a set of other terminals.

%token_class number_or_string NUMBER | STRING. 
// can also use `/` or white space as a separator.

This is equivalent to:

%number_or_string(A) ::= NUMBER(B). { A = B; }
%number_or_string(A) ::= STRING(B). { A = B; }
Clone this wiki locally