From 000b413b43ade1430ae4d2b48f02bfd37150c9b0 Mon Sep 17 00:00:00 2001 From: Kenton Hamaluik Date: Thu, 28 Nov 2019 13:00:54 -0700 Subject: [PATCH] added haxe and toml syntaxes --- assets/syntaxes/TOML.sublime-syntax | 405 ++++++++++++++++++ assets/syntaxes/create.sh | 53 +++ assets/syntaxes/haxe.sublime-syntax | 633 ++++++++++++++++++++++++++++ assets/syntaxes/hxml.sublime-syntax | 31 ++ docs-src/02-markdown.md | 27 +- docs/01-introduction.html | 2 +- docs/02-markdown.html | 38 +- docs/03-frontmatter.html | 2 +- docs/04-structure.html | 16 +- docs/05-customization.html | 2 +- docs/06-how-it-works.html | 2 +- docs/index.html | 4 +- src/main.rs | 11 + 13 files changed, 1187 insertions(+), 39 deletions(-) create mode 100644 assets/syntaxes/TOML.sublime-syntax create mode 100755 assets/syntaxes/create.sh create mode 100644 assets/syntaxes/haxe.sublime-syntax create mode 100644 assets/syntaxes/hxml.sublime-syntax diff --git a/assets/syntaxes/TOML.sublime-syntax b/assets/syntaxes/TOML.sublime-syntax new file mode 100644 index 0000000..ea8e632 --- /dev/null +++ b/assets/syntaxes/TOML.sublime-syntax @@ -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) + (?>|>>>) + 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 diff --git a/assets/syntaxes/hxml.sublime-syntax b/assets/syntaxes/hxml.sublime-syntax new file mode 100644 index 0000000..75d6831 --- /dev/null +++ b/assets/syntaxes/hxml.sublime-syntax @@ -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: (? - +