scanner doesn't support \x80-\xff identifiers
ganlvtech opened this issue · comments
On dev branch.
Line 61 in a7e37ad
There is \x7f-\xff in .rl file.
Lines 4932 to 4952 in a7e37ad
But there isn't code like
if lex.data[(lex.p)] >= 127 {
goto st128
}
By the way, what I found on php.net says, as a regular expression, it would be expressed thus: ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$
. See php variables basics.
Test script:
main.go
package main
import (
"fmt"
"os"
"github.com/z7zmey/php-parser/php5"
"github.com/z7zmey/php-parser/visitor"
)
func main() {
bytes := []byte("<?php $\x80=1;echo $\x80;")
parser := php5.NewParser(bytes)
parser.Parse()
for _, e := range parser.GetErrors() {
fmt.Println(e, e.Pos)
}
visitor := visitor.Dumper{
Writer: os.Stdout,
Indent: "",
}
rootNode := parser.GetRootNode()
rootNode.Walk(&visitor)
}
Thank you for the pull request. I have also added a test for this case.