Closed yfwz100 closed 8 years ago
That sounds great. Thanks for your contribution.
Before I merge, could you add a few comments and explanations to your parser function so I am going to be able to understand and expand this when required?
It's a state machine defined via lex. The main component of the modification is the parse()
method. parse()
method parse the source text: when it came across keyword(function
/class
/(
/)
/{
/}
), it stores the identity word hierarchically.
I try to find a well-known PHP parser but I couldn't find one implemented in JavaScript.
I added some comments on the code, @Hirse.
@yfwz100, I have modified your code a little bit and started with adding tests for it. If you feel like helping out some more, more tests are always welcome. :wink:
The code structure is nice :smile: . I am glad to help improve this plugin if I have time. It's really nice to show the meaningful code structure when navigating in a large file.
I drafted a simple parser using lex. I don't know how to include such dependency so I just created a file in
thirdparty
folder.This proposal is for #57 and it seems to fix #42 .