Skip to content

Commit

Permalink
Fix scope of Option literals (#73)
Browse files Browse the repository at this point in the history
- Only match `SOME`, not what's inside.
- Make test smaller
  • Loading branch information
phannebohm authored Sep 18, 2024
1 parent 79a6bc3 commit 9c2a142
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
2 changes: 1 addition & 1 deletion syntaxes/metamodelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ patterns:
- include: "source.metamodelica"

# Option literals
- match: (SOME\(.*\)|NONE\(\))
- match: (SOME\(|NONE\(\))
name: entity.name.type

# Function calls
Expand Down
16 changes: 4 additions & 12 deletions test/metamodelica/Option.test.mo
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
// SYNTAX TEST "source.metamodelica" "Option"

function f
input Option<Integer> oi;
// ^^^^^^ source.metamodelica storage.type
// ^^^^^^^ source.metamodelica storage.type
algorithm
() := match oi
case SOME(i) then ();
// ^^^^ source.metamodelica entity.name.type
case NONE() then ();
// ^^^^ source.metamodelica entity.name.type
end match;
end f;
opt := if cond then SOME(i) else NONE();
// ^^^^ source.metamodelica entity.name.type
// ^^^^ source.metamodelica keyword.control
// ^^^^ source.metamodelica entity.name.type

0 comments on commit 9c2a142

Please sign in to comment.