Skip to content

Commit

Permalink
update dummy sublime syntax
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed Mar 16, 2024
1 parent d0f2a5b commit 3d82061
Showing 1 changed file with 46 additions and 32 deletions.
78 changes: 46 additions & 32 deletions editors/tim.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ scope: source.tim
variables:
ident: '[A-Za-z_][A-Za-z_0-9]*'
html_id: '[a-zA-Z_-][a-zA-Z0-9_-]*'
end_block: '^(\s*?)@\b(end)\b'
contexts:

main:
- include: javascript
- include: cssSnippet
- include: jsSnippet
- include: json
- include: yaml
- include: sass

- match: '\b(echo)\b|@\b(include|runtime|end|client)\b'
- match: '\b(echo)\b|@\b(include|end|client|placeholder)\b'
scope: keyword.control.import.timl

- match: '@view'
Expand Down Expand Up @@ -53,9 +54,17 @@ contexts:

- match: (\.)({{html_id}})\b
captures:
1: markup.bold
1: markup.bold entity.name.function
# 2: entity.name.function

- match: "'"
scope: punctuation.definition.string.begin.timl
push: single_quoted_string

- match: '"""'
scope: punctuation.definition.string.begin.timl
push: triple_quoted_string

- match: '"'
scope: punctuation.definition.string.begin.timl
push: double_quoted_string
Expand All @@ -77,9 +86,6 @@ contexts:
- match: '='
scope: markup.bold keyword.operator.assignment.timl

# - match: '\*'
# scope: entity.name.tag

- match: '\b(html|head|meta|script|body|title)\b'
scope: entity.name.tag.timl

Expand All @@ -101,6 +107,7 @@ contexts:
- match: '\b(ul|ol|dl|dt|dd|li)\b'
scope: entity.name.tag.list.timl

# Numbers
- match: '\b(-)?[0-9.]+\b'
scope: constant.numeric.tim

Expand All @@ -109,6 +116,14 @@ contexts:
scope: entity.name
pop: true

single_quoted_string:
- meta_scope: string.quoted.single.tim
- match: '\\.'
scope: constant.character.escape.tim
- match: "'"
scope: punctuation.definition.string.end.tim
pop: true

double_quoted_string:
- meta_scope: string.quoted.double.tim
- match: '\\.'
Expand All @@ -117,52 +132,51 @@ contexts:
scope: punctuation.definition.string.end.tim
pop: true

triple_quoted_string:
- meta_scope: string.quoted.double.tim
- match: '"""'
scope: punctuation.definition.string.end.tim
pop: true
- match: '"'
pop: false

line_comment:
- meta_scope: comment.line.tim
- match: $
pop: true

javascript:
jsSnippet:
- match: '@\b(js)\b'
scope: keyword.control.import.tim
embed: scope:source.js
embed_scope: meta.tag.tim
escape: '^(\s*?)@\b(end)\b'
escape: ({{end_block}})
escape_captures:
0: keyword.control.import.tim punctuation.definition.tag.end.tim

json:
- match: (```)(json)
scope: meta.tag.tim
captures:
1: punctuation.definition.tag.begin.tim
2: markup.bold.tim
- match: '@\b(json)\b'
scope: keyword.control.import.tim
embed: scope:source.json
embed_scope: meta.tag.tim
escape: (^(\s*)?(```))
escape: ({{end_block}})
escape_captures:
0: meta.tag.tim punctuation.definition.tag.end.tim
0: keyword.control.import.tim punctuation.definition.tag.end.tim

yaml:
- match: (```)(yaml)(#({{html_id}}))
scope: meta.tag.tim
captures:
1: punctuation.definition.tag.begin.tim
3: markup.bold.tim
- match: '@\b(yaml)\b'
scope: keyword.control.import.tim
embed: scope:source.yaml
embed_scope: meta.tag.tim
escape: (^(\s*)?(```))
escape: ({{end_block}})
escape_captures:
0: meta.tag.tim punctuation.definition.tag.end.tim
0: keyword.control.import.tim punctuation.definition.tag.end.tim

sass:
- match: (```)(sass)
scope: meta.tag.tim
captures:
1: punctuation.definition.tag.begin.tim
2: keyword.declaration.tim
embed: scope:source.sass
cssSnippet:
- match: '@\b(css)\b'
scope: keyword.control.import.tim
embed: scope:source.css
embed_scope: meta.tag.tim
escape: (^(\s*)?(```))
escape: ({{end_block}})
escape_captures:
0: meta.tag.tim punctuation.definition.tag.end.tim
0: keyword.control.import.tim punctuation.definition.tag.end.tim

0 comments on commit 3d82061

Please sign in to comment.