Case Insensitive in Marpa

Related to my earlier question about keyword mismatch using random expressions.

Is it possible to match case insensitive strings in Marpa ? If so, how?

Suppose I have a grammar

:start ::= script identifier ~ [\w]+ script ::= 'script' identifier code code ::= command* command ::= 'run' | 'walk' | 'stop' 

How can I match any of a script , script , script or any other combination of lower and upper case letters?

+7
regex case-insensitive marpa
source share
1 answer

There is no easy way to specify case insensitivity. Of course, you can group character classes: [sS] [cC] [rR] [iI] [pP] [tT], but this is rather inconvenient.

Unfortunately. Case-insensitive strings would be a good opportunity to add.

UPDATE: as of 2.076000, the latest indexed release, Marpa :: R2 now has a modifier: ic for both strings and character classes, making them case insensitive. In the docs see https://metacpan.org/pod/Marpa::R2::Scanless::DSL#Single-quoted-strings and https://metacpan.org/pod/Marpa::R2::Scanless :: DSL # Character-classes .

+3
source share

All Articles