update README.md

This commit is contained in:
z7zmey 2018-02-04 21:35:46 +02:00
parent 025413d2a0
commit fb21f2dca5
3 changed files with 10 additions and 6 deletions

View File

@ -25,18 +25,21 @@ package main
import ( import (
"bytes" "bytes"
"github.com/z7zmey/php-parser/parser" "github.com/z7zmey/php-parser/php5"
"github.com/z7zmey/php-parser/visitor" "github.com/z7zmey/php-parser/visitor"
) )
func main() { func main() {
src := bytes.NewBufferString(`<? echo "Hello world";`) src := bytes.NewBufferString(`<? echo "Hello world";`)
nodes, comments, positions := parser.ParsePhp7(src, "example.php") nodes, comments, positions := php5.Parse(src, "example.php")
visitor := Dumper{"", comments, positions} visitor := visitor.Dumper{
Indent: "",
Comments: comments,
Positions: positions,
}
nodes.Walk(visitor) nodes.Walk(visitor)
} }
``` ```
## Roadmap ## Roadmap

View File

@ -9,6 +9,7 @@ import (
"github.com/yookoala/realpath" "github.com/yookoala/realpath"
"github.com/z7zmey/php-parser/php5" "github.com/z7zmey/php-parser/php5"
"github.com/z7zmey/php-parser/visitor"
) )
func main() { func main() {
@ -25,7 +26,7 @@ func main() {
src, _ := os.Open(string(path)) src, _ := os.Open(string(path))
nodes, comments, positions := php5.Parse(src, path) nodes, comments, positions := php5.Parse(src, path)
visitor := Dumper{ visitor := visitor.Dumper{
Indent: " | ", Indent: " | ",
Comments: comments, Comments: comments,
Positions: positions, Positions: positions,

View File

@ -1,4 +1,4 @@
package main package visitor
import ( import (
"fmt" "fmt"