mirror of https://github.com/hamaluik/mkbook
added haxe and toml syntaxes
parent
75c29cd49d
commit
000b413b43
@ -0,0 +1,405 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: TOML
|
||||
|
||||
file_extensions:
|
||||
- toml
|
||||
- tml
|
||||
- Cargo.lock
|
||||
- Gopkg.lock
|
||||
- Pipfile
|
||||
|
||||
scope: source.toml
|
||||
|
||||
variables:
|
||||
ws: '[ \t]*'
|
||||
wsnl: '([ \t\n])*'
|
||||
|
||||
# Used to detect the possible start of a key.
|
||||
peek_key_start: '(?=[A-Za-z0-9_''"-])'
|
||||
dot_peek_key: '{{ws}}(\.){{ws}}{{peek_key_start}}'
|
||||
|
||||
# integer = [ "-" / "+" ] int
|
||||
# int = DIGIT / digit1-9 1*( DIGIT / "_" DIGIT )
|
||||
integer: '([\+\-]?) (?: [0-9] | [1-9] (?: [0-9] | _ [0-9] )+ )'
|
||||
|
||||
HEXDIG: '[0-9A-Fa-f]'
|
||||
hex_int: '0x{{HEXDIG}}(?:{{HEXDIG}}|_{{HEXDIG}})*'
|
||||
oct_int: '0o[0-7](?:[0-7]|_[0-7])*'
|
||||
bin_int: '0b[0-1](?:[0-1]|_[0-1])*'
|
||||
|
||||
# zero-prefixable-int = DIGIT *( DIGIT / underscore DIGIT )
|
||||
zero_prefixable_int: '[0-9] (?: [0-9] | _ [0-9] )*'
|
||||
# frac = decimal-point zero-prefixable-int
|
||||
frac: '\. {{zero_prefixable_int}}'
|
||||
# exp = "e" float-exp-part
|
||||
# float-exp-part = [ minus / plus ] zero-prefixable-int
|
||||
exp: '[eE] [\+\-]? {{zero_prefixable_int}}'
|
||||
|
||||
# date-time = offset-date-time / local-date-time / local-date / local-time
|
||||
date_time: '{{offset_date_time}} | {{local_date_time}} | {{local_date}} | {{local_time}}'
|
||||
# date-fullyear = 4DIGIT
|
||||
date_fullyear: '[0-9]{4}'
|
||||
# date-month = 2DIGIT ; 01-12
|
||||
date_month: '[0-1][0-9]'
|
||||
# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on month/year
|
||||
date_mday: '[0-3][0-9]'
|
||||
# time-hour = 2DIGIT ; 00-23
|
||||
time_hour: '[0-2][0-9]'
|
||||
# time-minute = 2DIGIT ; 00-59
|
||||
time_minute: '[0-5][0-9]'
|
||||
# time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second rules
|
||||
time_second: '[0-6][0-9]'
|
||||
# time-secfrac = "." 1*DIGIT
|
||||
time_secfrac: '\.[0-9]+'
|
||||
# time-numoffset = ( "+" / "-" ) time-hour ":" time-minute
|
||||
time_numoffset: '[+-] {{time_hour}} : {{time_minute}}'
|
||||
# time-offset = "Z" / time-numoffset
|
||||
time_offset: '(?: [zZ] | {{time_numoffset}} )'
|
||||
# partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
|
||||
partial_time: '{{time_hour}} : {{time_minute}} : {{time_second}} (?: {{time_secfrac}} )?'
|
||||
# full-date = date-fullyear "-" date-month "-" date-mday
|
||||
full_date: '{{date_fullyear}} - {{date_month}} - {{date_mday}}'
|
||||
# full-time = partial-time time-offset
|
||||
full_time: '{{partial_time}} {{time_offset}}'
|
||||
# offset-date-time = full-date T|%20 full-time
|
||||
offset_date_time: '{{full_date}} [tT ] {{full_time}}'
|
||||
# local-date-time = full-date T|%20 partial-time
|
||||
local_date_time: '{{full_date}} [tT ] {{partial_time}}'
|
||||
# local-date = full-date
|
||||
local_date: '{{full_date}}'
|
||||
# local-time = partial-time
|
||||
local_time: '{{partial_time}}'
|
||||
|
||||
contexts:
|
||||
main:
|
||||
- match: '^{{ws}}'
|
||||
# Ignore leading whitespace for all expressions.
|
||||
- include: comments
|
||||
- include: tables
|
||||
- include: keyval
|
||||
- include: illegal
|
||||
|
||||
illegal:
|
||||
- match: (.*)
|
||||
# Invalid things -> everything unmatched
|
||||
captures:
|
||||
1: invalid.illegal.toml
|
||||
|
||||
comments:
|
||||
- match: '{{ws}}((#).*)'
|
||||
captures:
|
||||
1: comment.line.number-sign.toml
|
||||
2: punctuation.definition.comment.toml
|
||||
|
||||
data-types:
|
||||
- include: inline-table
|
||||
- include: array
|
||||
- include: string
|
||||
- include: date-time
|
||||
- include: float
|
||||
- include: integer
|
||||
- include: boolean
|
||||
- match: '{{ws}}$'
|
||||
# Don't show an incomplete line as invalid to avoid frequent red
|
||||
# highlighting while typing.
|
||||
pop: true
|
||||
- match: '\w+|.'
|
||||
scope: invalid.illegal.value.toml
|
||||
pop: true
|
||||
|
||||
boolean:
|
||||
- match: (true|false)
|
||||
captures:
|
||||
1: constant.language.toml
|
||||
pop: true
|
||||
|
||||
integer:
|
||||
- match: |-
|
||||
(?x)
|
||||
(?<!\w)
|
||||
{{hex_int}}
|
||||
|{{oct_int}}
|
||||
|{{bin_int}}
|
||||
|{{integer}}
|
||||
(?!\w)
|
||||
captures:
|
||||
0: constant.numeric.integer.toml
|
||||
1: keyword.operator.arithmetic.toml
|
||||
pop: true
|
||||
|
||||
float:
|
||||
# float = float-int-part ( exp / frac [ exp ] )
|
||||
# float =/ special-float
|
||||
# special-float = [ minus / plus ] ( inf / nan )
|
||||
# float-int-part = dec-int
|
||||
- match: |-
|
||||
(?x)
|
||||
(?<!\w)
|
||||
{{integer}}
|
||||
(?: {{frac}} | (?: {{frac}} {{exp}} ) | {{exp}} )
|
||||
(?!\w)
|
||||
captures:
|
||||
0: constant.numeric.float.toml
|
||||
1: keyword.operator.arithmetic.toml
|
||||
pop: true
|
||||
- match: '(?<!\w)([+-])?(inf|nan)(?!\w)'
|
||||
captures:
|
||||
0: constant.numeric.float.toml
|
||||
1: keyword.operator.arithmetic.toml
|
||||
pop: true
|
||||
|
||||
date-time:
|
||||
- match: '(?x) {{date_time}}'
|
||||
scope: constant.other.datetime.toml
|
||||
pop: true
|
||||
|
||||
string:
|
||||
- match: "'''"
|
||||
# multi-line literal string (no escape sequences)
|
||||
scope: punctuation.definition.string.begin.toml
|
||||
set:
|
||||
- meta_scope: string.quoted.triple.literal.block.toml
|
||||
- match: "'''"
|
||||
scope: punctuation.definition.string.end.toml
|
||||
pop: true
|
||||
- match: '"""'
|
||||
# multi-line basic string
|
||||
scope: punctuation.definition.string.begin.toml
|
||||
set:
|
||||
- meta_scope: string.quoted.triple.basic.block.toml
|
||||
- match: '"""'
|
||||
scope: punctuation.definition.string.end.toml
|
||||
pop: true
|
||||
- include: string-escape
|
||||
- include: basic-string
|
||||
- include: literal-string
|
||||
|
||||
basic-string:
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.begin.toml
|
||||
set:
|
||||
- meta_scope: string.quoted.double.basic.toml
|
||||
- include: string-escape
|
||||
- match: '"'
|
||||
scope: punctuation.definition.string.end.toml
|
||||
pop: true
|
||||
- match: '\n'
|
||||
scope: invalid.illegal.string.non-terminated.toml
|
||||
pop: true
|
||||
|
||||
string-escape:
|
||||
- match: '\\(?:[btnfr"\\]|u\h{4}|U\h{8})'
|
||||
scope: constant.character.escape.toml
|
||||
- match: '\\.'
|
||||
scope: invalid.illegal.string.escape.toml
|
||||
|
||||
literal-string:
|
||||
- match: '('')[^'']*('')'
|
||||
# There is ambiguity in what is allowed in a literal string.
|
||||
# See: https://github.com/toml-lang/toml/issues/473
|
||||
scope: string.quoted.single.literal.toml
|
||||
captures:
|
||||
1: punctuation.definition.string.begin.toml
|
||||
2: punctuation.definition.string.end.toml
|
||||
pop: true
|
||||
|
||||
array:
|
||||
- match: '\['
|
||||
scope: punctuation.definition.array.begin.toml
|
||||
set: [maybe-empty-array, maybe-array-comments]
|
||||
|
||||
maybe-empty-array:
|
||||
- match: ']'
|
||||
scope: punctuation.definition.array.end.toml
|
||||
pop: true
|
||||
- match: ''
|
||||
set: [array-sep, data-types]
|
||||
|
||||
array-sep:
|
||||
- match: '{{wsnl}}'
|
||||
- include: comments
|
||||
- match: ']'
|
||||
scope: punctuation.definition.array.end.toml
|
||||
pop: true
|
||||
- match: ','
|
||||
scope: punctuation.separator.array.toml
|
||||
set:
|
||||
- match: '{{wsnl}}'
|
||||
- include: comments
|
||||
- match: ']'
|
||||
scope: punctuation.definition.array.end.toml
|
||||
pop: true
|
||||
- match: '(?=[^\n])'
|
||||
set: [array-sep, data-types]
|
||||
- match: '\w+|.'
|
||||
scope: invalid.illegal.array.toml
|
||||
|
||||
maybe-array-comments:
|
||||
- match: '{{wsnl}}'
|
||||
- include: comments
|
||||
- match: '(?=[^\n])'
|
||||
pop: true
|
||||
|
||||
inline-table:
|
||||
- match: '\{'
|
||||
scope: punctuation.definition.inline-table.begin.toml
|
||||
set:
|
||||
- match: '{{ws}}'
|
||||
- match: '\}'
|
||||
# Empty table.
|
||||
scope: punctuation.definition.inline-table.end.toml
|
||||
pop: true
|
||||
- match: ''
|
||||
set: [inline-keyval-sep, key]
|
||||
|
||||
inline-keyval-sep:
|
||||
- match: '{{ws}}(=){{ws}}'
|
||||
captures:
|
||||
1: punctuation.definition.key-value.toml
|
||||
set: [inline-table-keyvals, data-types]
|
||||
- match: '(?=\w+|.)'
|
||||
scope: invalid.illegal.inline-sep.toml
|
||||
pop: true
|
||||
|
||||
inline-table-keyvals:
|
||||
- match: '{{ws}}'
|
||||
- match: '\}'
|
||||
scope: punctuation.definition.inline-table.end.toml
|
||||
pop: true
|
||||
- match: ','
|
||||
scope: punctuation.separator.inline-table.toml
|
||||
set:
|
||||
- match: '{{ws}}'
|
||||
- match: ''
|
||||
set: [inline-keyval-sep, key]
|
||||
- match: '(?=\w+|.)'
|
||||
scope: invalid.illegal.inline-key.toml
|
||||
pop: true
|
||||
|
||||
keyval:
|
||||
- match: '{{peek_key_start}}'
|
||||
push: [keyval-sep, key]
|
||||
|
||||
keyval-sep:
|
||||
- match: '{{ws}}(=){{ws}}'
|
||||
captures:
|
||||
# This could arguably be keyword.operator.assignment.toml, but since
|
||||
# Monokai uses the same color for non-C sources with entity.name.tag,
|
||||
# it doesn't have the appropriate visual distinction.
|
||||
1: punctuation.definition.key-value.toml
|
||||
set: [maybe-comment-eol, data-types]
|
||||
- match: '{{ws}}$'
|
||||
# Don't show an incomplete line as invalid to avoid flickering.
|
||||
pop: true
|
||||
- match: '.+$'
|
||||
scope: invalid.illegal.keyval.toml
|
||||
pop: true
|
||||
|
||||
key:
|
||||
- meta_scope: meta.tag.key.toml
|
||||
- match: '{{peek_key_start}}'
|
||||
push: [maybe-dot-key, key-simple]
|
||||
- match: '(?={{ws}}=)'
|
||||
pop: true
|
||||
- match: '{{ws}}$'
|
||||
# Early exit to avoid errors while typing.
|
||||
pop: true
|
||||
- match: '.'
|
||||
scope: invalid.illegal.key.toml
|
||||
pop: true
|
||||
|
||||
key-simple:
|
||||
- match: '[A-Za-z0-9_-]+'
|
||||
scope: entity.name.tag.toml
|
||||
pop: true
|
||||
- include: key-quoted
|
||||
- match: '\S+'
|
||||
scope: invalid.illegal.key.toml
|
||||
pop: true
|
||||
|
||||
key-quoted:
|
||||
- include: basic-string
|
||||
- include: literal-string
|
||||
|
||||
maybe-dot-key:
|
||||
- match: '{{dot_peek_key}}'
|
||||
captures:
|
||||
1: punctuation.separator.key.toml
|
||||
push: key-simple
|
||||
- match: '(?={{ws}}(?:=|$))'
|
||||
pop: true
|
||||
- match: '.'
|
||||
scope: invalid.illegal.key.toml
|
||||
pop: true
|
||||
|
||||
maybe-comment-eol:
|
||||
- include: comments
|
||||
- match: '$'
|
||||
pop: true
|
||||
- match: '.+'
|
||||
# This also highlights trailing whitespece. Although that is valid
|
||||
# TOML, it doesn't seem bad to me. If that's annoying, change this
|
||||
# to '[^ \n]+'.
|
||||
scope: invalid.illegal.trailing.toml
|
||||
pop: true
|
||||
|
||||
tables:
|
||||
- match: '\[?\[{{ws}}\]\]?'
|
||||
scope: invalid.illegal.table.toml
|
||||
|
||||
- match: '(\[\[){{ws}}'
|
||||
# Array table. Same as std-table with double-brackets.
|
||||
captures:
|
||||
1: punctuation.definition.table.array.begin.toml
|
||||
push: [maybe-comment-eol, table-array-name]
|
||||
|
||||
- match: '(\[){{ws}}'
|
||||
# std-table = ws "[" ws key (ws "." ws key)* ws "]" ws comment?
|
||||
captures:
|
||||
1: punctuation.definition.table.begin.toml
|
||||
push: [maybe-comment-eol, table-name]
|
||||
|
||||
table-name:
|
||||
- meta_content_scope: meta.tag.table.toml
|
||||
- match: '{{ws}}(\])'
|
||||
captures:
|
||||
1: punctuation.definition.table.end.toml
|
||||
pop: true
|
||||
- include: table-name-inc
|
||||
|
||||
table-array-name:
|
||||
- meta_content_scope: meta.tag.table.array.toml
|
||||
- match: '{{ws}}(\]\])'
|
||||
captures:
|
||||
1: punctuation.definition.table.array.end.toml
|
||||
pop: true
|
||||
- include: table-name-inc
|
||||
|
||||
table-name-inc:
|
||||
- match: '{{peek_key_start}}'
|
||||
push: [maybe-dot-table-name, table-name-simple]
|
||||
- match: '[^\]]+\]?'
|
||||
scope: invalid.illegal.table.toml
|
||||
pop: true
|
||||
|
||||
table-name-simple:
|
||||
- match: '[A-Za-z0-9_-]+'
|
||||
scope: entity.name.table.toml
|
||||
pop: true
|
||||
- include: key-quoted
|
||||
- match: '.'
|
||||
scope: invalid.illegal.table.toml
|
||||
pop: true
|
||||
|
||||
maybe-dot-table-name:
|
||||
- match: '{{dot_peek_key}}'
|
||||
captures:
|
||||
1: punctuation.separator.table.toml
|
||||
push: table-name-simple
|
||||
- match: '(?={{ws}}(?:\]|$))'
|
||||
pop: true
|
||||
- match: '.'
|
||||
scope: invalid.illegal.table.toml
|
||||
pop: true
|
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
REPO_DIR="$ASSET_DIR/.."
|
||||
|
||||
# Ensure submodules are initialized.
|
||||
function update_submodules() {
|
||||
local submodule
|
||||
local submodule_prompt=unspecified
|
||||
local submodule_path
|
||||
|
||||
{
|
||||
while { read -r submodule && read -r submodule_path; } <&3; do
|
||||
if ! [[ -d "${REPO_DIR}/.git/modules/${submodule}" ]] && [[ -d "${REPO_DIR}/${submodule_path}" ]]; then
|
||||
if [[ "$submodule_prompt" = "unspecified" ]]; then
|
||||
echo "One or more submodules were found to be uninitialized."
|
||||
printf "Initialize and update them? [Y/n] "
|
||||
read -r submodule_prompt
|
||||
fi
|
||||
|
||||
case "$submodule_prompt" in
|
||||
y|yes|'') {
|
||||
git -C "$REPO_DIR" submodule update --init "$submodule_path"
|
||||
};;
|
||||
n|no) {
|
||||
return
|
||||
};;
|
||||
*) {
|
||||
echo "Unknown answer. Not updating submodules."
|
||||
};;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
} 3< <(git config --file "${REPO_DIR}/.gitmodules" --null --get-regexp path | xargs -0 printf "%s\n" | sed 's/^submodule.//;s/.path$//')
|
||||
}
|
||||
|
||||
if [ -t 0 ]; then
|
||||
update_submodules
|
||||
fi
|
||||
|
||||
# Always remove the local cache to avoid any confusion
|
||||
bat cache --clear
|
||||
|
||||
# TODO: Remove this (and the reverse part below) when
|
||||
# https://github.com/trishume/syntect/issues/222 has been fixed
|
||||
JAVADOC_FILE="${ASSET_DIR}/syntaxes/Packages/Java/JavaDoc.sublime-syntax"
|
||||
JAVADOC_PATCH="${ASSET_DIR}/JavaDoc.sublime-syntax.patch"
|
||||
patch "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
||||
|
||||
bat cache --build --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
||||
|
||||
patch -R "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
@ -0,0 +1,633 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Haxe
|
||||
file_extensions:
|
||||
- hx
|
||||
- hxsl
|
||||
- hscript
|
||||
scope: source.haxe.2
|
||||
contexts:
|
||||
main:
|
||||
- include: all
|
||||
all:
|
||||
- include: package
|
||||
- include: import
|
||||
- include: import-using
|
||||
- include: type-abstract
|
||||
- include: type-class
|
||||
- include: type-enum
|
||||
- include: type-interface
|
||||
- include: type-typedef
|
||||
- include: meta-static
|
||||
- include: method
|
||||
- include: variable
|
||||
- include: block
|
||||
- include: block-contents
|
||||
arrays:
|
||||
- match: '(\[)'
|
||||
captures:
|
||||
1: punctuation.definition.array.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.array.haxe.2
|
||||
- match: '(\])'
|
||||
captures:
|
||||
1: punctuation.definition.array.end.haxe.2
|
||||
pop: true
|
||||
- include: block
|
||||
- include: block-contents
|
||||
block:
|
||||
- match: '(\{)'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
push:
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: punctuation.definition.block.end.haxe.2
|
||||
pop: true
|
||||
- include: block
|
||||
- include: block-contents
|
||||
block-contents:
|
||||
- include: regex
|
||||
- include: arrays
|
||||
- include: parameters
|
||||
- include: constants
|
||||
- include: comments
|
||||
- include: strings
|
||||
- include: macro
|
||||
- include: modifiers
|
||||
- include: keywords
|
||||
- include: keywords-magic
|
||||
- include: keywords-reification
|
||||
- include: conditional-compilation
|
||||
- include: operator-assignment
|
||||
- include: operators
|
||||
- include: punctuation-separator
|
||||
- include: punctuation-terminator
|
||||
- include: punctuation-brackets
|
||||
- include: support-class-name
|
||||
comments:
|
||||
- match: (/\*)
|
||||
captures:
|
||||
1: punctuation.definition.comment.haxe.2
|
||||
push:
|
||||
- meta_scope: comment.block.haxe.2
|
||||
- match: (\*/)
|
||||
captures:
|
||||
1: punctuation.definition.comment.haxe.2
|
||||
pop: true
|
||||
- match: (//).*$\n?
|
||||
scope: comment.line.double-slash.haxe.2
|
||||
captures:
|
||||
1: punctuation.definition.comment.haxe.2
|
||||
conditional-compilation:
|
||||
- match: (#(end|else))
|
||||
scope: keyword.control.directive.conditional.haxe.2
|
||||
- match: '((#(if|elseif))\s+([a-zA-Z0-9_]*)\s)'
|
||||
captures:
|
||||
0: meta.control.directive.conditional.haxe.2
|
||||
2: keyword.control.directive.conditional.haxe.2
|
||||
- match: ((#(if|elseif))\s*?\()
|
||||
captures:
|
||||
0: meta.control.directive.conditional.haxe.2
|
||||
2: keyword.control.directive.conditional.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.control.directive.conditional.haxe.2
|
||||
- match: (\))
|
||||
pop: true
|
||||
- match: '(#([a-zA-Z0-9_]*))\s'
|
||||
scope: meta.control.directive.conditional.haxe.2
|
||||
constants:
|
||||
- match: \b(true|false|null)\b
|
||||
scope: constant.language.haxe.2
|
||||
- match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b'
|
||||
scope: constant.numeric.haxe.2
|
||||
entity-name-class:
|
||||
- match: '\b([_A-Za-z]\w*)\b'
|
||||
scope: entity.name.type.class.haxe.2
|
||||
entity-name-function:
|
||||
- match: '([_A-Za-z]\w*)\b(?=\s*[\(])'
|
||||
scope: entity.name.function.haxe.2
|
||||
import:
|
||||
- match: \b(import)\b
|
||||
captures:
|
||||
1: storage.type.import.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.import.haxe.2
|
||||
- match: (;)
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- match: '((\b[a-z]\w*\.)*)((\b[A-Z]\w*\.?|\*)+)(\b[_a-z]\w*|\*)?'
|
||||
captures:
|
||||
1: support.package.haxe.2
|
||||
3: support.class.haxe.2
|
||||
import-using:
|
||||
- match: \b(using)\b
|
||||
captures:
|
||||
1: storage.type.using.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.using.haxe.2
|
||||
- match: (;)
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- match: '(([a-z]\w*\.)*)(([A-Z]\w*\.?)+)'
|
||||
captures:
|
||||
1: support.package.haxe.2
|
||||
3: support.class.haxe.2
|
||||
keywords:
|
||||
- match: \b(try|catch|throw)\b
|
||||
scope: keyword.control.catch-exception.haxe.2
|
||||
- match: \b(if|return|while|for|return|break|case|default|continue|do|while|for|switch|if|else)\b
|
||||
scope: keyword.control.haxe.flow-control.2
|
||||
- match: (\.\.\.)
|
||||
scope: keyword.control.directive.haxe.2
|
||||
- match: \b(cast|untyped)\b
|
||||
scope: keyword.other.untyped.haxe.2
|
||||
- match: \btrace\b
|
||||
scope: keyword.other.trace.haxe.2
|
||||
- match: \b(this|super)\b
|
||||
scope: variable.language.haxe.2
|
||||
- match: \bnew\b
|
||||
scope: keyword.control.new.haxe.2
|
||||
- match: \bvar\b
|
||||
scope: storage.type.variable.haxe.2
|
||||
- match: \bfunction\b
|
||||
scope: storage.type.function.haxe.2
|
||||
- match: \b(abstract|class|enum|interface|typedef)\b
|
||||
scope: storage.type.class.haxe.2
|
||||
keywords-abstract:
|
||||
- match: \b(from|to)\b
|
||||
scope: keyword.other.haxe.2
|
||||
keywords-accessor:
|
||||
- match: \b(default|get|set|dynamic|never|null)\b
|
||||
scope: keyword.other.haxe.2
|
||||
keywords-magic:
|
||||
- match: \b__\w*__\b
|
||||
scope: support.function.magic.haxe.2
|
||||
- match: \bprototype\b
|
||||
scope: support.variable.magic.haxe.2
|
||||
keywords-reification:
|
||||
- match: '(\$)([iea])\('
|
||||
captures:
|
||||
1: punctuation.definition.variable.haxe.2
|
||||
2: support.reification.haxe.2
|
||||
- match: '((\$)([a-zA-Z.]*))'
|
||||
captures:
|
||||
2: punctuation.definition.variable.haxe.2
|
||||
3: support.reification.haxe.2
|
||||
macro:
|
||||
- match: ((@:)(require|final|hack|native|coreApi|fakeEnum|macro|build|keep|keepSub|overload|extern|optional|feature|noCompletion|noUsing|allow|access|generic|publicFields|expose|defineFeature|runtime|initPackage|bind|bitmap|file|font|sound|ns|protected|getter|setter|meta|debug|noDebug|headerCode|headerClassCode|cppFileCode|functionCode|functionTailCode|buildXml|cppNamespaceCode|headerNamespaceCode|noStack|depend|include|internal|volatile|transient|functionBody|classContents|remove)\b)
|
||||
captures:
|
||||
2: punctuation.definition.variable.haxe.2
|
||||
3: storage.modifier.macro.haxe.2
|
||||
- match: "((@:?)([a-zA-Z_]*))"
|
||||
captures:
|
||||
2: punctuation.definition.variable.haxe.2
|
||||
3: support.macro.haxe.2
|
||||
meta-static:
|
||||
- match: (static)
|
||||
captures:
|
||||
1: storage.modifier.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.static.haxe.2
|
||||
- match: '(?<=[\};])'
|
||||
pop: true
|
||||
- include: modifiers
|
||||
- include: method
|
||||
- include: variable
|
||||
- include: punctuation-terminator
|
||||
method:
|
||||
- match: (?=function)
|
||||
push:
|
||||
- meta_scope: meta.method.haxe.2
|
||||
- match: '(?<=[\};])'
|
||||
pop: true
|
||||
- include: method-name
|
||||
- include: method-name-post
|
||||
- include: method-block
|
||||
method-block:
|
||||
- match: '(?<=\{)'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.method.block.haxe.2
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: punctuation.definition.block.end.haxe.2
|
||||
pop: true
|
||||
- include: block
|
||||
- include: block-contents
|
||||
method-name:
|
||||
- match: \b(function)\b
|
||||
captures:
|
||||
1: storage.type.function.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.method.name.haxe.2
|
||||
- match: '([_A-Za-z]\w*)'
|
||||
captures:
|
||||
1: entity.name.function.haxe.2
|
||||
pop: true
|
||||
method-name-post:
|
||||
- match: (?<=\w)
|
||||
push:
|
||||
- match: '(\{)|(;)'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
2: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- include: block
|
||||
- include: block-contents
|
||||
modifiers:
|
||||
- match: \b(public|private|static|dynamic|inline|macro|extern|override)\b
|
||||
scope: storage.modifier.haxe.2
|
||||
modifiers-inheritance:
|
||||
- match: \b(implements|extends)\b
|
||||
scope: storage.modifier.haxe.2
|
||||
operator-assignment:
|
||||
- match: (=)
|
||||
scope: keyword.operator.assignment.haxe.2
|
||||
operator-optional:
|
||||
- match: (\?)(?!\s)
|
||||
scope: punctuation.definition.variable.haxe.2
|
||||
operators:
|
||||
- match: (!|&&|\|\|)
|
||||
scope: keyword.operator.logical.haxe.2
|
||||
- match: (~|&|\||\^|<<|>>|>>>)
|
||||
scope: keyword.operator.bitwise.haxe.2
|
||||
- match: (==|!=|<=|>=|<>|<|>)
|
||||
scope: keyword.operator.comparison.haxe.2
|
||||
- match: (\-\-|\+\+)
|
||||
scope: keyword.operator.increment-decrement.haxe.2
|
||||
- match: (\-|\+|\*|\/|%)
|
||||
scope: keyword.operator.arithmetic.haxe.2
|
||||
package:
|
||||
- match: '\b(package)(\s+([\w.*]*))?\s*(;)'
|
||||
scope: meta.package.haxe.2
|
||||
captures:
|
||||
1: storage.type.package.haxe.2
|
||||
2: support.package.haxe.2
|
||||
4: punctuation.terminator.haxe.2
|
||||
parameters:
|
||||
- match: (\()
|
||||
captures:
|
||||
1: punctuation.definition.parameters.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.parameters.haxe.2
|
||||
- match: (\))
|
||||
captures:
|
||||
1: punctuation.definition.parameters.end.haxe.2
|
||||
pop: true
|
||||
- include: operator-optional
|
||||
- include: block
|
||||
- include: block-contents
|
||||
punctuation-brackets:
|
||||
- match: '([\(\<\)\>])'
|
||||
scope: punctuation.definition.other.haxe.2
|
||||
punctuation-separator:
|
||||
- match: "([,:.?])"
|
||||
scope: punctuation.separator.haxe.2
|
||||
punctuation-terminator:
|
||||
- match: ;
|
||||
scope: punctuation.terminator.haxe.2
|
||||
regex:
|
||||
- match: ~/
|
||||
captures:
|
||||
1: string.regexp.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: string.regexp.haxe.2
|
||||
- match: '(/[gimsu]*)|(\n$)'
|
||||
captures:
|
||||
1: string.regexp.end.haxe.2
|
||||
2: invalid.illegal.haxe.2
|
||||
pop: true
|
||||
- match: \\.
|
||||
scope: constant.character.escape.haxe.2
|
||||
strings:
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: string.quoted.double.haxe.2
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.end.haxe.2
|
||||
pop: true
|
||||
- match: \\.
|
||||
scope: constant.character.escape.haxe.2
|
||||
- match: "'"
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: string.quoted.single.haxe.2
|
||||
- match: "'"
|
||||
captures:
|
||||
0: punctuation.definition.string.end.haxe.2
|
||||
pop: true
|
||||
- match: \\.
|
||||
scope: constant.character.escape.haxe.2
|
||||
- match: \$\$
|
||||
scope: constant.character.escape.haxe.2
|
||||
- match: '(\$)(\{)([^}]*)(\})'
|
||||
comment: 'String interpolation : "${test.ole}"'
|
||||
captures:
|
||||
1: variable.other.haxe.2
|
||||
2: variable.other.haxe.2
|
||||
3: variable.other.haxe.2
|
||||
4: variable.other.haxe.2
|
||||
- match: '(\$)([\w]*)'
|
||||
comment: 'String interpolation : "$test"'
|
||||
captures:
|
||||
1: variable.other.haxe.2
|
||||
2: variable.other.haxe.2
|
||||
support-class-name:
|
||||
- match: '\b(([a-z][a-zA-Z0-9]*\.)*)(([A-Z]\w*\.?)+)\b'
|
||||
captures:
|
||||
1: support.package.haxe.2
|
||||
3: support.class.haxe.2
|
||||
type-abstract:
|
||||
- match: (?=abstract)
|
||||
push:
|
||||
- meta_scope: meta.type.abstract.haxe.2
|
||||
- match: '(?<=\})|(;)'
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- include: type-abstract-name
|
||||
- include: type-abstract-name-post
|
||||
- include: type-abstract-block
|
||||
type-abstract-block:
|
||||
- match: '(?<=\{)'
|
||||
push:
|
||||
- meta_scope: meta.type.block.haxe.2
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: punctuation.definition.block.end.haxe.2
|
||||
pop: true
|
||||
- include: meta-static
|
||||
- include: method
|
||||
- include: modifiers
|
||||
- include: variable
|
||||
- include: block
|
||||
- include: block-contents
|
||||
type-abstract-name:
|
||||
- match: \b(abstract)\b
|
||||
captures:
|
||||
1: storage.type.class.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.type.name.haxe.2
|
||||
- match: '([_A-Za-z]\w*)'
|
||||
captures:
|
||||
1: entity.name.type.class.haxe.2
|
||||
pop: true
|
||||
type-abstract-name-post:
|
||||
- match: (?<=\w)
|
||||
push:
|
||||
- match: '([\{;])'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
pop: true
|
||||
- include: parameters
|
||||
- include: keywords-abstract
|
||||
- include: punctuation-brackets
|
||||
- include: punctuation-separator
|
||||
- include: support-class-name
|
||||
type-class:
|
||||
- match: (?=class)
|
||||
push:
|
||||
- meta_scope: meta.type.class.haxe.2
|
||||
- match: '(?<=\})|(;)'
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- include: type-class-name
|
||||
- include: type-class-name-post
|
||||
- include: type-class-block
|
||||
type-class-block:
|
||||
- match: '(?<=\{)'
|
||||
push:
|
||||
- meta_scope: meta.type.block.haxe.2
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: punctuation.definition.block.end.haxe.2
|
||||
pop: true
|
||||
- include: meta-static
|
||||
- include: method
|
||||
- include: modifiers
|
||||
- include: variable
|
||||
- include: block
|
||||
- include: block-contents
|
||||
type-class-name:
|
||||
- match: \b(class)\b
|
||||
captures:
|
||||
1: storage.type.class.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.type.name.haxe.2
|
||||
- match: '([_A-Za-z]\w*)'
|
||||
captures:
|
||||
1: entity.name.type.class.haxe.2
|
||||
pop: true
|
||||
type-class-name-post:
|
||||
- match: (?<=\w)
|
||||
push:
|
||||
- match: '([\{;])'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
pop: true
|
||||
- include: type-parameters
|
||||
- include: modifiers-inheritance
|
||||
- include: punctuation-brackets
|
||||
- include: punctuation-separator
|
||||
- include: support-class-name
|
||||
type-enum:
|
||||
- match: (?=enum)
|
||||
push:
|
||||
- meta_scope: meta.type.enum.haxe.2
|
||||
- match: '(?<=\})|(;)'
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- include: type-enum-name
|
||||
- include: type-enum-name-post
|
||||
- include: type-enum-block
|
||||
type-enum-block:
|
||||
- match: '(?<=\{)'
|
||||
push:
|
||||
- meta_scope: meta.type.block.haxe.2
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: punctuation.definition.block.end.haxe.2
|
||||
pop: true
|
||||
- include: type-parameters
|
||||
- include: block
|
||||
- include: block-contents
|
||||
type-enum-name:
|
||||
- match: \b(enum)\b
|
||||
captures:
|
||||
1: storage.type.class.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.type.name.haxe.2
|
||||
- match: '([_A-Za-z]\w*)'
|
||||
captures:
|
||||
1: entity.name.type.class.haxe.2
|
||||
pop: true
|
||||
type-enum-name-post:
|
||||
- match: (?<=\w)
|
||||
push:
|
||||
- match: '([\{;])'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
pop: true
|
||||
- include: type-parameters
|
||||
- include: punctuation-brackets
|
||||
- include: punctuation-separator
|
||||
- include: support-class-name
|
||||
type-interface:
|
||||
- match: (?=interface)
|
||||
push:
|
||||
- meta_scope: meta.type.interface.haxe.2
|
||||
- match: '(?<=\})|(;)'
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- include: type-interface-name
|
||||
- include: type-interface-name-post
|
||||
- include: type-interface-block
|
||||
type-interface-block:
|
||||
- match: '(?<=\{)'
|
||||
push:
|
||||
- meta_scope: meta.type.block.haxe.2
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: punctuation.definition.block.end.haxe.2
|
||||
pop: true
|
||||
- include: method
|
||||
- include: variable
|
||||
- include: block
|
||||
- include: block-contents
|
||||
type-interface-name:
|
||||
- match: \b(interface)\b
|
||||
captures:
|
||||
1: storage.type.class.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.type.name.haxe.2
|
||||
- match: '([_A-Za-z]\w*)'
|
||||
captures:
|
||||
1: entity.name.type.class.haxe.2
|
||||
pop: true
|
||||
type-interface-name-post:
|
||||
- match: (?<=\w)
|
||||
push:
|
||||
- match: '([\{;])'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
pop: true
|
||||
- include: modifiers-inheritance
|
||||
- include: punctuation-brackets
|
||||
- include: punctuation-separator
|
||||
- include: support-class-name
|
||||
type-parameters:
|
||||
- match: (\<)
|
||||
captures:
|
||||
1: punctuation.definition.parameters.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.type.parameters.haxe.2
|
||||
- match: (\>)
|
||||
captures:
|
||||
1: punctuation.definition.parameters.end.haxe.2
|
||||
pop: true
|
||||
- include: block
|
||||
- include: block-contents
|
||||
type-typedef:
|
||||
- match: (?=typedef)
|
||||
push:
|
||||
- meta_scope: meta.type.typedef.haxe.2
|
||||
- match: '(?<=\})|(;)'
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- include: type-typedef-name
|
||||
- include: type-typedef-name-post
|
||||
- include: type-typedef-block
|
||||
type-typedef-block:
|
||||
- match: '(?<=\{)'
|
||||
push:
|
||||
- meta_scope: meta.type.block.haxe.2
|
||||
- match: '(\})'
|
||||
captures:
|
||||
1: punctuation.definition.block.end.haxe.2
|
||||
pop: true
|
||||
- include: block
|
||||
- include: block-contents
|
||||
type-typedef-name:
|
||||
- match: \b(typedef)\b
|
||||
captures:
|
||||
1: storage.type.class.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.type.name.haxe.2
|
||||
- match: '([_A-Za-z]\w*)'
|
||||
captures:
|
||||
1: entity.name.type.class.haxe.2
|
||||
pop: true
|
||||
type-typedef-name-post:
|
||||
- match: (?<=\w)
|
||||
push:
|
||||
- match: '(\{)|(?=;)'
|
||||
captures:
|
||||
1: punctuation.definition.block.begin.haxe.2
|
||||
pop: true
|
||||
- include: punctuation-brackets
|
||||
- include: punctuation-separator
|
||||
- include: operator-assignment
|
||||
- include: support-class-name
|
||||
variable:
|
||||
- match: (?=var)
|
||||
push:
|
||||
- meta_scope: meta.variable.haxe.2
|
||||
- match: (;)
|
||||
captures:
|
||||
1: punctuation.terminator.haxe.2
|
||||
pop: true
|
||||
- include: variable-name
|
||||
- include: variable-assign
|
||||
- include: variable-name-post
|
||||
variable-accessors:
|
||||
- match: (\()
|
||||
captures:
|
||||
1: punctuation.definition.parameters.begin.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.parameters.haxe.2
|
||||
- match: (\))
|
||||
captures:
|
||||
1: punctuation.definition.parameters.end.haxe.2
|
||||
pop: true
|
||||
- include: operator-optional
|
||||
- include: keywords-accessor
|
||||
- include: punctuation-separator
|
||||
variable-assign:
|
||||
- match: (=)
|
||||
captures:
|
||||
1: keyword.operator.assignment.haxe.2
|
||||
push:
|
||||
- match: (?=;)
|
||||
pop: true
|
||||
- include: block
|
||||
- include: block-contents
|
||||
variable-name:
|
||||
- match: \b(var)\b
|
||||
captures:
|
||||
1: storage.type.variable.haxe.2
|
||||
push:
|
||||
- meta_scope: meta.variable.name.haxe.2
|
||||
- match: '([_a-zA-Z]\w*)'
|
||||
captures:
|
||||
1: entity.name.variable.haxe.2
|
||||
pop: true
|
||||
variable-name-post:
|
||||
- match: (?<=\w)
|
||||
push:
|
||||
- match: (?=;)|(?==)
|
||||
pop: true
|
||||
- include: variable-accessors
|
||||
- include: block-contents
|
@ -0,0 +1,31 @@
|
||||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/3/syntax.html
|
||||
name: Hxml
|
||||
file_extensions:
|
||||
- hxml
|
||||
scope: source.hxml
|
||||
contexts:
|
||||
main:
|
||||
- match: (#).*$\n?
|
||||
scope: comment.line.number-sign.hxml
|
||||
captures:
|
||||
1: punctuation.definition.comment.hxml
|
||||
- match: (?<!\w)(--macro)\b
|
||||
captures:
|
||||
1: keyword.other.hxml
|
||||
push:
|
||||
- match: \n
|
||||
pop: true
|
||||
- include: scope:source.hx
|
||||
- match: '(?<!\w)(-m|-main|--main)\b\s*\b(?:(([a-z][a-zA-Z0-9]*\.)*)(_*[A-Z]\w*))?\b'
|
||||
captures:
|
||||
1: keyword.other.hxml
|
||||
2: support.package.hx
|
||||
4: entity.name.type.hx
|
||||
- match: (?<!\w)(-cppia|-cpp?|-js|-as3|-swf-(header|version|lib(-extern)?)|-swf9?|-neko|-python|-php|-cs|-java-lib|-java|-xml|-lua|-hl|-x|-lib|-D|-resource|-exclude|-version|-v|-debug|-prompt|-cmd|-dce\s+(std|full|no)?|--flash-strict|--no-traces|--flash-use-stage|--neko-source|--gen-hx-classes|-net-lib|-net-std|-c-arg|--each|--next|--display|--no-output|--times|--no-inline|--no-opt|--php-front|--php-lib|--php-prefix|--remap|--help-defines|--help-metas|-help|--help|-java|-cs|--js-modern|--interp|--eval|--dce|--wait|--connect|--cwd|--run).*$
|
||||
captures:
|
||||
1: keyword.other.hxml
|
||||
- match: (?<!\w)(--js(on)?|--lua|--swf-(header|version|lib(-extern)?)|--swf|--as3|--neko|--php|--cppia|--cpp|--cppia|--cs|--java-lib|--java|--python|--hl|-p|--class-path|-L|--library|--define|-r|--resource|--cmd|-C|--verbose|--debug|--prompt|--xml|--json|--net-lib|--net-std|--c-arg|--version|-h|--main).*$
|
||||
captures:
|
||||
1: keyword.other.hxml
|
Loading…
Reference in New Issue