Skip to content

Commit

Permalink
C-like: use look-ahead instead of inside to match functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Jul 11, 2015
1 parent 1f0a336 commit d4194c9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
7 changes: 1 addition & 6 deletions components/prism-clike.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@ Prism.languages.clike = {
},
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
'boolean': /\b(true|false)\b/,
'function': {
pattern: /[a-z0-9_]+\(/i,
inside: {
punctuation: /\(/
}
},
'function': /[a-z0-9_]+(?=\()/i,
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,
'punctuation': /[{}[\];(),.:]/
Expand Down
2 changes: 1 addition & 1 deletion components/prism-clike.min.js

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

7 changes: 1 addition & 6 deletions prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,7 @@ Prism.languages.clike = {
},
'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
'boolean': /\b(true|false)\b/,
'function': {
pattern: /[a-z0-9_]+\(/i,
inside: {
punctuation: /\(/
}
},
'function': /[a-z0-9_]+(?=\()/i,
'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/,
'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|~|\^|%/,
'punctuation': /[{}[\];(),.:]/
Expand Down

0 comments on commit d4194c9

Please sign in to comment.