Update README.md
This commit is contained in:
parent
af379a61dd
commit
9f0d4b02c2
10
README.md
10
README.md
@ -15,6 +15,8 @@ PHP Parser written in Go
|
|||||||
[![Exago](https://api.exago.io:443/badge/cov/github.com/z7zmey/php-parser)](https://exago.io/project/github.com/z7zmey/php-parser)
|
[![Exago](https://api.exago.io:443/badge/cov/github.com/z7zmey/php-parser)](https://exago.io/project/github.com/z7zmey/php-parser)
|
||||||
[![GoDoc](https://godoc.org/github.com/z7zmey/php-parser?status.svg)](https://godoc.org/github.com/z7zmey/php-parser)
|
[![GoDoc](https://godoc.org/github.com/z7zmey/php-parser?status.svg)](https://godoc.org/github.com/z7zmey/php-parser)
|
||||||
|
|
||||||
|
This project uses [goyacc](https://godoc.org/golang.org/x/tools/cmd/goyacc) and [golex](https://github.com/cznic/golex) libraries to parse PHP sources into [AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree). It can be used to write static analysis, refactoring, metrics, code style formatting tools.
|
||||||
|
|
||||||
#### Try it online: [demo](https://php-parser.com)
|
#### Try it online: [demo](https://php-parser.com)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
@ -29,7 +31,7 @@ Features:
|
|||||||
Roadmap
|
Roadmap
|
||||||
-------
|
-------
|
||||||
|
|
||||||
- Saving comments and empty lines
|
- Pretty printer
|
||||||
- Control Flow Graph (CFG)
|
- Control Flow Graph (CFG)
|
||||||
- PhpDocComment parser
|
- PhpDocComment parser
|
||||||
- Stabilize api
|
- Stabilize api
|
||||||
@ -45,7 +47,7 @@ CLI
|
|||||||
---
|
---
|
||||||
|
|
||||||
```
|
```
|
||||||
php-parser [-php5] <path> ...
|
php-parser [-php5 -noDump] <path> ...
|
||||||
```
|
```
|
||||||
|
|
||||||
Dump AST to stdout.
|
Dump AST to stdout.
|
||||||
@ -100,8 +102,8 @@ Parsing syntax-invalid PHP files
|
|||||||
|
|
||||||
If we try to parse `$a$b;` then the parser triggers error 'syntax error: unexpected T_VARIABLE'. Token `$b` is unexpected, but parser recovers parsing process and returns `$b;` statement to AST, because it is syntactically correct.
|
If we try to parse `$a$b;` then the parser triggers error 'syntax error: unexpected T_VARIABLE'. Token `$b` is unexpected, but parser recovers parsing process and returns `$b;` statement to AST, because it is syntactically correct.
|
||||||
|
|
||||||
Pretty printer
|
Pretty printer [work in progress]
|
||||||
--------------
|
---------------------------------
|
||||||
|
|
||||||
```Golang
|
```Golang
|
||||||
nodes := &stmt.StmtList{
|
nodes := &stmt.StmtList{
|
||||||
|
Loading…
Reference in New Issue
Block a user