Skip to content

Commit

Permalink
Highlight annotations (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnHeuermann authored Dec 19, 2023
1 parent e5878ce commit 0f555af
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions syntaxes/modelica.tmGrammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,29 @@ patterns:
name: entity.name.type
3:
name: comment.line
- match: ((function)\s+\w+\s*(".*")*)
- match: \b(function)\s+(\w+)\s*(".*")*
captures:
1:
name: entity.name.function
2:
name: keyword
2:
name: entity.name.function
3:
name: comment.line

# Annotations
- begin: \b(annotation)\b
beginCaptures:
- name: keyword
end: \)\s*;
patterns:
- include: '#annotations'

# Strings
- begin: \"
end: \"
name: string.quoted.double
patterns:
- include: "#escapes"
- include: '#escapes'
- match: '["\w\)\]](\s+"[^"]*"\s*);'
captures:
1:
Expand All @@ -83,4 +91,22 @@ repository:
match: '\\(x\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)'
name: constant.character.escape

annotations:
patterns:
- match: \b(Evaluate|version|versionDate|dateModified|HideResult|singleInstance|mustBeConnected|mayOnlyConnectOnce|Inline|LateInline)\b
name: keyword
- begin: \b(experiment)\b\s*\(
beginCaptures:
- name: keyword
end: \)
patterns:
- include: '#experiment'
- include: "source.modelica"

experiment:
patterns:
- match: \b(StartTime|StopTime|Interval|Tolerance)\b
name: keyword
- include: "source.modelica"

scopeName: source.modelica

0 comments on commit 0f555af

Please sign in to comment.