pythonparsinggrammartatsu

How to match a pattern in Tatsu in a case insensitive manner


anybody knows how to recognize a pattern in Tatsu, in a case-insensitive way? The documentation says to: "Use (?i) in patterns that should ignore case." but I did not actually figure out how to use (?i) in my rule:

graph
    =
    [ STRICT ] ( GRAPH | DIGRAPH ) [graph_name:id] '{'
        { rule_list:rule }*
    '}';

STRICT
   = 'strict'
   ;

In practice, I've to recognize the word 'strict', regardless of its case.

Thanks Tom


Solution

  • Yes thanks! As rici suggested I easily solved writing:

    STRICT
       = ?'(?i)strict'
       ;