@@ -44,7 +44,7 @@ class QRegex::NFA {
44
44
$ id ;
45
45
}
46
46
47
- method addedge (int $ from , int $ to , $ action , $ value , : $ newedge = 1 ) {
47
+ method addedge ($ from , $ to , $ action , $ value , : $ newedge = 1 ) {
48
48
$ ! edges := 1 if $ newedge ;
49
49
$ to := self . addstate() if $ to < 0 ;
50
50
my $ st := $ ! states [$ from ];
@@ -61,30 +61,30 @@ class QRegex::NFA {
61
61
self ;
62
62
}
63
63
64
- method regex_nfa ($ node , int $ from , int $ to ) {
64
+ method regex_nfa ($ node , $ from , $ to ) {
65
65
my $ method := ($ node . rxtype // ' concat' );
66
66
self . HOW . can (self , $ method )
67
67
?? self . " $ method" ($ node , $ from , $ to )
68
68
!! self . fate($ node , $ from , $ to );
69
69
}
70
70
71
- method fate ($ node , int $ from , int $ to ) {
71
+ method fate ($ node , $ from , $ to ) {
72
72
self . addedge($ from , 0 , $ EDGE_FATE , 0 , : newedge(0 ))
73
73
}
74
74
75
- method alt ($ node , int $ from , int $ to ) {
75
+ method alt ($ node , $ from , $ to ) {
76
76
for $ node . list {
77
77
my int $ st := self . regex_nfa($ _ , $ from , $ to );
78
78
$ to := $ st if $ to < 0 && $st > 0 ;
79
79
}
80
80
$ to ;
81
81
}
82
82
83
- method anchor ($ node , int $ from , int $ to ) {
83
+ method anchor ($ node , $ from , $ to ) {
84
84
self . addedge($ from , $ to , $ EDGE_EPSILON , 0 );
85
85
}
86
86
87
- method dba ($ node , int $ from , int $ to ) {
87
+ method dba ($ node , $ from , $ to ) {
88
88
self . addedge($ from , $ to , $ EDGE_EPSILON , 0 );
89
89
}
90
90
@@ -98,12 +98,12 @@ class QRegex::NFA {
98
98
% cclass_code <nl > := nqp ::const::CCLASS_NEWLINE;
99
99
}
100
100
101
- method cclass ($ node , int $ from , int $ to ) {
101
+ method cclass ($ node , $ from , $ to ) {
102
102
self . addedge($ from , $ to , $ EDGE_CHARCLASS + ? $ node . negate,
103
103
% cclass_code { $ node . name });
104
104
}
105
105
106
- method concat ($ node , int $ from , int $ to ) {
106
+ method concat ($ node , $ from , $ to ) {
107
107
my int $ i := 0 ;
108
108
my int $ n := + $ node . list - 1 ;
109
109
while $ from > 0 && $ i < $ n {
@@ -113,7 +113,7 @@ class QRegex::NFA {
113
113
$ from > 0 && $ n >= 0 ?? self . regex_nfa($ node [$ i ], $ from , $ to ) !! $ to ;
114
114
}
115
115
116
- method enumcharlist ($ node , int $ from , int $ to ) {
116
+ method enumcharlist ($ node , $ from , $ to ) {
117
117
my $ charlist := $ node [0 ];
118
118
if $ node . subtype eq ' zerowidth' {
119
119
$ from := self . addedge($ from , -1 , $ EDGE_CHARLIST + ? $ node . negate, $ charlist );
@@ -124,7 +124,7 @@ class QRegex::NFA {
124
124
}
125
125
}
126
126
127
- method literal ($ node , int $ from , int $ to ) {
127
+ method literal ($ node , $ from , $ to ) {
128
128
my int $ litlen := nqp :: chars ($ node [0 ]) - 1 ;
129
129
my int $ i := 0 ;
130
130
if $ litlen >= 0 {
@@ -153,7 +153,7 @@ class QRegex::NFA {
153
153
}
154
154
}
155
155
156
- method subrule ($ node , int $ from , int $ to ) {
156
+ method subrule ($ node , $ from , $ to ) {
157
157
my $ subtype := $ node . subtype;
158
158
if $ node . name eq ' before' && ! $ node . negate {
159
159
my int $ end := self . addstate();
@@ -191,7 +191,7 @@ class QRegex::NFA {
191
191
}
192
192
}
193
193
194
- method quant ($ node , int $ from , int $ to ) {
194
+ method quant ($ node , $ from , $ to ) {
195
195
my int $ min := 0 + ($ node . min // 0 );
196
196
my int $ max := 0 + ($ node . max // -1 ); # -1 means Inf
197
197
@@ -269,13 +269,13 @@ class QRegex::NFA {
269
269
}
270
270
}
271
271
272
- method qastnode ($ node , int $ from , int $ to ) {
272
+ method qastnode ($ node , $ from , $ to ) {
273
273
$ node . subtype eq ' zerowidth' || $ node . subtype eq ' declarative' ??
274
274
self . addedge($ from , $ to , $ EDGE_EPSILON , 0 ) !!
275
275
self . fate($ node , $ from , $ to );
276
276
}
277
277
278
- method subcapture ($ node , int $ from , int $ to ) {
278
+ method subcapture ($ node , $ from , $ to ) {
279
279
self . regex_nfa($ node [0 ], $ from , $ to );
280
280
}
281
281
@@ -287,7 +287,7 @@ class QRegex::NFA {
287
287
$ ! states
288
288
}
289
289
290
- method mergesubrule (int $ start , int $ to , $ fate , $ cursor , str $ name , % caller_seen ? ) {
290
+ method mergesubrule ($ start , $ to , $ fate , $ cursor , str $ name , % caller_seen ? ) {
291
291
# nqp::say("adding $name");
292
292
my % seen := nqp :: clone (% caller_seen );
293
293
my @ substates ;
0 commit comments