rename php7 parser
This commit is contained in:
parent
76df2ba69b
commit
f6911a76b1
4
Makefile
4
Makefile
@ -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 $@ $<
|
||||
|
@ -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)
|
||||
|
2
main.go
2
main.go
@ -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
@ -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
|
Loading…
Reference in New Issue
Block a user