Skip to content

Commit

Permalink
Rewrite PHP lexer to support use statements, function declarations an…
Browse files Browse the repository at this point in the history
…d type declarations (#1489)

This commit involves a large-scale rewrite of the PHP lexer with the aim
of improving the level of semantic detail. Partly this is achieved by
the use of various heuristics that, while not always correct, do hold
for the majority of cases. In particular, the lexer has improved
support for `use` statements, function declarations and type
declarations.

Co-authored-by: julp <julp@users.noreply.github.com>
  • Loading branch information
pyrmont and julp authored Aug 11, 2020
1 parent 76497f8 commit ba2d158
Show file tree
Hide file tree
Showing 4 changed files with 510 additions and 692 deletions.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/hack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def self.keywords
)
end

prepend :template do
prepend :root do
rule %r/<\?hh(\s*\/\/\s*(strict|decl|partial))?$/, Comment::Preproc, :php
end

Expand Down
Loading

0 comments on commit ba2d158

Please sign in to comment.