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
all: ./parser/parser.go ./parser/scanner.go
all: ./parser/php7.go ./parser/scanner.go
rm -f y.output
gofmt -l -s -w *.go
go build
@ -14,5 +14,5 @@ test: all
./parser/scanner.go: ./parser/scanner.l
golex -o $@ $<
./parser/parser.go: ./parser/parser.y
./parser/php7.go: ./parser/php7.y
goyacc -o $@ $<

View File

@ -31,7 +31,7 @@ import (
func main() {
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}
nodes.Walk(visitor)

View File

@ -23,7 +23,7 @@ func main() {
fmt.Printf("==> %s\n", path)
src, _ := os.Open(string(path))
nodes, comments, positions := parser.Parse(src, path)
nodes, comments, positions := parser.ParsePhp7(src, path)
visitor := Dumper{
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 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
yyErrorVerbose = true
rootnode = stmt.NewStmtList([]node.Node{}) //reset