Last active
June 15, 2017 11:27
-
-
Save gingerBill/9d9816b08fc3fd1429c558fdd90e5647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.2 | |
--- | |
# http://www.sublimetext.com/docs/3/syntax.html | |
name: Odin | |
file_extensions: | |
- odin | |
first_line_match: "-[*]-( Mode:)? Odin -[*]-" | |
scope: source.odin | |
variables: | |
identifier: '\b[[:alpha:]_][[:alnum:]_]*\b' | |
type_chars: '[[:alnum:]\s,._^<>\[\]-]' | |
contexts: | |
main: | |
- include: global | |
global: | |
- include: comments | |
- include: functions-and-declarations | |
- include: types | |
- include: keywords | |
# - include: custom_styling | |
- include: strings | |
- include: string-escaped-char | |
custom_styling: | |
- match: \b([A-Z_](?![a-z])[A-Z_0-9]+)\b | |
captures: | |
1: storage.constant.odin | |
- match: \b([A-Z][a-z0-9]+)([_A-Z][a-z0-9]*)*\b | |
scope: storage.type.odin | |
block-comment: | |
- match: /\* | |
scope: punctuation.definition.comment.odin | |
push: | |
- meta_scope: comment.block.odin | |
- match: \*/ | |
scope: punctuation.definition.comment.odin | |
pop: true | |
- include: block-comment | |
comments: | |
- include: block-comment | |
- match: // | |
scope: punctuation.definition.comment.odin | |
push: | |
- meta_scope: comment.line.double-slash.odin | |
- match: \n | |
pop: true | |
keywords: | |
- match: \b(import|import_load|foreign|foreign_library|foreign_system_library)\b | |
scope: keyword.control.odin | |
- match: \b(if|else|when|for|in|defer|match|return|const)\b | |
scope: keyword.control.odin | |
- match: \b(fallthrough|break|continue|case|vector|static|dynamic|atomic)\b | |
scope: keyword.control.odin | |
- match: \b(using)\b | |
scope: keyword.control.odin | |
- match: \b(asm|yield|await|push_allocator|push_context)\b | |
scope: keyword.control.odin | |
- match: \b(push_allocator|push_context)\b | |
scope: keyword.control.odin | |
- match: \b(nil|true|false|iota)\b | |
scope: constant.language.odin | |
- match: '\b(\d(\d|_)*(.\d(\d|_)*)?)((e|E)(\+|-)?\d+)?[ijk]?\b' | |
scope: constant.numeric.odin | |
- match: '\b((0b(0|1|_)+)|(0o(\d|_)+)|(0d(\d|_)+)|(0[xX](\h|_)+))[ijk]?\b' | |
scope: constant.numeric.odin | |
- match: \b(var|let|type|macro|proc|struct|enum|union|raw_union|map|bit_field)\b | |
scope: storage.type.odin | |
- match: \b(cast|transmute|down_cast|union_cast)\b | |
scope: keyword.function.odin | |
- match: '(#\s*{{identifier}})' | |
scope: keyword.tag.odin | |
- match: \b(context)\b | |
scope: keyword.operator.odin | |
functions-and-declarations: | |
- match: '\b(proc)\s+({{identifier}})' | |
captures: | |
1: storage.type.odin | |
2: meta.function.odin entity.name.function.odin | |
- match: \b(size_of|align_of|offset_of|type_of|type_info)\b\s*\( | |
captures: | |
1: keyword.function.odin | |
- match: ({{identifier}})\s*[!]?\s*[\(] | |
captures: | |
1: support.function.odin | |
- match: '\b(type)\s+({{identifier}})' | |
captures: | |
1: storage.type.odin | |
2: meta.type.odin entity.name.type.odin | |
types: | |
- match: '\b(struct|enum|union|raw_union|bit_field)\b(?:(\{)(\}))?' | |
captures: | |
1: storage.type.odin | |
2: meta.block.odin punctuation.definition.block.begin.odin | |
3: meta.block.odin punctuation.definition.block.end.odin | |
- match: (\[)(\d*)(\])(?=[[:alpha:]_]) | |
scope: meta.brackets.odin | |
captures: | |
1: punctuation.definition.brackets.begin.odin | |
2: constant.numeric.odin | |
3: punctuation.definition.brackets.end.odin | |
- include: basic-types | |
basic-types: | |
- match: '\b((i8|i16|i32|i64|i128|int)|(u8|u16|u32|u64|u128|uint)|(f16|f32|f64)|(complex32|complex64|complex128)|(quaternion128|quaternion256)|byte|bool|string|rune|rawptr|any)\b' | |
scope: storage.type.odin | |
strings: | |
- match: '"' | |
scope: punctuation.definition.string.begin.odin | |
push: | |
- meta_scope: string.quoted.double.odin | |
- match: '"' | |
scope: punctuation.definition.string.end.odin | |
pop: true | |
- include: string-escaped-char | |
- match: "`" | |
scope: punctuation.definition.string.begin.odin | |
push: | |
- meta_scope: string.quoted.raw.odin | |
- match: "`" | |
scope: punctuation.definition.string.end.odin | |
pop: true | |
- match: "'" | |
scope: punctuation.definition.string.begin.odin | |
push: | |
- meta_scope: string.quoted.raw.odin | |
- match: "'" | |
scope: punctuation.definition.string.end.odin | |
pop: true | |
- include: string-escaped-char | |
string-escaped-char: | |
- match: '\\(\\|[abfnrutv''"]|x\h{2}|u\h{4}|U\h{8}|[0-7]{3})' | |
scope: constant.character.escape.odin | |
- match: \\. | |
scope: invalid.illegal.unknown-escape.odin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Comments</string> | |
<key>scope</key> | |
<string>source.odin</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> | |
<dict> | |
<key>name</key> | |
<string>TM_COMMENT_DISABLE_INDENT_2</string> | |
<key>value</key> | |
<string>yes</string> | |
</dict> | |
</array> | |
</dict> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment