z7zmey / php-parser

PHP parser written in Go

Home Page:https://php-parser.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling parser concurrently

antham opened this issue · comments

I wanted to call concurrently the php7 parser but as rootnode, comments and positions are defined as php7 module variable it does not work. What I did to solve this issue, was to move those structures to the lexer struct https://github.com/z7zmey/php-parser/blob/master/scanner/lexer.go#L438 and update the yacc parser file and it has worked.

Did I miss something somewhere to have it working with goroutines ?

If not, do you have a different idea to handle such a case or would you consider a pull request ?

Hello @antham.

I have refactored php5 and php7 packages. Lexer structures renamed to Parser.
The Parser saves inside AST, errors, positions, and comments.
Now we can concurrently create several instances of Parser and run parsing process.

Hello, thank you !

When did you plan to merge it ?

It is already in master.

Ah ok right thank you.