Skip to content

Commit

Permalink
Merge branch 'fix-strings' into fix-runaway-regex
Browse files Browse the repository at this point in the history
  • Loading branch information
AnHeuermann committed Mar 15, 2024
2 parents 2f661a0 + f4a56e7 commit adbc149
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"group": "test",
"presentation": {
"reveal": "always",
"panel": "new",
"panel": "dedicated",
},
"problemMatcher": {
"owner": "vscode-tmgrammar-test",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ for more details on the publishing process.
npm install
```

Translate the `*tmGrammar.yaml` files to `*.tmGrammar.json` JSON files.
Translate the `*.tmGrammar.yaml` files to `*.tmGrammar.json` JSON files.
Start build task (Ctrl+Shift+B)

```bash
Expand Down
6 changes: 4 additions & 2 deletions syntaxes/metamodelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ patterns:
- name: keyword
end: \)\s*;

# Strings
- match: (?<![=+]\s*)((?<!\\)"([^"]*|\\")*(?<!\\)")\s*;
# Documentation Strings
- match: (?<![=+]\s*)((?<!\\)"([^"]|\\")*(?<!\\)")\s*;
captures:
1:
name: comment.line

# Strings
- begin: \"
end: \"
name: string.quoted.double
Expand Down
2 changes: 2 additions & 0 deletions syntaxes/modelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ patterns:
captures:
1:
name: comment.line

# Strings
- begin: \"
end: \"
name: string.quoted.double
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions test/metamodelica/FunctionDoc.test.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SYNTAX TEST "source.metamodelica" "Function with doc string"

public function foo
"Function does crazy stuff --fmiFlags
and creates an awesome record for stuff.
Author: ItIsI"
input Boolean isAwesome = true;
//^^^^^ source.metamodelica keyword.control
// ^^^^^^^ source.metamodelica storage.type
// ^^^^ source.metamodelica constant.language
output Option<SimCode.Awesome> awesome;
//^^^^^^ source.metamodelica keyword.control
// ^^^^^^^^^^^^^^^^^^^^^^^ source.metamodelica storage.type
// [...]
end foo;
4 changes: 4 additions & 0 deletions test/modelica/Comments.test.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SYNTAX TEST "source.modelica" "Comments"

model M "Documentation"
//<-- source.modelica keyword
// ^ source.modelica entity.name.type
// ^^^^^^^^^^^^^^^ source.modelica comment.line
Real x "Variable \"x\"";
// ^^^^^^^^^^^^^^^^ source.modelica comment.line
Expand Down Expand Up @@ -28,3 +30,5 @@ model M "Documentation"
// ^^^ source.modelica string.quoted.double
// ^^^ source.modelica string.quoted.double
end M;
//<-- source.modelica keyword
// ^ source.modelica entity.name.type
18 changes: 18 additions & 0 deletions test/modelica/Function.test.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SYNTAX TEST "source.modelica" "Function with doc string"

public function foo
"Function does crazy stuff --fmiFlags
and creates an awesome record for stuff.
Author: ItIsI"
input Boolean isAwesome = true;
//^^^^^ source.modelica keyword.control
// ^^^^^^^ source.modelica storage.type
// ^^^^ source.modelica constant.language
output MyRecord awesome;
//^^^^^^ source.modelica keyword.control
// [...]
//<--- source.modelica comment.line
//^^^^^^ source.modelica comment.line
end foo;
//<--- source.modelica keyword
// ^^^ source.modelica entity.name.type

0 comments on commit adbc149

Please sign in to comment.