UNPKG

751 BJavaScriptView Raw
1Prism.languages.lua = {
2 'comment': /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
3 // \z may be used to skip the following space
4 'string': {
5 pattern: /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[\s\S]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
6 greedy: true
7 },
8 'number': /\b0x[a-f\d]+\.?[a-f\d]*(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|\.?\d*(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
9 'keyword': /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
10 'function': /(?!\d)\w+(?=\s*(?:[({]))/,
11 'operator': [
12 /[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,
13 {
14 // Match ".." but don't break "..."
15 pattern: /(^|[^.])\.\.(?!\.)/,
16 lookbehind: true
17 }
18 ],
19 'punctuation': /[\[\](){},;]|\.+|:+/
20};
\No newline at end of file