Files
Marcos Paulo eb1245bd20
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
fix: tab switch freeze (unlinked scan off the UI thread); assistant: vault MCP wiring, preamble, wrapping choices, presets; 23 grammars incl. Twig; Tasks query, Templater include, icon picker
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-21 13:36:33 -03:00

126 lines
4.3 KiB
YAML

%YAML 1.2
---
# NotesCraft's own Liquid grammar. Original work written for this project; not copied
# from any other grammar. Regexes stay linear: no nested quantifiers, so nothing backtracks far.
# Strings end at their line unless the language allows multi-line ones.
name: Liquid
file_extensions: [liquid]
scope: text.html.liquid
contexts:
main:
- match: '\{%-?\s*comment\s*-?%\}'
scope: keyword.operator.template.begin
push: comment-tag
- match: '\{%-?\s*raw\s*-?%\}'
scope: keyword.operator.template.begin
push: raw-tag
- match: '\{#'
scope: keyword.operator.template.begin comment.block
push: comment
- match: '\{\{-?'
scope: keyword.operator.template.begin
push: expr
- match: '\{%-?'
scope: keyword.operator.template.begin
push: stmt
comment:
- meta_scope: comment.block
- match: '#\}'
scope: keyword.operator.template.end
pop: true
expr:
- match: '-?\}\}'
scope: keyword.operator.template.end
pop: true
- match: '"'
scope: punctuation.definition.string.begin
push: expr-dq
- match: ''''
scope: punctuation.definition.string.begin
push: expr-sq
- match: '(\|)\s*([A-Za-z_]\w*)'
captures:
1: keyword.operator
2: support.function.filter
- match: '\b(?:if|elsif|else|endif|unless|endunless|case|when|endcase|for|endfor|in|break|continue|assign|capture|endcapture|increment|decrement|include|render|section|layout|paginate|endpaginate|form|endform|tablerow|endtablerow|cycle|echo|liquid|style|endstyle|javascript|endjavascript|schema|endschema|limit|offset|reversed|with|as|for)\b'
scope: keyword.control
- match: '\b(?:and|or|contains)\b'
scope: keyword.operator.word
- match: '\b(?:true|false|nil|null|blank|empty)\b'
scope: constant.language
- match: '\b(?:0[xX][0-9a-fA-F_]+|0[bB][01_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d+)?)\b'
scope: constant.numeric
- match: '[-+*/%=<>!&|^~?:.,]+'
scope: keyword.operator
expr-dq:
- meta_scope: string.quoted.double
- match: '\\.'
scope: constant.character.escape
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: '(?=\n)'
pop: true
expr-sq:
- meta_scope: string.quoted.single
- match: '\\.'
scope: constant.character.escape
- match: ''''
scope: punctuation.definition.string.end
pop: true
- match: '(?=\n)'
pop: true
stmt:
- match: '-?%\}'
scope: keyword.operator.template.end
pop: true
- match: '"'
scope: punctuation.definition.string.begin
push: stmt-dq
- match: ''''
scope: punctuation.definition.string.begin
push: stmt-sq
- match: '(\|)\s*([A-Za-z_]\w*)'
captures:
1: keyword.operator
2: support.function.filter
- match: '\b(?:if|elsif|else|endif|unless|endunless|case|when|endcase|for|endfor|in|break|continue|assign|capture|endcapture|increment|decrement|include|render|section|layout|paginate|endpaginate|form|endform|tablerow|endtablerow|cycle|echo|liquid|style|endstyle|javascript|endjavascript|schema|endschema|limit|offset|reversed|with|as|for)\b'
scope: keyword.control
- match: '\b(?:and|or|contains)\b'
scope: keyword.operator.word
- match: '\b(?:true|false|nil|null|blank|empty)\b'
scope: constant.language
- match: '\b(?:0[xX][0-9a-fA-F_]+|0[bB][01_]+|\d[\d_]*(?:\.\d[\d_]*)?(?:[eE][+-]?\d+)?)\b'
scope: constant.numeric
- match: '[-+*/%=<>!&|^~?:.,]+'
scope: keyword.operator
stmt-dq:
- meta_scope: string.quoted.double
- match: '\\.'
scope: constant.character.escape
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: '(?=\n)'
pop: true
stmt-sq:
- meta_scope: string.quoted.single
- match: '\\.'
scope: constant.character.escape
- match: ''''
scope: punctuation.definition.string.end
pop: true
- match: '(?=\n)'
pop: true
comment-tag:
- meta_scope: comment.block
- match: '\{%-?\s*endcomment\s*-?%\}'
scope: keyword.operator.template.end
pop: true
raw-tag:
- meta_scope: string.unquoted.raw
- match: '\{%-?\s*endraw\s*-?%\}'
scope: keyword.operator.template.end
pop: true