lib/rouge/lexers/php.rb in rouge-3.0.0 vs lib/rouge/lexers/php.rb in rouge-3.1.0

- old
+ new

@@ -75,10 +75,12 @@ ) end def self.detect?(text) return true if text.shebang?('php') + return false if /^<\?hh/ =~ text + return true if /^<\?php/ =~ text end state :root do # some extremely rough heuristics to decide whether to start inline or not rule(/\s*(?=<)/m) { delegate parent; push :template } @@ -95,11 +97,11 @@ state :php do rule /\?>/, Comment::Preproc, :pop! # heredocs rule /<<<('?)(#{id})\1\n.*?\n\2;?\n/im, Str::Heredoc rule /\s+/, Text - rule /#.*?\n/, Comment::Single - rule %r(//.*?\n), Comment::Single + rule /#.*?$/, Comment::Single + rule %r(//.*?$), Comment::Single # empty comment, otherwise seen as the start of a docstring rule %r(/\*\*/), Comment::Multiline rule %r(/\*\*.*?\*/)m, Str::Doc rule %r(/\*.*?\*/)m, Comment::Multiline rule /(->|::)(\s*)(#{id})/ do