├── .gitignore ├── CHANGELOG.md ├── README.md ├── UNLICENSE ├── grammars └── lua-wow.cson ├── package.json ├── screenshot.png ├── settings └── language-lua-wow.cson ├── snippets └── language-lua.cson └── source ├── export_helix.lua └── process.py /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | 5 | source/raw* 6 | source/chunks* 7 | source/Helix 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.0 - First Release 2 | * API should be current for patch 6.2.4 (Mar 23 2016) 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # language-lua-wow 2 | 3 | Add syntax highlighting for the World of Warcraft API in Lua files in Atom. 4 | 5 | ![Example screenshot using the One Dark theme](https://raw.githubusercontent.com/nebularg/language-lua-wow/master/screenshot.png) 6 | 7 | This package provides [language-lua](https://atom.io/packages/language-lua) and adds the following scopes: 8 | - **support.function.wow.api**: [WoW API functions](http://wow.gamepedia.com/World_of_Warcraft_API). 9 | - **support.function.wow.framexml**: Functions implemented in Lua that are used by the UI. 10 | - **support.function.wow.widget.[Widget]**: [Widget methods](http://wow.gamepedia.com/Widget_API). 11 | - **support.function.wow.lua**: Functions that are references to standard library functions, functions added to standard libraries, and added basic functions. ([Lua functions](https://wow.gamepedia.com/Lua_functions)) 12 | - **constant.wow.event**: [Event names](http://wow.gamepedia.com/Events). 13 | 14 | 15 | To change the syntax highlighting for these scopes, you need to add styles to the `style.less` file in your `~/.atom` directory. 16 | 17 | You can open this file in an editor from the File > Stylesheet... menu. 18 | 19 | For example, you could add the following rule to your `~/.atom/styles.less` file to tweak the color of WoW functions: 20 | ```less 21 | atom-text-editor::shadow { 22 | .support.function.wow { 23 | &.api, &.widget { 24 | color: darken(@syntax-color-function, 15%); 25 | } 26 | &.framexml { 27 | color: lighten(@syntax-color-function, 10%); 28 | } 29 | } 30 | } 31 | ``` 32 | 33 | Themes [_probably_](https://github.com/atom/one-dark-syntax/blob/master/styles/syntax-variables.less) have a set of variables defined that you can use, but of course you can always do your own thing. 34 | 35 | ### Credit 36 | 37 | Originally created from the [World of Warcraft Textmate Bundle](http://www.wowace.com/addons/wow-textmate/). 38 | 39 | Keywords are updated from [Townlong Yak](https://www.townlong-yak.com/framexml/), [Wowpedia](http://wow.gamepedia.com/) and [World of Warcraft Programming](http://wowprogramming.com/docs). 40 | 41 | Lua syntax, snippets, and options are from [language-lua](https://github.com/FireZenk/language-lua) by FireZenk. 42 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /grammars/lua-wow.cson: -------------------------------------------------------------------------------- 1 | 'comment': "World of Warcraft specific Lua" 2 | 'fileTypes': [ 'lua' ] 3 | 'name': 'Lua (WoW)' 4 | 'scopeName': 'source.lua' 5 | 6 | 'repository': 7 | 'language-lua': 8 | # language-lua 0.9.7 9 | # Copyright (c) 2014 FireZenk 10 | # 11 | # Permission is hereby granted, free of charge, to any person 12 | # obtaining a copy of this software and associated documentation 13 | # files (the "Software"), to deal in the Software without 14 | # restriction, including without limitation the rights to use, 15 | # copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | # copies of the Software, and to permit persons to whom the 17 | # Software is furnished to do so, subject to the following 18 | # conditions: 19 | # 20 | # The above copyright notice and this permission notice shall be 21 | # included in all copies or substantial portions of the Software. 22 | # 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 25 | # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 27 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 28 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 29 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 30 | # OTHER DEALINGS IN THE SOFTWARE. 31 | 'patterns': [ 32 | { 33 | 'captures': 34 | '1': 35 | 'name': 'keyword.control.lua' 36 | '2': 37 | 'name': 'entity.name.function.scope.lua' 38 | '3': 39 | 'name': 'entity.name.function.lua' 40 | '4': 41 | 'name': 'punctuation.definition.parameters.begin.lua' 42 | '5': 43 | 'name': 'variable.parameter.function.lua' 44 | '6': 45 | 'name': 'punctuation.definition.parameters.end.lua' 46 | 'match': '\\b(function)(?:\\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\\w*)\\s*)?(\\()([^)]*)(\\))' 47 | 'name': 'meta.function.lua' 48 | } 49 | { 50 | 'match': '(?=?|(?=1.0.0 <2.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nebularg/language-lua-wow/cb0ce8c1288ffab24ee2d6f47275e03b12391192/screenshot.png -------------------------------------------------------------------------------- /settings/language-lua-wow.cson: -------------------------------------------------------------------------------- 1 | '.source.lua': 2 | 'editor': 3 | 'commentStart': '-- ' 4 | 'increaseIndentPattern': '((\\b(else|function|then|do|repeat)\\b((?!\\b(end|until)\\b).)*)|(\\{\\s*))$' 5 | 'decreaseIndentPattern': '^\\s*((\\b(elseif|else|end|until)\\b)|(\\})|(\\)))' 6 | -------------------------------------------------------------------------------- /snippets/language-lua.cson: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 FireZenk 2 | # 3 | # Permission is hereby granted, free of charge, to any person 4 | # obtaining a copy of this software and associated documentation 5 | # files (the "Software"), to deal in the Software without 6 | # restriction, including without limitation the rights to use, 7 | # copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | # copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following 10 | # conditions: 11 | # 12 | # The above copyright notice and this permission notice shall be 13 | # included in all copies or substantial portions of the Software. 14 | # 15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | # OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | '.source.lua': 25 | 'multiline comment': 26 | 'prefix': '-[' 27 | 'body': '--[[ ${0:comment...}]' 28 | 'nested multiline comment': 29 | 'prefix': '=[' 30 | 'body': '--[=[ ${0:comment...}]=' 31 | 'function': 32 | 'prefix': 'fun' 33 | 'body': 'function ${1:FunctionName} (${2:args})\n\t${0:-- body...}\nend' 34 | 'anon function': 35 | 'prefix': 'afun' 36 | 'body': '${1:FunctionName} = function (${2:args})\n\t${0:-- body...}\nend' 37 | 'while loop': 38 | 'prefix': 'while' 39 | 'body': 'while ${1:condition} do\n\t${0:-- body...}\nend' 40 | 'while loop shortcut': 41 | 'prefix': 'whi' 42 | 'body': 'while ${1:condition} do\n\t${0:-- body...}\nend' 43 | 'repeat loop': 44 | 'prefix': 'repeat' 45 | 'body': 'repeat\n\t${0:-- body...}\nuntil ${1:condition}' 46 | 'repeat loop shortcut': 47 | 'prefix': 'rep' 48 | 'body': 'repeat\n\t${0:-- body...}\nuntil ${1:condition}' 49 | 'for i,v in ipairs()': 50 | 'prefix': 'fori' 51 | 'body': 'for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:-- body...}\nend' 52 | 'for i=1,10': 53 | 'prefix': 'for' 54 | 'body': 'for ${1:i}=${2:1},${3:10} do\n\t${0:-- body...}\nend' 55 | 'for k,v in pairs()': 56 | 'prefix': 'forp' 57 | 'body': 'for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:-- body...}\nend' 58 | 'local function': 59 | 'prefix': 'lfun' 60 | 'body': 'local function ${1:FunctionName} (${2:args})\n\t${0:-- body...}\nend' 61 | 'local variable definition': 62 | 'prefix': 'local' 63 | 'body': 'local ${1:x} = ${0:1}' 64 | 'local variable definition shortcut': 65 | 'prefix': 'loc' 66 | 'body': 'local ${1:x} = ${0:1}' 67 | 'local table definition': 68 | 'prefix': 'ltab' 69 | 'body': 'local ${0:name} = {}' 70 | 'return definition': 71 | 'prefix': 'return' 72 | 'body': 'return ${0:value}' 73 | 'return definition shortcut': 74 | 'prefix': 'ret' 75 | 'body': 'return ${0:value}' 76 | 'print': 77 | 'prefix': 'print' 78 | 'body': 'print("${0:logging}")' 79 | 'require': 80 | 'prefix': 'require' 81 | 'body': 'local ${0:name} = require "${1:module}"' 82 | 'require shortcut': 83 | 'prefix': 'req' 84 | 'body': 'local ${0:name} = require "${1:module}"' 85 | 'if conditional': 86 | 'prefix': 'if', 87 | 'body': 'if ${1:value} then\n\t${0:--body...}\nend' 88 | 'if else conditional': 89 | 'prefix': 'ife', 90 | 'body': 'if ${1:value} then\n\t${0:--body...}\nelse\n\t${1:--body...}\nend' 91 | 'if not conditional': 92 | 'prefix': 'ifn', 93 | 'body': 'if not ${1:value} then\n\t${0:--body...}\nend' 94 | 'if not else conditional': 95 | 'prefix': 'ifne', 96 | 'body': 'if not ${1:value} then\n\t${0:--body...}\nelse\n\t${1:--body...}\nend' 97 | 'table definition': 98 | 'prefix': 'tab' 99 | 'body': '${0:name} = {}' 100 | 'table.insert': 101 | 'prefix': 'tabi', 102 | 'body': 'table.insert(${0:tableName},${1:data})' 103 | 'table.foreach': 104 | 'prefix': 'tabf', 105 | 'body': 'table.foreach(${0:tableName},${1:function})' 106 | 'table.concat': 107 | 'prefix': 'tabc' 108 | 'body': 'table.concat(${1:tableName}${2:, " "}${3:, start_index}${4:, end_index})' 109 | 'table.sort': 110 | 'prefix': 'tabs', 111 | 'body': 'table.sort(${1:tableName}${2:, sortfunction})' 112 | 'table.remove': 113 | 'prefix': 'tabr', 114 | 'body': 'table.remove(${1:tableName}${2:, position})' 115 | 'table.maxn': 116 | 'prefix': 'tabm', 117 | 'body': 'table.maxn(${1:tableName})' 118 | 'math.abs': 119 | 'prefix': 'abs', 120 | 'body': 'math.abs(${0:x})' 121 | 'math.acos': 122 | 'prefix': 'acos', 123 | 'body': 'math.acos(${0:x})' 124 | 'math.asin': 125 | 'prefix': 'asin', 126 | 'body': 'math.asin(${0:x})' 127 | 'math.atan': 128 | 'prefix': 'atan', 129 | 'body': 'math.atan(${0:x})' 130 | 'math.atan2': 131 | 'prefix': 'atan2', 132 | 'body': 'math.atan2(${0:y}, ${1:x})' 133 | 'math.ceil': 134 | 'prefix': 'ceil', 135 | 'body': 'math.ceil(${0:x})' 136 | 'math.cos': 137 | 'prefix': 'cos', 138 | 'body': 'math.cos(${0:x})' 139 | 'math.cosh': 140 | 'prefix': 'cosh', 141 | 'body': 'math.cosh(${0:x})' 142 | 'math.deg': 143 | 'prefix': 'deg', 144 | 'body': 'math.deg(${0:x})' 145 | 'math.exp': 146 | 'prefix': 'exp', 147 | 'body': 'math.exp(${0:x})' 148 | 'math.floor': 149 | 'prefix': 'floor', 150 | 'body': 'math.floor(${0:x})' 151 | 'math.fmod': 152 | 'prefix': 'fmod', 153 | 'body': 'math.fmod(${0:x}, ${1:y})' 154 | 'math.frexp': 155 | 'prefix': 'frexp', 156 | 'body': 'math.frexp(${0:x})' 157 | 'math.huge': 158 | 'prefix': 'huge', 159 | 'body': 'math.huge' 160 | 'math.ldexp': 161 | 'prefix': 'ldexp', 162 | 'body': 'math.ldexp(${0:m}, ${1:e})' 163 | 'math.log': 164 | 'prefix': 'log', 165 | 'body': 'math.log(${0:x})' 166 | 'math.log10': 167 | 'prefix': 'log10', 168 | 'body': 'math.log10(${0:x})' 169 | 'math.max': 170 | 'prefix': 'max', 171 | 'body': 'math.max(${0:x}, ${1:...})' 172 | 'math.min': 173 | 'prefix': 'min', 174 | 'body': 'math.min(${0:x}, ${1:...})' 175 | 'math.pi': 176 | 'prefix': 'pi', 177 | 'body': 'math.pi' 178 | 'math.pow': 179 | 'prefix': 'pow', 180 | 'body': 'math.pow(${0:x}, ${1:y})' 181 | 'math.rad': 182 | 'prefix': 'rad', 183 | 'body': 'math.rad(${0:x})' 184 | 'math.random': 185 | 'prefix': 'random', 186 | 'body': 'math.random(${0:m}, ${1:n})' 187 | 'math.randomseed': 188 | 'prefix': 'randomseed', 189 | 'body': 'math.randomseed(${0:x})' 190 | 'math.sin': 191 | 'prefix': 'sin', 192 | 'body': 'math.sin(${0:x})' 193 | 'math.sinh': 194 | 'prefix': 'sinh', 195 | 'body': 'math.sinh(${0:x})' 196 | 'math.sqrt': 197 | 'prefix': 'sqrt', 198 | 'body': 'math.sqrt(${0:x})' 199 | 'math.tan': 200 | 'prefix': 'tan', 201 | 'body': 'math.tan(${0:x})' 202 | 'math.tanh': 203 | 'prefix': 'tanh', 204 | 'body': 'math.tanh(${0:x})' 205 | -------------------------------------------------------------------------------- /source/export_helix.lua: -------------------------------------------------------------------------------- 1 | -- could parse in python, but meh. 2 | 3 | local function dofile(file) 4 | local f = assert(io.open(file)) 5 | return assert(loadstring(f:read("*all"):gsub("local ", "")))() -- unlocal the table 6 | end 7 | 8 | local function export(infile, outfile, var) 9 | dofile(infile) 10 | local f = assert(io.open(outfile, "w")) 11 | for _, v in next, _G[var] do 12 | f:write(v .. "\n") 13 | end 14 | end 15 | 16 | export("Helix/GlobalAPI.lua", "raw_api", "GlobalAPI") 17 | export("Helix/Events.lua", "raw_events", "Events") 18 | -------------------------------------------------------------------------------- /source/process.py: -------------------------------------------------------------------------------- 1 | # 2 | # This script generates the patterns used in lua-wow.cson 3 | # 4 | # Copy the relevate bits from the following sites into the specified file then 5 | # run the script! `python process.py > chunks.cson` 6 | # 7 | # https://wow.gamepedia.com/Global_functions#FrameXML_Functions 8 | # - Copy the FrameXML functions into raw_framexml 9 | # http://wowprogramming.com/docs/widgets 10 | # - Copy the left-side headers and functions into raw_widget 11 | # https://www.townlong-yak.com/framexml/ 12 | # - Extract the Helix folder 13 | # - Run export_helix.lua to generate raw_api and raw_events 14 | # 15 | 16 | from __future__ import with_statement, print_function 17 | import re 18 | import sys 19 | 20 | 21 | class Parser(object): 22 | def __init__(self, filename): 23 | self.filename = filename 24 | 25 | @property 26 | def raw_data(self): 27 | with open(self.filename) as fp: 28 | return fp.readlines() 29 | 30 | 31 | class APIParser(Parser): 32 | re_split_c = re.compile(ur"^(.+)\.(.+)$") 33 | 34 | chunk_pattern = """ { 35 | 'match': '(?