Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added fudged test for RT120146
  • Loading branch information
dwarring committed Oct 31, 2013
1 parent 4623a73 commit fa28a3b
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion S05-grammar/protoregex.t
@@ -1,6 +1,6 @@
use v6;
use Test;
plan 26;
plan 30;

grammar Alts {
token TOP { ^ <alt> $ };
Expand Down Expand Up @@ -120,4 +120,23 @@ is ~LTM.parse('aaa', :rule('ass2')), 'aaa', '<!{...}> does not terminate L
#?niecza todo '#89'
is ~LTM.parse('aaa', :rule('block')), 'aa', 'However, code blocks do terminate LTM';

# RT120146
grammar G {

token nmstrt {<[_ a..z ]>}
token nmreg {<[_ \- a..z 0..9]>+}
token ident {'-'?<nmstrt><nmreg>*}
token num {[\+|\-]?\d+}

proto token term { <...> }
token term:sym<ident> {<ident>}
token term:sym<num> {<num>}
}

is ~G.parse("-42", :rule<num>), '-42', 'num parse';
is ~G.parse("-my_id", :rule<ident>), '-my_id', 'id parse';
is ~G.parse("my_id", :rule<term>), 'my_id', 'term parse';
#?rakudo todo 'RT120146'
is ~G.parse("-my_id", :rule<term>), '-my_id', 'term parse, leading "-"';

# vim: ft=perl6

0 comments on commit fa28a3b

Please sign in to comment.