Skip to content

Commit

Permalink
Merge pull request syntaxhighlighter#71 from rwstauner/perl-empty-q-ops
Browse files Browse the repository at this point in the history
Allow perl quote-like operators to be empty
  • Loading branch information
alexgorbatchev committed Mar 18, 2012
2 parents 19626a0 + 0e99c88 commit 985329b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/shBrushPerl.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
{ regex: /-?\w+(?=\s*=(>|>))/g, css: 'string' }, // fat comma

// is this too much?
{ regex: /\bq[qwxr]?\([\s\S]+?\)/g, css: 'string' }, // quote-like operators ()
{ regex: /\bq[qwxr]?\{[\s\S]+?\}/g, css: 'string' }, // quote-like operators {}
{ regex: /\bq[qwxr]?\[[\s\S]+?\]/g, css: 'string' }, // quote-like operators []
{ regex: /\bq[qwxr]?(<|&lt;)[\s\S]+?(>|&gt;)/g, css: 'string' }, // quote-like operators <>
{ regex: /\bq[qwxr]?([^\w({<[])[\s\S]+?\1/g, css: 'string' }, // quote-like operators non-paired
{ regex: /\bq[qwxr]?\([\s\S]*?\)/g, css: 'string' }, // quote-like operators ()
{ regex: /\bq[qwxr]?\{[\s\S]*?\}/g, css: 'string' }, // quote-like operators {}
{ regex: /\bq[qwxr]?\[[\s\S]*?\]/g, css: 'string' }, // quote-like operators []
{ regex: /\bq[qwxr]?(<|&lt;)[\s\S]*?(>|&gt;)/g, css: 'string' }, // quote-like operators <>
{ regex: /\bq[qwxr]?([^\w({<[])[\s\S]*?\1/g, css: 'string' }, // quote-like operators non-paired

{ regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
{ regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
Expand Down
1 change: 1 addition & 0 deletions tests/brushes/perl.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

sub something (;$) { Print @_ } # upper-case P
*Other::Package::foo = sub { q!bad! };
my $str = do { my $empty = q{}; $empty .= q'_'; };

print <<HERE;
doc;
Expand Down

0 comments on commit 985329b

Please sign in to comment.