Skip to content

Instantly share code, notes, and snippets.

@dwarring
Last active December 19, 2015 17:38
Show Gist options
  • Save dwarring/5992874 to your computer and use it in GitHub Desktop.
Save dwarring/5992874 to your computer and use it in GitHub Desktop.
Perl6 Case insensitive use of <sym> ?
use v6;
use Test;
grammar G {
## use rule :ignorecase; # nyi in rakudo. not what we want anyway
## use sym :ignorecase #??
rule TOP { <prop> + }
rule num {[\d|'.']+}
proto rule prop {<...>}
rule prop:sym<line-width> {:i <sym> ':' <num> }
rule prop:sym<line-height>:i { <sym> ':' <num> }
}
for ('line-width: 42', 'line-height: 47',
'LINE-WIDTH: 42', 'LINE-HEIGHT: 47' # these don't parse
) {
ok(G.parse($_), "parse: $_");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment