Skip to content

Commit 49dd649

Browse files
committed
Remove some bogus type constraints.
Since we typically calculate with floats in NQP, we can't rely on the arguments being int here. Somehow we get away with this on Parrot, but NQP JVM enforces them more Perl 6-ishly. Also, they may have led to reboxing, so we may be better off without them anyway.
1 parent dacc4d7 commit 49dd649

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/QRegex/NFA.nqp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class QRegex::NFA {
4444
$id;
4545
}
4646

47-
method addedge(int $from, int $to, $action, $value, :$newedge = 1) {
47+
method addedge($from, $to, $action, $value, :$newedge = 1) {
4848
$!edges := 1 if $newedge;
4949
$to := self.addstate() if $to < 0;
5050
my $st := $!states[$from];
@@ -61,30 +61,30 @@ class QRegex::NFA {
6161
self;
6262
}
6363

64-
method regex_nfa($node, int $from, int $to) {
64+
method regex_nfa($node, $from, $to) {
6565
my $method := ($node.rxtype // 'concat');
6666
self.HOW.can(self, $method)
6767
?? self."$method"($node, $from, $to)
6868
!! self.fate($node, $from, $to);
6969
}
7070

71-
method fate($node, int $from, int $to) {
71+
method fate($node, $from, $to) {
7272
self.addedge($from, 0, $EDGE_FATE, 0, :newedge(0))
7373
}
7474

75-
method alt($node, int $from, int $to) {
75+
method alt($node, $from, $to) {
7676
for $node.list {
7777
my int $st := self.regex_nfa($_, $from, $to);
7878
$to := $st if $to < 0 && $st > 0;
7979
}
8080
$to;
8181
}
8282

83-
method anchor($node, int $from, int $to) {
83+
method anchor($node, $from, $to) {
8484
self.addedge($from, $to, $EDGE_EPSILON, 0);
8585
}
8686

87-
method dba($node, int $from, int $to) {
87+
method dba($node, $from, $to) {
8888
self.addedge($from, $to, $EDGE_EPSILON, 0);
8989
}
9090

@@ -98,12 +98,12 @@ class QRegex::NFA {
9898
%cclass_code<nl> := nqp::const::CCLASS_NEWLINE;
9999
}
100100

101-
method cclass($node, int $from, int $to) {
101+
method cclass($node, $from, $to) {
102102
self.addedge($from, $to, $EDGE_CHARCLASS + ?$node.negate,
103103
%cclass_code{ $node.name });
104104
}
105105

106-
method concat($node, int $from, int $to) {
106+
method concat($node, $from, $to) {
107107
my int $i := 0;
108108
my int $n := +$node.list - 1;
109109
while $from > 0 && $i < $n {
@@ -113,7 +113,7 @@ class QRegex::NFA {
113113
$from > 0 && $n >= 0 ?? self.regex_nfa($node[$i], $from, $to) !! $to;
114114
}
115115

116-
method enumcharlist($node, int $from, int $to) {
116+
method enumcharlist($node, $from, $to) {
117117
my $charlist := $node[0];
118118
if $node.subtype eq 'zerowidth' {
119119
$from := self.addedge($from, -1, $EDGE_CHARLIST + ?$node.negate, $charlist);
@@ -124,7 +124,7 @@ class QRegex::NFA {
124124
}
125125
}
126126

127-
method literal($node, int $from, int $to) {
127+
method literal($node, $from, $to) {
128128
my int $litlen := nqp::chars($node[0]) - 1;
129129
my int $i := 0;
130130
if $litlen >= 0 {
@@ -153,7 +153,7 @@ class QRegex::NFA {
153153
}
154154
}
155155

156-
method subrule($node, int $from, int $to) {
156+
method subrule($node, $from, $to) {
157157
my $subtype := $node.subtype;
158158
if $node.name eq 'before' && !$node.negate {
159159
my int $end := self.addstate();
@@ -191,7 +191,7 @@ class QRegex::NFA {
191191
}
192192
}
193193

194-
method quant($node, int $from, int $to) {
194+
method quant($node, $from, $to) {
195195
my int $min := 0 + ($node.min // 0);
196196
my int $max := 0 + ($node.max // -1); # -1 means Inf
197197

@@ -269,13 +269,13 @@ class QRegex::NFA {
269269
}
270270
}
271271

272-
method qastnode($node, int $from, int $to) {
272+
method qastnode($node, $from, $to) {
273273
$node.subtype eq 'zerowidth' || $node.subtype eq 'declarative' ??
274274
self.addedge($from, $to, $EDGE_EPSILON, 0) !!
275275
self.fate($node, $from, $to);
276276
}
277277

278-
method subcapture($node, int $from, int $to) {
278+
method subcapture($node, $from, $to) {
279279
self.regex_nfa($node[0], $from, $to);
280280
}
281281

@@ -287,7 +287,7 @@ class QRegex::NFA {
287287
$!states
288288
}
289289

290-
method mergesubrule(int $start, int $to, $fate, $cursor, str $name, %caller_seen?) {
290+
method mergesubrule($start, $to, $fate, $cursor, str $name, %caller_seen?) {
291291
#nqp::say("adding $name");
292292
my %seen := nqp::clone(%caller_seen);
293293
my @substates;

0 commit comments

Comments
 (0)