Skip to content

Commit 69bef71

Browse files
committed
Remove use of $*ORIG in STD.pm6
1 parent b9c20c5 commit 69bef71

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

CursorBase.pmc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ sub pos :lvalue { $_[0]->{_pos} }
129129
sub chars { $_[0]->{_pos} - ($_[0]->{_from} // $_[0]->{_pos}) }
130130
sub Str { no warnings; exists $_[0]->{_from} && defined $_[0]->{_pos} ? substr($::ORIG, $_[0]->{_from}, $_[0]->{_pos} - $_[0]->{_from})//'' : '' }
131131
sub xact { $_[0]->{_xact} // die "internal error: cursor has no xact!!!" }
132-
sub orig { \$::ORIG }
132+
sub orig { $::ORIG }
133133
sub WHAT { ref $_[0] || $_[0] }
134134

135135
sub item { $_[0] }

STD.pm6

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ token morename {
341341
method peek_delimiters {
342342
my $pos = self.pos;
343343
my $startpos = $pos;
344-
my $char = substr($*ORIG,$pos++,1);
344+
my $char = substr(self.orig,$pos++,1);
345345
if $char ~~ /^\s$/ {
346346
self.panic("Whitespace character is not allowed as delimiter"); # "can't happen"
347347
}
@@ -359,7 +359,7 @@ method peek_delimiters {
359359
if not defined $rightbrack {
360360
return $char, $char;
361361
}
362-
while substr($*ORIG,$pos,1) eq $char {
362+
while substr(self.orig,$pos,1) eq $char {
363363
$pos++;
364364
}
365365
my $len = $pos - $startpos;
@@ -454,7 +454,7 @@ token nibbler {
454454
}
455455
|| .
456456
{
457-
my $ch = substr($*ORIG, $¢.pos-1, 1);
457+
my $ch = substr(self.orig, $¢.pos-1, 1);
458458
$text ~= $ch;
459459
$to =.pos;
460460
if $ch ~~ "\n" {
@@ -2117,7 +2117,7 @@ grammar P6 is STD {
21172117
token special_variable:sym<$!{ }> {
21182118
'$!' '{' ~ '}' [<identifier> | <statementlist>]
21192119
{
2120-
my $all = substr($*ORIG, self.pos, $¢.pos - self.pos);
2120+
my $all = substr(self.orig, self.pos, $¢.pos - self.pos);
21212121
my ($inside) = $all ~~ m!^...\s*(.*?)\s*.$!;
21222122
.obs("Perl 5's $all construct", "a smartmatch like \$! ~~ $inside" );
21232123
}
@@ -2457,7 +2457,7 @@ grammar P6 is STD {
24572457
:dba('new name to be defined')
24582458
<name>
24592459
[
2460-
| <colonpair>+ {.add_categorical(substr($*ORIG, self.pos, $¢.pos - self.pos)) if $*IN_DECL; }
2460+
| <colonpair>+ {.add_categorical(substr(self.orig, self.pos, $¢.pos - self.pos)) if $*IN_DECL; }
24612461
| {.add_routine($<name>.Str) if $*IN_DECL; }
24622462
]
24632463
}
@@ -2756,7 +2756,7 @@ grammar P6 is STD {
27562756
$*LEFTSIGIL = '@';
27572757
if $lexsig {
27582758
$*CURLEX.<$?SIGNATURE> ~= '|' if $lexsig > 1;
2759-
$*CURLEX.<$?SIGNATURE> ~= '(' ~ substr($*ORIG, $startpos, $¢.pos - $startpos) ~ ')';
2759+
$*CURLEX.<$?SIGNATURE> ~= '(' ~ substr(self.orig, $startpos, $¢.pos - $startpos) ~ ')';
27602760
$*CURLEX.<!NEEDSIG>:delete;
27612761
}
27622762
}
@@ -3982,7 +3982,7 @@ grammar P6 is STD {
39823982
.check_nodecl($name) if $isname;
39833983
}
39843984
<args($isname)>
3985-
{ self.add_mystery($<identifier>,$pos,substr($*ORIG,$pos,1)) unless $<args><invocant>; }
3985+
{ self.add_mystery($<identifier>,$pos,substr(self.orig,$pos,1)) unless $<args><invocant>; }
39863986
{
39873987
if $*BORG and $*BORG.<block> {
39883988
if not $*BORG.<name> {
@@ -4748,7 +4748,7 @@ grammar Regex is STD {
47484748
<?before \s | '#'> [ :lang(%*LANG<MAIN>) <.ws> ]
47494749
}
47504750

4751-
token unsp { '\\' <?before \s | '#'> <.panic: "No unspace allowed in regex; if you meant to match the literal character, please enclose in single quotes ('" ~ substr($::ORIG,$¢.pos,1) ~ "') or use a backslashed form like \\x" ~ sprintf('%02x', ord(substr($::ORIG,$¢.pos,1)))> } # no unspace in regexen
4751+
token unsp { '\\' <?before \s | '#'> <.panic: "No unspace allowed in regex; if you meant to match the literal character, please enclose in single quotes ('" ~ substr(self.orig,$¢.pos,1) ~ "') or use a backslashed form like \\x" ~ sprintf('%02x', ord(substr(self.orig,$¢.pos,1)))> } # no unspace in regexen
47524752

47534753
rule nibbler {
47544754
:temp %*RX;
@@ -4770,7 +4770,7 @@ grammar Regex is STD {
47704770
[
47714771
|| <?before <stopper> | <[&|~]> > <.panic: "Null pattern not allowed">
47724772
|| <?before <[ \] \) \> ]> > {
4773-
my $c = substr($*ORIG,$¢.pos,1);
4773+
my $c = substr(self.orig,$¢.pos,1);
47744774
if $*GOAL eq $c {
47754775
.panic("Null pattern not allowed");
47764776
}
@@ -4941,7 +4941,7 @@ grammar Regex is STD {
49414941
token metachar:sym<" "> { <?before '"'> [:lang(%*LANG<MAIN>) <quote>] }
49424942

49434943
token metachar:var {
4944-
:my $*QSIGIL ::= substr($*ORIG,self.pos,1);
4944+
:my $*QSIGIL ::= substr(self.orig,self.pos,1);
49454945
<!before '$$'>
49464946
<?before <sigil>>
49474947
[:lang(%*LANG<MAIN>) <variable> ]
@@ -5157,7 +5157,7 @@ grammar Regex is STD {
51575157
token quantifier:sym<{N,M}> {
51585158
{} '{' (\d+) (','?) (\d*) '}'
51595159
{
5160-
my $all = substr($*ORIG, self.pos, $¢.pos - self.pos);
5160+
my $all = substr(self.orig, self.pos, $¢.pos - self.pos);
51615161
my $repl = chars($1.Str) ??
51625162
($0.Str ~ '..' ~ ($2.Str || '*')) !! $0.Str;
51635163
.sorryobs($all ~ " as general quantifier", 'X**' ~ $repl);
@@ -6000,7 +6000,7 @@ method panic (Str $s) {
60006000
60016001
$m ~= $s;
60026002
6003-
if substr($*ORIG,$here.pos,1) ~~ /\)|\]|\}|/ {
6003+
if substr(self.orig,$here.pos,1) ~~ /\)|\]|\}|/ {
60046004
$m ~~ s|Confused|Unexpected closing bracket| and $highvalid = False;
60056005
}
60066006

0 commit comments

Comments
 (0)