Permalink
Browse files

[STD] allow ' and - in ident (but only before a letter)

git-svn-id: http://svn.pugscode.org/pugs@21852 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 1ac8a0a commit 93d41de60a3e61268fa0a102f6a4c309f79d5561 lwall committed Aug 8, 2008
Showing with 15 additions and 11 deletions.
  1. +3 −4 Cursor.pmc
  2. +12 −7 STD.pm
View
@@ -156,7 +156,7 @@ sub tweak {
no strict 'refs';
for (;;) {
my $retval = eval {
- $self->deb("Calling $class" . '::multitweak');
+ $self->deb("Calling $class" . '::multitweak') if $DEBUG & DEBUG::mixins;
&{$class . '::multitweak'}($self,@_);
};
return $retval if $retval;
@@ -608,7 +608,6 @@ sub _AUTOLEXnow { my $self = shift;
# Try Real Hard to prevent TRE from recompiling $pat
state $matcher = eval(do { my $prog = <<"END" .
- \$self->deb("GENERATING");
sub {
my \$C = shift;
pos(\$\$buf) = \$C->{_pos};
@@ -619,7 +618,7 @@ END
<<'END'; $prog; });
my $max = @+ - 1;
my $last = @- - 1; # ignore '$0'
- $C->deb("LAST: $last\n");
+ $C->deb("LAST: $last\n") if $DEBUG & DEBUG::lexer;
$result = $fates->[$last-1];
for my $x (1 .. $max) {
my $beg = $-[$x];
@@ -651,7 +650,7 @@ END
return $result;
}
else {
- $self->deb("NO LEXER MATCH");
+ $self->deb("NO LEXER MATCH") if $DEBUG & DEBUG::lexer;
return;
}
}
View
19 STD.pm
@@ -440,10 +440,14 @@ token unv {
]
}
-token ident {
+token identish {
<.alpha> \w*
}
+token ident {
+ <.identish> [<[ ' \- ]><identish>]*
+}
+
# XXX We need to parse the pod eventually to support $= variables.
token pod_comment {
@@ -3841,17 +3845,18 @@ method locmess () {
method lineof ($p) {
return 1 unless defined $p;
my $posprops = self.<_>;
- my $line = $posprops.[$p]<line>;
+ my $line = $posprops.[$p]<L>;
return $line if $line;
$line = 1;
my $pos = 0;
my $orig = self.orig;
- my $text = $$orig;
- while $text ne '' { # XXX needs to recognize #line?
- $posprops.[$pos++]<line> = $line;
- $line++ if substr($text,0,1,'') eq "\n";
+ my @text = split(/^/,$$orig);
+ for @text {
+ $posprops.[$pos++]<L> = $line
+ for 1 .. length($_);
+ $line++;
}
- return $posprops.[$p]<line> // 0;
+ return $posprops.[$p]<L> // 0;
}
# not quite a "between" combinator...

0 comments on commit 93d41de

Please sign in to comment.