Pull requests

#138 Declined
Repository
andyli
Branch
Haxe-rewrite
Repository
birkenfeld
Branch
default

Rewrote the Haxe lexer

Author
  1. Andy Li
Reviewers
Description

Please don't merge it yet

There are some new changes in Haxe... and bugs in the lexer discovered


The original Haxe lexer isn't quite supporting the syntax well. I tried to improve it by fixing the problems one by one, but turn out I found rewriting from sketch is easier.

I have looked at the lexer in the Haxe compiler source to make sure I wouldn't miss anything. The not yet released Haxe 3 features are also considered in the new laxer, including import alias, GADT, pattern matching etc.

Preprocessor macros are correctly handled, using preproc_callback as a callback function, to store/restore the states stack, and that's why HaxeLaxer now extends ExtendedRegexLexer. And it requires a fix in pygments, see: https://bitbucket.org/birkenfeld/pygments-main/pull-request/131/extendedregexlexer-handles-tuple-new_state/diff

Here are some comparisons of the original and the new one:

  1. original vs new
  2. original vs new
  3. original vs new
  • Learn about pull requests

Comments (2)