Skip to content

Commit

Permalink
Smarty: Optimized regexps + fixed punctuation and operators
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Aug 31, 2015
1 parent 85d8a55 commit 1446700
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions components/prism-smarty.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
pattern: /^\{|\}$/i,
alias: 'punctuation'
},
'string': /(["'])(\\?.)*?\1/,
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
'string': /(["'])(?:\\?.)*?\1/,
'number': /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee][-+]?\d+)?)\b/,
'variable': [
/\$(?!\d)\w+/,
/#(?!\d)\w+#/,
Expand Down Expand Up @@ -48,12 +48,14 @@
pattern: /(=\s*)(?!\d)\w+/,
lookbehind: true
},
"punctuation": /=/
"operator": /=/
}
},
'punctuation': /[\[\]().,=\|:`]|\->/,
'punctuation': [
/[\[\]().,:`]|\->/
],
'operator': [
/[+\-*\/%]|===?|[!<>]=?|&&|\|\|/,
/[+\-*\/%]|==?=?|[!<>]=?|&&|\|\|?/,
/\bis\s+(?:not\s+)?(?:div|even|odd)(?:\s+by)?\b/,
/\b(?:eq|neq?|gt|lt|gt?e|lt?e|not|mod|or|and)\b/
],
Expand Down
2 changes: 1 addition & 1 deletion components/prism-smarty.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1446700

Please sign in to comment.