Grammar


Grammar rules allows testing complex sequences of tokens. 

Grammar rules are separated by the semicolon. 

Syntax of grammar definitions:

Rule ::= RuleName '=' Branch_list ';'

Branch_list ::= Item_list
    | Branch_list '|' Item_list

Item_list ::= Element
    | Item_list Element

Element ::= Item
    | Item '*'
    | Item '+'
    | Item '?'

Item ::= RuleName
    | '"' Term '"'
    | ''' Term '''
    | '<' TokenType '>'
    | '(' Item_list ')'

where: 
" Term" - case insensitive terminal, 
'Term' - case sensitive terminal, 
TokenType - name of token type, 
RuleName - name of grammar rule. 

 

Repeaters: 
'*' - any number of entries including none 
'+' - at least one entry 
'?' - one entry or none 

There are special grammar rule "Skip". It is used after each match operation to skip unused tokens (for example, comments).


// econtrol.ru // sepa.spb.ru //