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

Allow enumeration to have end comment #47

Merged
merged 1 commit into from
Apr 5, 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
7 changes: 5 additions & 2 deletions syntaxes/metamodelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ patterns:

# Storage
## Enumeration
- begin: \b(enumeration)\b\s*\(
- begin: \b(enumeration)\s*\(
beginCaptures:
1:
name: storage.type.enumeration
end: \)\s*;
end: \)\s*("([^"]|\\")*(?<!\\)")?\s*;
endCaptures:
1:
name: comment.line
patterns:
- include: '#enumeration'

Expand Down
7 changes: 4 additions & 3 deletions test/metamodelica/Enumeration.test.mo
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ type FavouriteMinionFood = enumeration(
PAPAYA "Wikipedia tells me the fruit is a berry. I don't agree."
//^^^^^^ source.metamodelica variable.other.enummember
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.metamodelica comment.line
);

type FavouriteMinionFood = enumeration(BANANA "A banana", APPLE "An apple", GELATO "Ice-cream from the italian \"gelato\"", PAPAYA "Wikipedia tells me the fruit is a berry. I don't agree.");
) "No mushrooms here";
//^^^^^^^^^^^^^^^^^^^ source.metamodelica comment.line
type FavouriteMinionFood = enumeration(BANANA "A banana", APPLE "An apple", GELATO "Ice-cream from the italian \"gelato\"", PAPAYA "Wikipedia tells me the fruit is a berry. I don't agree.") "No mushrooms here" ;
//<--- source.metamodelica storage.type
// ^^^^^^^^^^^^^^^^^^^ source.metamodelica entity.name.type
// ^ source.metamodelica keyword.operator.assignment
Expand All @@ -32,3 +32,4 @@ type FavouriteMinionFood = enumeration(BANANA "A banana", APPLE "An apple", GELA
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.metamodelica comment.line
// ^^^^^^ source.metamodelica variable.other.enummember
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.metamodelica comment.line
// ^^^^^^^^^^^^^^^^^^^ source.metamodelica comment.line