Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple operator rule in PHP lexer #1478

Merged
merged 3 commits into from Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/rouge/lexers/php.rb
Expand Up @@ -117,7 +117,8 @@ def self.detect?(text)
end

rule %r/(void|\??(int|float|bool|string|iterable|self|callable))\b/i, Keyword::Type
rule %r/[~!%^&*+=\|:.<>\/?@-]+/, Operator
rule %r/[~!%^&*+=\|:.<>\/@-]+/, Operator
rule %r/\?/, Operator
rule %r/[\[\]{}();,]/, Punctuation
rule %r/(class|interface|trait)(\s+)(#{nsid})/i do
groups Keyword::Declaration, Text, Name::Class
Expand Down
9 changes: 9 additions & 0 deletions spec/visual/samples/php
Expand Up @@ -628,4 +628,13 @@ class Zip extends Archive {
}

?>

<?php if (true): ?><!-- Notice the space between the colon & question mark -->
<p>Hello world!</p>
<?php endif ?>

<?php if (true) :?><!-- No space -->
<p>Hello world!</p>
<?php endif ?>

<p>it's html here at the end, too.</p>