Skip to content

Commit

Permalink
Bring some improvements to PHP lexer:
Browse files Browse the repository at this point in the history
* translation of PHP's lexer into rouge
* add lexer option short_open_tag to permit highlighting as if
  short_open_tag were off when disabled (enabled by default)
* add some missing features:
  + binary numbers (introduced by PHP 5.4.0)
  + string interpolation in backquoted strings
  + Unicode codepoints escape syntax (\u{...}) (introduced by PHP 7.0.0)
* stricter syntax:
  + <?php is case insensitive
  + a "blank" have to follow <?php (but not <?= nor <?)
  + for doc comments, /** is followed by at least one whitespace
  + keywords are case insensitive
  + function/method names are also case insensitive
* add some missing keywords:
  + type declarations (PHP 7, including void planned for 7.1.0 - master)
  + 7.0.0: class (anonymous classes), yield from
  + 5.5.0: finally
  + 5.4.0: callable, insteadof, trait, __TRAIT__
  + 5.3.0: goto, __NAMESPACE__, __DIR__
  + function, const added to keywords (can't manage them with a rule anymore, it
    conflicts with use - eg: use constant \A\B\C; as introduced by PHP 5.6.0)
  + others: casts, instanceof, __CLASS__, __FUNCTION__, __METHOD__, __halt_compiler
  + self even if it's not really a reserved word
* cleanup in keywords, removal of:
  + predefined constants (eg: E_ERROR or PHP_OS) - which, bsesides, are case sensitive
  + predefined classes (as stdclass)
  • Loading branch information
julp committed Dec 29, 2015
1 parent 76647eb commit 8ac7fc7
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 72 deletions.
Loading

0 comments on commit 8ac7fc7

Please sign in to comment.