2

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

Tommaso Mazza
  • 357
  • 4
  • 8
  • 2
    A *pattern* is `/.../` where the `...` is a Python regular expression. (See the Python documentation for the`re` package.) In a Python regular expression `(?i)` means "start ignoring case", so `/(?i).../` is a case insensitive pattern. (There are other ways to write Tatsu patterns. See the docs.) – rici Feb 25 '18 at 19:52

1 Answers1

2

Yes thanks! As rici suggested I easily solved writing:

STRICT
   = ?'(?i)strict'
   ;
Tommaso Mazza
  • 357
  • 4
  • 8