source: node_modules/refractor/lang/lua.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 932 bytes
Line 
1'use strict'
2
3module.exports = lua
4lua.displayName = 'lua'
5lua.aliases = []
6function lua(Prism) {
7 Prism.languages.lua = {
8 comment: /^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,
9 // \z may be used to skip the following space
10 string: {
11 pattern:
12 /(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,
13 greedy: true
14 },
15 number:
16 /\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,
17 keyword:
18 /\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,
19 function: /(?!\d)\w+(?=\s*(?:[({]))/,
20 operator: [
21 /[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,
22 {
23 // Match ".." but don't break "..."
24 pattern: /(^|[^.])\.\.(?!\.)/,
25 lookbehind: true
26 }
27 ],
28 punctuation: /[\[\](){},;]|\.+|:+/
29 }
30}
Note: See TracBrowser for help on using the repository browser.