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 (
|
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
|
||||||
|
3
main.go
3
main.go
@ -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,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package visitor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
Loading…
Reference in New Issue
Block a user