Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I've seen a couple of Python Javascript tokenizers and a cryptic document on Mozilla.org about a Javascript Lexer but can't find any Javascript tokenizers for PHP specifically. Are there any?

Thanks

like image 741
Tom Avatar asked Jun 03 '26 04:06

Tom


1 Answers

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.

like image 121
Pekka Avatar answered Jun 05 '26 18:06

Pekka