Skip to content

Commit

Permalink
NASM: Regexp optimisation and simplification + don't use captures if …
Browse files Browse the repository at this point in the history
…not needed
  • Loading branch information
Golmote committed Oct 22, 2017
1 parent 2d3f9df commit 9937428
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions components/prism-nasm.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
Prism.languages.nasm = {
'comment': /;.*$/m,
'string': /("|'|`)(\\?.)*?\1/m,
'string': /(["'`])(?:\\.|(?!\1)[^\\\r\n])*\1/,
'label': {
pattern: /(^\s*)[A-Za-z._?$][\w.?$@~#]*:/m,
lookbehind: true,
alias: 'function'
},
'keyword': [
/\[?BITS (16|32|64)\]?/m,
/\[?BITS (?:16|32|64)\]?/,
{
pattern: /(^\s*)section\s*[a-zA-Z\.]+:?/im,
pattern: /(^\s*)section\s*[a-zA-Z.]+:?/im,
lookbehind: true
},
/(?:extern|global)[^;\r\n]*/im,
/(?:extern|global)[^;\r\n]*/i,
/(?:CPU|FLOAT|DEFAULT).*$/m
],
'register': {
pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(bp|sp|si|di)|[cdefgs]s)\b/i,
pattern: /\b(?:st\d|[xyz]mm\d\d?|[cdt]r\d|r\d\d?[bwd]?|[er]?[abcd]x|[abcd][hl]|[er]?(?:bp|sp|si|di)|[cdefgs]s)\b/i,
alias: 'variable'
},
'number': /(\b|-|(?=\$))(0[hx][\da-f]*\.?[\da-f]+(p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(\.?e[+-]?\d+)?[dt]?)\b/i,
'number': /(?:\b|-|(?=\$))(?:0[hx][\da-f]*\.?[\da-f]+(?:p[+-]?\d+)?|\d[\da-f]+[hx]|\$\d[\da-f]*|0[oq][0-7]+|[0-7]+[oq]|0[by][01]+|[01]+[by]|0[dt]\d+|\d*\.?\d+(?:\.?e[+-]?\d+)?[dt]?)\b/i,
'operator': /[\[\]*+\-\/%<>=&|$!]/
};
2 changes: 1 addition & 1 deletion components/prism-nasm.min.js

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

0 comments on commit 9937428

Please sign in to comment.