100 lines
2.8 KiB
YAML
100 lines
2.8 KiB
YAML
%YAML 1.2
|
|
---
|
|
# NotesCraft's own Vue 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: Vue
|
|
file_extensions: [vue]
|
|
scope: text.html.vue
|
|
|
|
contexts:
|
|
main:
|
|
- match: '<!--'
|
|
scope: punctuation.definition.comment.begin
|
|
push: html-comment
|
|
- match: '(</?)([A-Za-z][\w:.-]*)'
|
|
captures:
|
|
1: punctuation.definition.tag
|
|
2: entity.name.tag
|
|
push: tag
|
|
- match: '\{\{'
|
|
scope: keyword.operator.template.begin
|
|
push: mustache
|
|
html-comment:
|
|
- meta_scope: comment.block
|
|
- match: '-->'
|
|
pop: true
|
|
tag:
|
|
- match: '/?>'
|
|
scope: punctuation.definition.tag
|
|
pop: true
|
|
- match: '"'
|
|
scope: punctuation.definition.string.begin
|
|
push: tag-dq
|
|
- match: ''''
|
|
scope: punctuation.definition.string.begin
|
|
push: tag-sq
|
|
- match: '\{\{'
|
|
scope: keyword.operator.template.begin
|
|
push: mustache
|
|
- match: '[@:#]?[A-Za-z_][\w:.\-|]*'
|
|
scope: entity.other.attribute-name
|
|
- match: '='
|
|
scope: keyword.operator
|
|
tag-dq:
|
|
- meta_scope: string.quoted.double
|
|
- match: '"'
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|
|
tag-sq:
|
|
- meta_scope: string.quoted.single
|
|
- match: ''''
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|
|
mustache:
|
|
- match: '\}\}'
|
|
scope: keyword.operator.template.end
|
|
pop: true
|
|
- match: '"'
|
|
scope: punctuation.definition.string.begin
|
|
push: m-dq
|
|
- match: ''''
|
|
scope: punctuation.definition.string.begin
|
|
push: m-sq
|
|
- match: '`'
|
|
scope: punctuation.definition.string.begin
|
|
push: m-bt
|
|
- match: '\b(?:if|else|each|await|then|catch|key|html|const|debug|render|snippet|as|in|of|typeof|new|function|return|await|async)\b'
|
|
scope: keyword.control
|
|
- match: '\b(?:true|false|null|undefined|this)\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
|
|
m-dq:
|
|
- meta_scope: string.quoted.double
|
|
- match: '\\.'
|
|
scope: constant.character.escape
|
|
- match: '"'
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|
|
- match: '(?=\n)'
|
|
pop: true
|
|
m-sq:
|
|
- meta_scope: string.quoted.single
|
|
- match: '\\.'
|
|
scope: constant.character.escape
|
|
- match: ''''
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|
|
- match: '(?=\n)'
|
|
pop: true
|
|
m-bt:
|
|
- meta_scope: string.quoted.backtick
|
|
- match: '\\.'
|
|
scope: constant.character.escape
|
|
- match: '`'
|
|
scope: punctuation.definition.string.end
|
|
pop: true
|