-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unable to use phpgrep as library #70
Comments
Right now it's not easy to use phpgrep as a library since the matching code is now implemented in noverify/phpgrep. You can try using |
I checked it but did not see way to use phpgrep as package and use exported
function. Do you have any references?
Do I need to use phpgrep as cmd using os/exec.Command function only? Then it should take care of phpgrep installation as binary.
…On Wed, 24 Feb 2021, 06:55 Iskander (Alex) Sharipov, < ***@***.***> wrote:
Right now it's not easy to use phpgrep as a library since the matching
code is now implemented in noverify/phpgrep
<https://github.com/VKCOM/noverify/tree/master/src/phpgrep>.
You can try using github.com/VKCOM/noverify as a dependency.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#70 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXN3JCWFS7I6UYKCVB4SYTTARIRLANCNFSM4YC63KTQ>
.
|
Here is how you add it as a library: Then you import it: phpgrep/internal/phpgrep/program.go Line 23 in 3a5ded7
And then you use it: phpgrep/internal/phpgrep/program.go Lines 122 to 125 in 3a5ded7
phpgrep operates on IR rather than raw AST, so the conversion step is needed as well when matching: phpgrep/internal/phpgrep/worker.go Lines 46 to 52 in 971627f
If you can explain how would you like to use it, maybe we can make that use case less inconvenient. |
thanks @quasilyte.
using phpgrep as command line and with pattern same thing as a library (as instructed by you above) I am getting no matches or sometimes syntax error at line 1
Appreciating your help. |
@quasilyte please check my comment above with example, this isnot giving any matches. getting |
getting error "use of internal package github.com/quasilyte/phpgrep/internal/phpgrep not allowed"
Readme says phpgrep can be used as command as well as library but its not, please help us getting the right way or there is any fix required ?
The text was updated successfully, but these errors were encountered: