1
0
Fork 0
mirror of https://github.com/Reuh/language-candran.git synced 2025-10-27 12:19:30 +00:00

Initial commit

This commit is contained in:
FireZenk 2014-03-02 13:37:35 +01:00
commit fa28108235
7 changed files with 228 additions and 0 deletions

1
CONTRIBUTING.md Normal file
View file

@ -0,0 +1 @@
See the [Atom contributing guide](https://atom.io/docs/latest/contributing)

22
LICENSE-MIT Normal file
View file

@ -0,0 +1,22 @@
Copyright (c) 2014 FireZenk <firezenk@gmail.com>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Lua language support in Atom
Add syntax highlighting and snippets to Lua files in Atom.
Originally [converted](http://atom.io/docs/latest/converting-a-text-mate-bundle)
from the [Lua TextMate bundle](https://github.com/textmate/lua.tmbundle).
Contributions are greatly appreciated. Please fork this repository and open a
pull request to add snippets, make grammar tweaks, etc.

156
grammars/lua.cson Normal file
View file

@ -0,0 +1,156 @@
'comment': 'Lua Syntax: version 0.8'
'fileTypes': [
'lua'
]
'firstLineMatch': '\\A#!.*?\\blua\\b'
'name': 'Lua'
'patterns': [
{
'captures':
'1':
'name': 'keyword.control.lua'
'2':
'name': 'entity.name.function.scope.lua'
'3':
'name': 'entity.name.function.lua'
'4':
'name': 'punctuation.definition.parameters.begin.lua'
'5':
'name': 'variable.parameter.function.lua'
'6':
'name': 'punctuation.definition.parameters.end.lua'
'match': '\\b(function)(?:\\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\\w*)\\s*)?(\\()([^)]*)(\\))'
'name': 'meta.function.lua'
}
{
'match': '(?<![\\d.])\\s0x[a-fA-F\\d]+|\\b\\d+(\\.\\d+)?([eE]-?\\d+)?|\\.\\d+([eE]-?\\d+)?'
'name': 'constant.numeric.lua'
}
{
'begin': '\''
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.lua'
'end': '\''
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.lua'
'name': 'string.quoted.single.lua'
'patterns': [
{
'match': '\\\\.'
'name': 'constant.character.escape.lua'
}
]
}
{
'begin': '"'
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.lua'
'end': '"'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.lua'
'name': 'string.quoted.double.lua'
'patterns': [
{
'match': '\\\\.'
'name': 'constant.character.escape.lua'
}
]
}
{
'begin': '(?<=\\.cdef)\\s*(\\[(=*)\\[)'
'beginCaptures':
'0':
'name': 'string.quoted.other.multiline.lua'
'1':
'name': 'punctuation.definition.string.begin.lua'
'contentName': 'meta.embedded.lua'
'end': '(\\]\\2\\])'
'endCaptures':
'0':
'name': 'string.quoted.other.multiline.lua'
'1':
'name': 'punctuation.definition.string.end.lua'
'patterns': [
{
'include': 'source.c'
}
]
}
{
'begin': '(?<!--)\\[(=*)\\['
'beginCaptures':
'0':
'name': 'punctuation.definition.string.begin.lua'
'end': '\\]\\1\\]'
'endCaptures':
'0':
'name': 'punctuation.definition.string.end.lua'
'name': 'string.quoted.other.multiline.lua'
}
{
'begin': '--\\[(=*)\\['
'captures':
'0':
'name': 'punctuation.definition.comment.lua'
'end': '\\]\\1\\]'
'name': 'comment.block.lua'
}
{
'begin': '(^[ \\t]+)?(?=--(?!\\[\\[))'
'beginCaptures':
'1':
'name': 'punctuation.whitespace.comment.leading.lua'
'end': '(?!\\G)'
'patterns': [
{
'begin': '--'
'beginCaptures':
'0':
'name': 'punctuation.definition.comment.lua'
'end': '\\n'
'name': 'comment.line.double-dash.lua'
}
]
}
{
'match': '\\b(break|do|else|for|if|elseif|return|then|repeat|while|until|end|function|local|in)\\b'
'name': 'keyword.control.lua'
}
{
'match': '(?<![^.]\\.|:)\\b(false|nil|true|_G|_VERSION|math\\.(pi|huge))\\b|(?<![.])\\.{3}(?!\\.)'
'name': 'constant.language.lua'
}
{
'match': '(?<![^.]\\.|:)\\b(self)\\b'
'name': 'variable.language.self.lua'
}
{
'match': '(?<![^.]\\.|:)\\b(assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|loadfile|loadstring|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\\b(?=\\s*(?:[({"\']|\\[\\[))'
'name': 'support.function.lua'
}
{
'match': '(?<![^.]\\.|:)\\b(coroutine\\.(create|resume|running|status|wrap|yield)|string\\.(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)|table\\.(concat|insert|maxn|remove|sort)|math\\.(abs|acos|asin|atan2?|ceil|cosh?|deg|exp|floor|fmod|frexp|ldexp|log|log10|max|min|modf|pow|rad|random|randomseed|sinh?|sqrt|tanh?)|io\\.(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)|os\\.(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)|package\\.(cpath|loaded|loadlib|path|preload|seeall)|debug\\.(debug|[gs]etfenv|[gs]ethook|getinfo|[gs]etlocal|[gs]etmetatable|getregistry|[gs]etupvalue|traceback))\\b(?=\\s*(?:[({"\']|\\[\\[))'
'name': 'support.function.library.lua'
}
{
'match': '\\b(and|or|not)\\b'
'name': 'keyword.operator.lua'
}
{
'match': '\\b([A-Za-z_]\\w*)\\b(?=\\s*(?:[({"\']|\\[\\[))'
'name': 'support.function.any-method.lua'
}
{
'match': '(?<=[^.]\\.|:)\\b([A-Za-z_]\\w*)'
'name': 'variable.other.lua'
}
{
'match': '\\+|-|%|#|\\*|\\/|\\^|==?|~=|<=?|>=?|(?<!\\.)\\.{2}(?!\\.)'
'name': 'keyword.operator.lua'
}
]
'scopeName': 'source.lua'

14
package.json Normal file
View file

@ -0,0 +1,14 @@
{
"name": "language-lua",
"version": "0.1.0",
"private": true,
"author": "FireZenk <firezenk@gmail.com>",
"description": "Add syntax highlighting and snippets to Lua files in Atom",
"repository": "https://github.com/FireZenk/language-lua",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"dependencies": {
}
}

View file

@ -0,0 +1,4 @@
'.source.lua':
'editor':
'increaseIndentPattern': '\\b(else|elseif|(local\\s+)?function|then|do|repeat)\\b((?!end).)*$|\\{\\s*$'
'decreaseIndentPattern': '^\\s*(elseif|else|end|\\})\\s*$'

View file

@ -0,0 +1,22 @@
'.source.lua':
'for i,v in ipairs()':
'prefix': 'fori'
'body': 'for ${1:i},${2:v} in ipairs(${3:table_name}) do\n\t${0:print(i,v)}\nend'
'for i=1,10':
'prefix': 'for'
'body': 'for ${1:i}=${2:1},${3:10} do\n\t${0:print(i)}\nend'
'for k,v in pairs()':
'prefix': 'forp'
'body': 'for ${1:k},${2:v} in pairs(${3:table_name}) do\n\t${0:print(k,v)}\nend'
'function':
'prefix': 'function'
'body': 'function ${1:function_name}( ${2:...} )\n\t${0:-- body}\nend'
'local x = 1':
'prefix': 'local'
'body': 'local ${1:x} = ${0:1}'
'table.concat':
'prefix': 'table.concat'
'body': 'table.concat( ${1:tablename}${2:, ", "}${3:, start_index}${4:, end_index} )'
'table.sort':
'prefix': 'table.sort'
'body': 'table.sort( ${1:tablename}${2:, sortfunction} )'