Skip to content

Commit d9bd1df

Browse files
committed
[z7zmey#120] move dog.go from root folder
1 parent 15562c7 commit d9bd1df

File tree

2 files changed

+50
-54
lines changed

2 files changed

+50
-54
lines changed

doc.go

-54
This file was deleted.

pkg/parser/doc.go

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
3+
A Parser for PHP written in Go
4+
5+
Package usage example:
6+
7+
package main
8+
9+
import (
10+
"log"
11+
"os"
12+
13+
"github.com/z7zmey/php-parser/pkg/cfg"
14+
"github.com/z7zmey/php-parser/pkg/errors"
15+
"github.com/z7zmey/php-parser/pkg/parser"
16+
"github.com/z7zmey/php-parser/pkg/version"
17+
"github.com/z7zmey/php-parser/pkg/visitor/dumper"
18+
)
19+
20+
func main() {
21+
src := []byte(`<? echo "Hello world";`)
22+
23+
// Error handler
24+
25+
var parserErrors []*errors.Error
26+
errorHandler := func(e *errors.Error) {
27+
parserErrors = append(parserErrors, e)
28+
}
29+
30+
// Parse
31+
32+
rootNode, err := parser.Parse(src, cfg.Config{
33+
Version: &version.Version{Major: 5, Minor: 6},
34+
ErrorHandlerFunc: errorHandler,
35+
})
36+
37+
if err != nil {
38+
log.Fatal("Error:" + err.Error())
39+
}
40+
41+
// Dump
42+
43+
goDumper := dumper.NewDumper(os.Stdout).
44+
WithTokens().
45+
WithPositions()
46+
47+
rootNode.Accept(goDumper)
48+
}
49+
*/
50+
package parser

0 commit comments

Comments
 (0)