mirror of
https://github.com/Reuh/sublime-candran.git
synced 2025-10-27 18:19:31 +00:00
Initial commit
This commit is contained in:
commit
aff3d6807d
6 changed files with 168 additions and 0 deletions
5
Candran.sublime-build
Executable file
5
Candran.sublime-build
Executable file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"cmd": ["can", "$file"],
|
||||||
|
"file_regex": "^(?:can:)?[\t ](...*?):([0-9]*):?([0-9]*)",
|
||||||
|
"selector": "source.can"
|
||||||
|
}
|
||||||
95
Candran.sublime-syntax
Executable file
95
Candran.sublime-syntax
Executable file
|
|
@ -0,0 +1,95 @@
|
||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Candran
|
||||||
|
comment: "Candran Syntax: version 0.8"
|
||||||
|
file_extensions:
|
||||||
|
- can
|
||||||
|
- candran
|
||||||
|
first_line_match: \A#!.*?\bcan\b
|
||||||
|
scope: source.can
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: '\b(function)\s+([a-zA-Z_.:]+[.:])?([a-zA-Z_]\w*)\s*(\()([^)]*)(\))'
|
||||||
|
scope: meta.function.lua
|
||||||
|
captures:
|
||||||
|
1: keyword.control.lua
|
||||||
|
2: entity.name.function.scope.lua
|
||||||
|
3: entity.name.function.lua
|
||||||
|
4: punctuation.definition.parameters.begin.lua
|
||||||
|
5: variable.parameter.function.lua
|
||||||
|
6: punctuation.definition.parameters.end.lua
|
||||||
|
- match: '(?<!function|\w|\s)\s*(\()((?:(?:\s*[\w]+\s*(?:=\s*[^,]+?)?,)*(?:\s*[\w]+\s*(?:=\s*[^,]+?)?))?)(\))'
|
||||||
|
scope: meta.function.lua
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.parameters.begin.lua
|
||||||
|
2: variable.parameter.function.lua
|
||||||
|
3: punctuation.definition.parameters.end.lua
|
||||||
|
- match: '(?<![\d.])\b0[xX][a-fA-F\d\.]+([pP][\-\+]?\d+)?|\b\d+(\.\d+)?([eE]-?\d+)?|\.\d+([eE]-?\d+)?'
|
||||||
|
scope: constant.numeric.lua
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.lua
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.lua
|
||||||
|
- match: "'"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.lua
|
||||||
|
pop: true
|
||||||
|
- match: '\\([abfnrtv\\"'']|\r?\n|\n\r?|\d\d?\d?)'
|
||||||
|
scope: constant.character.escape.lua
|
||||||
|
- match: '\\[xX][0-9a-fA-F][0-9a-fA-F]'
|
||||||
|
scope: constant.character.escape.lua
|
||||||
|
- match: '\\u\{[0-9a-fA-F]{,7}\}'
|
||||||
|
scope: constant.character.escape.lua
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.lua
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.lua
|
||||||
|
- match: '"'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.lua
|
||||||
|
pop: true
|
||||||
|
- match: '\\([abfnrtv\\"'']|\r?\n|\n\r?|\d\d?\d?)'
|
||||||
|
scope: constant.character.escape.lua
|
||||||
|
- match: '\\[xX][0-9a-fA-F][0-9a-fA-F]'
|
||||||
|
scope: constant.character.escape.lua
|
||||||
|
- match: '\\u\{[0-9a-fA-F]{,7}\}'
|
||||||
|
scope: constant.character.escape.lua
|
||||||
|
- match: '(?<!--)\[(=*)\['
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.lua
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.other.multiline.lua
|
||||||
|
- match: '\]\1\]'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.lua
|
||||||
|
pop: true
|
||||||
|
- match: '--\[(=*)\['
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.lua
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.lua
|
||||||
|
- match: '\]\1\]'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.lua
|
||||||
|
pop: true
|
||||||
|
- match: '(--)(?!\[\[).*$\n?'
|
||||||
|
scope: comment.line.double-dash.lua
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.lua
|
||||||
|
- match: \b(and|or|not|break|do|else|for|if|elseif|return|then|repeat|while|until|end|function|local|in|goto|continue|let|push)\b
|
||||||
|
scope: keyword.control.lua
|
||||||
|
- match: '(?<![^.]\.|:)\b(false|nil|true|_G|_VERSION|math\.(pi|huge))\b|(?<![.])\.{3}(?!\.)'
|
||||||
|
scope: constant.language.lua
|
||||||
|
- match: '(?<![^.]\.|:)\b(self|@)\b'
|
||||||
|
scope: 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(?=[( {"''\[])'
|
||||||
|
scope: 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(?=[( {"''\[])'
|
||||||
|
scope: support.function.library.lua
|
||||||
|
- match: \b(and|or|not)\b
|
||||||
|
scope: keyword.operator.lua
|
||||||
|
- match: '\+|-|%|#|\*|\/|\^|==?|~=|<=?|>=?|(?<!\.)\.{2}(?!\.)'
|
||||||
|
scope: keyword.operator.lua
|
||||||
33
Comments.tmPreferences
Executable file
33
Comments.tmPreferences
Executable file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Comments</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>source.can</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>shellVariables</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>TM_COMMENT_START</string>
|
||||||
|
<key>value</key>
|
||||||
|
<string>-- </string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>TM_COMMENT_START_2</string>
|
||||||
|
<key>value</key>
|
||||||
|
<string>--[[</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>TM_COMMENT_END_2</string>
|
||||||
|
<key>value</key>
|
||||||
|
<string>--]]</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
12
Completion Rules.tmPreferences
Executable file
12
Completion Rules.tmPreferences
Executable file
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>source.can</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>cancelCompletion</key>
|
||||||
|
<string>^.*\b(?:end|do|else)$</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
18
Indent.tmPreferences
Executable file
18
Indent.tmPreferences
Executable file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>name</key>
|
||||||
|
<string>Indent</string>
|
||||||
|
<key>scope</key>
|
||||||
|
<string>source.can</string>
|
||||||
|
<key>settings</key>
|
||||||
|
<dict>
|
||||||
|
<key>decreaseIndentPattern</key>
|
||||||
|
<string>^\s*(elseif|else|end|\})\s*$</string>
|
||||||
|
<key>increaseIndentPattern</key>
|
||||||
|
<string>^.*\b(else|elseif|for|(local\s+)?function|if|repeat|until|while)\b((?!end).)*$|\{\s*$|^.*(\s|,|=):?\([^\(]*\)\s*$</string>
|
||||||
|
<key>indentSquareBrackets</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
5
README.md
Normal file
5
README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
[Candran](https://github.com/Reuh/candran) language support for [Sublime Text 3](https://www.sublimetext.com/).
|
||||||
|
|
||||||
|
This is an adaptation of Sublime Text 3's Lua support for Candran. Snippets have been removed.
|
||||||
|
|
||||||
|
Installation: clone this repository as a folder in your Sublime Text 3 package directory (Preferences -> Browse packages).
|
||||||
Loading…
Add table
Add a link
Reference in a new issue