From b313536643d8a206ca6f7160278f4344e40251a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Reuh=20Fildadut?= Date: Mon, 20 May 2024 15:10:16 +0200 Subject: [PATCH] Update to latest Anselme version --- Anselme.sublime-syntax | 52 ++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/Anselme.sublime-syntax b/Anselme.sublime-syntax index 9343d61..cf10c13 100755 --- a/Anselme.sublime-syntax +++ b/Anselme.sublime-syntax @@ -14,28 +14,40 @@ variables: [^0-9\s\'{{identifier_disallowed}}][^{{identifier_disallowed}}]* |\_( \! | \- | \* | \~ ) |( \! )\_ - |\_( \|\> | \+ | \- | \/ | \/\/ | \* | \^ | \% | \& | \| | \=\= | \= | \!\= | \>\= | \<\= | \< | \> | \. | \:\: | \# | \: )\_ + |\_( \+ | \- | \/ | \/\/ | \* | \^ | \% | \& | \| | \=\= | \= | \!\= | \>\= | \<\= | \< | \> | \. | \:\: | \# | \: )\_ ) contexts: prototype: - - match: '\/\*' - scope: comment.line.anselme punctuation.definition.comment.anselme - push: comment - - match: '\s+' + - include: comments_and_whitespace - match: '$' pop: true + comments_and_whitespace: + - match: '\/\/' + scope: comment.line.anselme punctuation.definition.comment.anselme + push: comment + - match: '\/\*' + scope: comment.block.anselme punctuation.definition.comment.anselme + push: multiline_comment + - match: '\s+' + main: - match: '' push: primary comment: - meta_scope: comment.line.anselme + - match: '\/\/|$' + scope: punctuation.definition.comment.anselme + pop: true + + multiline_comment: + - meta_scope: comment.block.anselme - match: '\/\*' scope: punctuation.definition.comment.anselme - push: comment - - match: '\*\/|$' + push: multiline_comment + - match: '\*\/' scope: punctuation.definition.comment.anselme pop: true @@ -54,7 +66,7 @@ contexts: - match: '\(' scope: punctuation.section.parens.begin.anselme push: parenthesis - - match: '\::?&?@?\$' + - match: '\:&?@?\$' scope: keyword.declaration.anselme push: function_definition - match: '(\#)({{identifier}})' @@ -62,17 +74,23 @@ contexts: 1: keyword.declaration.anselme 2: entity.name.label.anselme push: secondary - - match: '(\::?&?@?)({{identifier}})' + - match: '(\:&?@?)({{identifier}})' captures: 1: keyword.declaration.anselme 2: variable.other.anselme push: secondary - - match: '{{identifier}}(?=\!(?!\s*{{identifier}})|\()' + - match: '{{identifier}}(?=\!(?!\s*{{identifier}})|\(|\[|\{)' scope: variable.function.anselme set: secondary + - match: '({{identifier}})\s*(?=\:)' + scope: meta.mapping.key.anselme string.unquoted.key.anselme + push: secondary - match: '{{identifier}}' scope: variable.other.anselme push: secondary + - match: '\-\-\-' + scope: text.anselme meta.separator.thematic-break.anselme punctuation.definition.thematic-break.anselme + push: secondary - match: '\_' scope: variable.language.anselme push: secondary @@ -98,7 +116,7 @@ contexts: - match: '\;' scope: keyword.control.anselme set: primary - - match: '\-' + - match: '\-|\+' scope: keyword.operator.arithmetic.anselme set: primary - match: '\!' @@ -159,6 +177,7 @@ contexts: scope: constant.character.escape.anselme string: + - meta_include_prototype: false - meta_scope: meta.string.anselme string.quoted.double.anselme - include: expression_interpolation - include: character_escape @@ -177,14 +196,18 @@ contexts: ## Other primary elements ## parenthesis: + - meta_include_prototype: false - meta_scope: meta.parens.anselme - match: '\)' scope: punctuation.section.parens.end.anselme set: secondary + - include: comments_and_whitespace - include: primary tuple: + - meta_include_prototype: false - meta_scope: meta.sequence.tuple.anselme + - include: comments_and_whitespace - include: primary - match: '\,' scope: punctuation.separator.sequence.anselme @@ -193,7 +216,9 @@ contexts: set: secondary struct: + - meta_include_prototype: false - meta_scope: meta.mapping.anselme + - include: comments_and_whitespace - include: primary - match: '\,' scope: punctuation.separator.sequence.anselme @@ -210,9 +235,6 @@ contexts: - match: '\,' scope: punctuation.separator.sequence.anselme push: primary - - match: '\|\>' - scope: keyword.control.conditional.anselme - push: primary - match: '\#|\:\:|\:|\-\>' scope: keyword.operator.anselme push: primary @@ -222,7 +244,7 @@ contexts: - match: '\=\=|\!\=|\<\=|\>\=|\<|\>' scope: keyword.operator.comparison.anselme push: primary - - match: '\+|\-|\*|\/\/|\/|\%|\^' + - match: '\+|\-|\*|\/|\%|\^' scope: keyword.operator.arithmetic.anselme push: primary - match: '\.'