Skip to content

Commit

Permalink
Fix Doc string for if-expression with string (#50)
Browse files Browse the repository at this point in the history
Fixes #30
  • Loading branch information
phannebohm authored Jul 4, 2024
1 parent d166962 commit 2a541fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion syntaxes/metamodelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ patterns:
end: \)\s*;

# Documentation Strings
- match: (?<![=+]\s*)((?<!\\)"([^"]|\\")*(?<!\\)")\s*;
- match: (?<!else\s*)(?<![=+]\s*)((?<!\\)"([^"]|\\")*(?<!\\)")\s*;
captures:
1:
name: comment.line
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/modelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ patterns:
- include: '#annotations'

# Documentation Strings
- match: (?<![=+]\s*)((?<!\\)"([^"]|\\")*(?<!\\)")\s*;
- match: (?<!else\s*)(?<![=+]\s*)((?<!\\)"([^"]|\\")*(?<!\\)")\s*;
captures:
1:
name: comment.line
Expand Down
7 changes: 7 additions & 0 deletions test/modelica/Comments.test.mo
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ model M "Documentation"
String w = "a" + "b";
// ^^^ source.modelica string.quoted.double
// ^^^ source.modelica string.quoted.double
String s = if true then "yes" else "no" "doc";
// ^^^^^ source.modelica string.quoted.double
// ^^^^ source.modelica string.quoted.double
// ^^^^^ source.modelica comment.line
String t = if false then "yes" else "no";
// ^^^^^ source.modelica string.quoted.double
// ^^^^ source.modelica string.quoted.double
end M;
//<-- source.modelica keyword
// ^ source.modelica entity.name.type

0 comments on commit 2a541fa

Please sign in to comment.