update README.md
This commit is contained in:
parent
025413d2a0
commit
fb21f2dca5
11
README.md
11
README.md
@ -25,18 +25,21 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/z7zmey/php-parser/parser"
|
||||
"github.com/z7zmey/php-parser/php5"
|
||||
"github.com/z7zmey/php-parser/visitor"
|
||||
)
|
||||
|
||||
func main() {
|
||||
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)
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Roadmap
|
||||
|
3
main.go
3
main.go
@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/yookoala/realpath"
|
||||
"github.com/z7zmey/php-parser/php5"
|
||||
"github.com/z7zmey/php-parser/visitor"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -25,7 +26,7 @@ func main() {
|
||||
src, _ := os.Open(string(path))
|
||||
nodes, comments, positions := php5.Parse(src, path)
|
||||
|
||||
visitor := Dumper{
|
||||
visitor := visitor.Dumper{
|
||||
Indent: " | ",
|
||||
Comments: comments,
|
||||
Positions: positions,
|
||||
|
@ -1,4 +1,4 @@
|
||||
package main
|
||||
package visitor
|
||||
|
||||
import (
|
||||
"fmt"
|
Loading…
Reference in New Issue
Block a user