rename php7 parser

This commit is contained in:
z7zmey 2018-01-17 19:16:06 +02:00
parent 76df2ba69b
commit f6911a76b1
5 changed files with 496 additions and 497 deletions

View File

@ -1,6 +1,6 @@
PHPFILE=example.php PHPFILE=example.php
all: ./parser/parser.go ./parser/scanner.go all: ./parser/php7.go ./parser/scanner.go
rm -f y.output rm -f y.output
gofmt -l -s -w *.go gofmt -l -s -w *.go
go build go build
@ -14,5 +14,5 @@ test: all
./parser/scanner.go: ./parser/scanner.l ./parser/scanner.go: ./parser/scanner.l
golex -o $@ $< golex -o $@ $<
./parser/parser.go: ./parser/parser.y ./parser/php7.go: ./parser/php7.y
goyacc -o $@ $< goyacc -o $@ $<

View File

@ -31,7 +31,7 @@ import (
func main() { func main() {
src := bytes.NewBufferString(`<? echo "Hello world";`) src := bytes.NewBufferString(`<? echo "Hello world";`)
nodes, comments, positions := parser.Parse(src, "example.php") nodes, comments, positions := parser.ParsePhp7(src, "example.php")
visitor := Dumper{"", comments, positions} visitor := Dumper{"", comments, positions}
nodes.Walk(visitor) nodes.Walk(visitor)

View File

@ -23,7 +23,7 @@ func main() {
fmt.Printf("==> %s\n", path) fmt.Printf("==> %s\n", path)
src, _ := os.Open(string(path)) src, _ := os.Open(string(path))
nodes, comments, positions := parser.Parse(src, path) nodes, comments, positions := parser.ParsePhp7(src, path)
visitor := Dumper{ visitor := Dumper{
Indent: " | ", Indent: " | ",

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ var comments comment.Comments
var positions position.Positions var positions position.Positions
var positionBuilder position.Builder var positionBuilder position.Builder
func Parse(src io.Reader, fName string) (node.Node, comment.Comments, position.Positions) { func ParsePhp7(src io.Reader, fName string) (node.Node, comment.Comments, position.Positions) {
yyDebug = 0 yyDebug = 0
yyErrorVerbose = true yyErrorVerbose = true
rootnode = stmt.NewStmtList([]node.Node{}) //reset rootnode = stmt.NewStmtList([]node.Node{}) //reset