开发者

Is there a Javascript lexer / tokenizer (in PHP)?

I've seen a couple of Python Javascript tokenizers and a c开发者_如何学JAVAryptic document on Mozilla.org about a Javascript Lexer but can't find any Javascript tokenizers for PHP specifically. Are there any?

Thanks


I have no experience with either, so I can't tell you anything about what they do and in what detail they tokenize code into, but I can see two:

  • JSLint is an executable but comes with a PHP interface - probably not enough for you, as it probably doesn't publish the raw tokenization to the calling program

  • PHPSniffer claims to come with a full Javascript tokenizer that you can maybe tap into. This looks the most interesting.


Check out Javascript for PHP5
http://j4p5.sourceforge.net/
(It's an older project, but IIRC had a pretty complete tokenizer.)


JSMin+ a javascript minify implementation in PHP which includes a JSTokenizer.

It used Narcissus from Mozilla as a starting point.


jTokenizer / jParser. jTokenizer mimics the PHP tokenizer. jParser generates a parse tree, which can be traversed and manipulated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜