@@ -12,22 +12,22 @@ grammar Alts {
12
12
token alt :sym «=> » { <sym > }; # RT #113590
13
13
}
14
14
15
- ok (my $ match = Alts. parse (' foo' )), ' can parse with proto regexes (1)' ;
15
+ ok (my $ match = Alts. subparse (' foo' )), ' can parse with proto regexes (1)' ;
16
16
17
17
is $ match , ' foo' , ' and matched the full string' ;
18
18
is $ match <alt >, ' foo' , ' got the right name of the capture' ;
19
19
20
20
is $/ , ' foo' , ' also works with $/' ;
21
21
22
- ok Alts. parse (' bar' ), ' can parse with second alternative' ;
23
- ok Alts. parse (' argl' ), ' can parse third second alternative' ;
22
+ ok Alts. subparse (' bar' ), ' can parse with second alternative' ;
23
+ ok Alts. subparse (' argl' ), ' can parse third second alternative' ;
24
24
25
- ok ! Alts. parse (' baz' ), ' does not match sym of third alternative' ;
26
- ok ! Alts. parse (' aldkfj' ), ' does not match completely unrelated string' ;
27
- ok ! Alts. parse (' ' ), ' does not match empty string' ;
25
+ ok ! Alts. subparse (' baz' ), ' does not match sym of third alternative' ;
26
+ ok ! Alts. subparse (' aldkfj' ), ' does not match completely unrelated string' ;
27
+ ok ! Alts. subparse (' ' ), ' does not match empty string' ;
28
28
29
29
# RT #113590
30
- ok Alts. parse (' =>' ), ' can parse symbol inside double-angles' ;
30
+ ok Alts. subparse (' =>' ), ' can parse symbol inside double-angles' ;
31
31
32
32
33
33
class SomeActions {
@@ -36,7 +36,7 @@ class SomeActions {
36
36
}
37
37
}
38
38
39
- ok ($ match = Alts. parse (' argl' , : actions(SomeActions. new ))),
39
+ ok ($ match = Alts. subparse (' argl' , : actions(SomeActions. new ))),
40
40
' can parse with action methods' ;
41
41
is $ match <alt >. ast, ' bazbaz' , ' action method got called, make() worked' ;
42
42
@@ -104,21 +104,21 @@ grammar LTM {
104
104
token block :sym <b > { aa }
105
105
}
106
106
107
- is ~ LTM. parse (' foobar' , : rule(' lit' )), ' foobar' , ' LTM picks longest literal' ;
108
- is ~ LTM. parse (' 1.2' , : rule(' cclass1' )), ' 1.2' , ' LTM picks longest with char classes' ;
109
- is ~ LTM. parse (' 1.2' , : rule(' cclass2' )), ' 1.2' , ' ...and it not just luck with ordering' ;
110
- is ~ LTM. parse (' 11' , : rule(' cclass3' )), ' 11' , ' LTM works with things like \d' ;
111
- is ~ LTM. parse (' ..' , : rule(' cclass4' )), ' ..' , ' ...and negated ones like \W' ;
112
- is ~ LTM. parse (' ab' , : rule(' quant1' )), ' ab' , ' LTM and ? quantifier' ;
113
- is ~ LTM. parse (' abbb' , : rule(' quant2' )), ' abbb' , ' LTM, ? and + quantifiers' ;
114
- is ~ LTM. parse (' aaaa' , : rule(' quant3' )), ' aaaa' , ' LTM and * quantifier' ;
115
- is ~ LTM. parse (' aaa' , : rule(' declok' )), ' aaa' , ' :my declarations do not terminate LTM' ;
116
- is ~ LTM. parse (' aaa' , : rule(' cap1' )), ' aaa' , ' Positional captures do not terminate LTM' ;
117
- is ~ LTM. parse (' aaa' , : rule(' cap2' )), ' aaa' , ' Named captures do not terminate LTM' ;
118
- is ~ LTM. parse (' aaa' , : rule(' ass1' )), ' aaa' , ' <?{...}> does not terminate LTM' ;
119
- is ~ LTM. parse (' aaa' , : rule(' ass2' )), ' aaa' , ' <!{...}> does not terminate LTM' ;
107
+ is ~ LTM. subparse (' foobar' , : rule(' lit' )), ' foobar' , ' LTM picks longest literal' ;
108
+ is ~ LTM. subparse (' 1.2' , : rule(' cclass1' )), ' 1.2' , ' LTM picks longest with char classes' ;
109
+ is ~ LTM. subparse (' 1.2' , : rule(' cclass2' )), ' 1.2' , ' ...and it not just luck with ordering' ;
110
+ is ~ LTM. subparse (' 11' , : rule(' cclass3' )), ' 11' , ' LTM works with things like \d' ;
111
+ is ~ LTM. subparse (' ..' , : rule(' cclass4' )), ' ..' , ' ...and negated ones like \W' ;
112
+ is ~ LTM. subparse (' ab' , : rule(' quant1' )), ' ab' , ' LTM and ? quantifier' ;
113
+ is ~ LTM. subparse (' abbb' , : rule(' quant2' )), ' abbb' , ' LTM, ? and + quantifiers' ;
114
+ is ~ LTM. subparse (' aaaa' , : rule(' quant3' )), ' aaaa' , ' LTM and * quantifier' ;
115
+ is ~ LTM. subparse (' aaa' , : rule(' declok' )), ' aaa' , ' :my declarations do not terminate LTM' ;
116
+ is ~ LTM. subparse (' aaa' , : rule(' cap1' )), ' aaa' , ' Positional captures do not terminate LTM' ;
117
+ is ~ LTM. subparse (' aaa' , : rule(' cap2' )), ' aaa' , ' Named captures do not terminate LTM' ;
118
+ is ~ LTM. subparse (' aaa' , : rule(' ass1' )), ' aaa' , ' <?{...}> does not terminate LTM' ;
119
+ is ~ LTM. subparse (' aaa' , : rule(' ass2' )), ' aaa' , ' <!{...}> does not terminate LTM' ;
120
120
# ?niecza todo '#89'
121
- is ~ LTM. parse (' aaa' , : rule(' block' )), ' aa' , ' However, code blocks do terminate LTM' ;
121
+ is ~ LTM. subparse (' aaa' , : rule(' block' )), ' aa' , ' However, code blocks do terminate LTM' ;
122
122
123
123
# RT120146
124
124
# ?niecza skip "Action method assertion:sym<...> not yet implemented"
@@ -130,16 +130,16 @@ is ~LTM.parse('aaa', :rule('block')), 'aa', 'However, code blocks do termi
130
130
token ident {'-' ? <nmstrt ><nmreg >* }
131
131
token num {[\+ | \-]? \d + }
132
132
133
- proto token term { <...> }
133
+ proto token term {* }
134
134
token term :sym <ident > {<ident >}
135
135
token term :sym <num > {<num >}
136
136
}
137
137
138
- is ~ G. parse (" -42" , : rule<num >), ' -42' , ' num parse' ;
139
- is ~ G. parse (" -my_id" , : rule<ident >), ' -my_id' , ' id parse' ;
140
- is ~ G. parse (" my_id" , : rule<term >), ' my_id' , ' term parse' ;
138
+ is ~ G. subparse (" -42" , : rule<num >), ' -42' , ' num parse' ;
139
+ is ~ G. subparse (" -my_id" , : rule<ident >), ' -my_id' , ' id parse' ;
140
+ is ~ G. subparse (" my_id" , : rule<term >), ' my_id' , ' term parse' ;
141
141
# ?rakudo todo 'RT120146'
142
- is ~ G. parse (" -my_id" , : rule<term >), ' -my_id' , ' term parse, leading "-"' ;
142
+ is ~ G. subparse (" -my_id" , : rule<term >), ' -my_id' , ' term parse, leading "-"' ;
143
143
}
144
144
145
145
# vim: ft=perl6
0 commit comments