Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solve polymorphic/comparison ambiguity #76

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions syntaxes/metamodelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ patterns:
name: storage.type

## Polymorphic types
- begin: \b(list|tuple|array|Option)\s*<
- begin: \b(list|tuple|array|Option)<
end: '>'
beginCaptures:
1:
name: storage.type
patterns:
- include: '#polymorphic_type'

- begin: \b(\w+)\s*<
- begin: \b(\w+)<
end : '>'
beginCaptures:
1:
Expand Down Expand Up @@ -171,7 +171,7 @@ repository:
- include: '#polymorphic_type'
- match: \b(Real|Integer|Boolean|String|enumeration|type)\b
name: storage.type
- match: \b([\w\.]+)\b
- match: \b(\w+)\b
name: entity.name.type

scopeName: source.metamodelica
3 changes: 2 additions & 1 deletion test/metamodelica/FunctionDoc.test.mo
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ public function foo
output Option<SimCode.Awesome> awesome;
//^^^^^^ source.metamodelica keyword.control
// ^^^^^^ source.metamodelica storage.type
// ^^^^^^^^^^^^^^^ source.metamodelica entity.name.type
// ^^^^^^^ source.metamodelica entity.name.type
// ^^^^^^^ source.metamodelica entity.name.type
// [...]
end foo;

Expand Down
5 changes: 5 additions & 0 deletions test/metamodelica/Types.test.mo
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ type TL = UnorderedMap<Key, Value>;
// ^^^^^^^^^^^^ source.metamodelica entity.name.type
// ^^^ source.metamodelica entity.name.type
// ^^^^^ source.metamodelica entity.name.type

x < 1 and x > 0;
//^ keyword.operator.comparison
// ^^^ keyword.control
// ^ keyword.operator.comparison