Skip to content

Commit ad25d22

Browse files
committed
PHP: Fix shell-comment failure now that strings are greedy
1 parent 5d7223c commit ad25d22

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

components/prism-php.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ Prism.languages.php = Prism.languages.extend('clike', {
2020
}
2121
});
2222

23-
// Shell-like comments are matched after strings, because they are less
24-
// common than strings containing hashes...
25-
Prism.languages.insertBefore('php', 'class-name', {
23+
Prism.languages.insertBefore('php', 'string', {
2624
'shell-comment': {
2725
pattern: /(^|[^\\])#.*/,
2826
lookbehind: true,

components/prism-php.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-php.html

+1-13
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,4 @@ <h2>String interpolation</h2>
6767
FOO;
6868
$b = &lt;&lt;&lt;"FOOBAR"
6969
Interpolation inside Heredoc strings {$obj->values[3]->name}
70-
FOOBAR;</code></pre>
71-
72-
<h2>Known failures</h2>
73-
<p>There are certain edge cases where Prism will fail.
74-
There are always such cases in every regex-based syntax highlighter.
75-
However, Prism dares to be open and honest about them.
76-
If a failure is listed here, it doesn’t mean it will never be fixed. This is more of a “known bugs” list, just with a certain type of bug.
77-
</p>
78-
79-
<h3>Shell-like comments containing two quotes of the same type</h3>
80-
<pre><code># Shell-like comment "with quotes" inside
81-
# Shell-like comment 'with quotes' inside</code></pre>
82-
70+
FOOBAR;</code></pre>

0 commit comments

Comments
 (0)