From 5c0bea2246d530c13269993d25fc9e7891894e49 Mon Sep 17 00:00:00 2001 From: Andreas <38031952+AnHeuermann@users.noreply.github.com> Date: Fri, 15 Mar 2024 13:50:36 +0100 Subject: [PATCH] Enumeration an Type declarations (#43) * Highlight metamodelica enumerations * Handling type declarations --- syntaxes/metamodelica.tmGrammar.yaml | 31 +++++++++++++++++++++++++++ test/metamodelica/Enumeration.test.mo | 20 +++++++++++++++++ test/modelica/Comments.test.mo | 6 +++--- 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 test/metamodelica/Enumeration.test.mo diff --git a/syntaxes/metamodelica.tmGrammar.yaml b/syntaxes/metamodelica.tmGrammar.yaml index c11cdc8..e9040d4 100644 --- a/syntaxes/metamodelica.tmGrammar.yaml +++ b/syntaxes/metamodelica.tmGrammar.yaml @@ -17,8 +17,28 @@ patterns: name: constant.numeric # Storage + ## Enumeration + - begin: \b(enumeration)\b\s*\( + beginCaptures: + 1: + name: storage.type.enumeration + end: \)\s*; + patterns: + - include: '#enumeration' + + ## Type declaration + - match: \b(type)\b\s+\b(\w+)\b\s+(=) + captures: + 1: + name: storage.type + 2: + name: entity.name.type + 3: + name: keyword.operator.assignment + - match: \b(Real|Integer|Boolean|String|enumeration|type)\b name: storage.type + ## Variability Prefix - match: \b(parameter|constant)\b name: storage.modifier @@ -110,4 +130,15 @@ repository: match: '\\(x\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)' name: constant.character.escape + enumeration: + patterns: + - match: \b(\w+)\b\s*((?