Skip to content

Commit

Permalink
feat: upgrade class diagram shiki grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
hikerpig committed Feb 25, 2024
1 parent 2bf5dcf commit 92e1da3
Showing 1 changed file with 189 additions and 0 deletions.
189 changes: 189 additions & 0 deletions website/static/data/pintora.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@
],
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)"
},
{
"comment": "Class Diagram",
"begin": "\\b(classDiagram)",
"beginCaptures": {
"1": {
"name": "keyword.control.pintora"
}
},
"patterns": [
{
"include": "#class__element"
},
{
"include": "#config__clause"
},
{
"include": "#comment"
}
],
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)"
},
{
"comment": "Component Diagram",
"begin": "\\b(componentDiagram)",
Expand Down Expand Up @@ -1501,6 +1522,174 @@
}
}
]
},
"class__element": {
"patterns": [
{
"comment": "class with bracket",
"begin": "(class)\\s+([^\\s]+)\\s*({)",
"beginCaptures": {
"1": {
"name": "keyword.control.pintora"
},
"2": {
"name": "entity.name.type"
},
"3": {
"name": "punctuation.bracket.open.pintora"
}
},
"end": "^\\s*(})",
"endCaptures": {
"1": {
"name": "punctuation.bracket.close.pintora"
}
},
"patterns": [
{
"comment": "class modified member inside bracket",
"match": "({)(.*)(})\\s*(.*)\\s*(.*)",
"captures": {
"1": {
"name": "keyword.control.pintora"
},
"2": {
"name": "string"
},
"3": {
"name": "keyword.control.pintora"
},
"4": {
"name": "variable.pintora"
},
"5": {
"name": "variable.pintora"
}
}
},
{
"comment": "class member inside bracket",
"match": "([+#~-])?\\s*([\\w\\d\\(\\)]+)\\s*([\\w\\d\\(\\)]+)",
"captures": {
"1": {
"name": "keyword.control.pintora"
},
"2": {
"name": "entity.name.type"
},
"3": {
"name": "variable.pintora"
}
}
},
{
"comment": "class annotation inside bracket",
"match": "(<<)(.*)(>>)",
"captures": {
"1": {
"name": "keyword.control.pintora"
},
"2": {
"name": "string"
},
"3": {
"name": "keyword.control.pintora"
}
}
}
]
},
{
"comment": "class declaration quote alias",
"match": "(class)\\s*\"([^\"]+)\"\\s*(as)\\s+(\\w+)",
"captures": {
"1": {
"name": "keyword.control.pintora"
},
"2": {
"name": "string"
},
"3": {
"name": "keyword.control.pintora"
},
"4": {
"name": "entity.name.type"
}
}
},
{
"comment": "class declareation name",
"match": "(class)\\s+(\\w+)",
"captures": {
"1": {
"name": "keyword.control.pintora"
},
"2": {
"name": "entity.name.type"
}
}
},
{
"comment": "class annotation",
"match": "(<<)(.*)(>>)\\s*(.*)",
"captures": {
"1": {
"name": "keyword.control.pintora"
},
"2": {
"name": "string"
},
"3": {
"name": "keyword.control.pintora"
},
"4": {
"name": "entity.name.type"
}
}
},
{
"comment": "relation statement",
"match": "(\\w+)\\s*(\"[^\"]*\")?\\s*(<\\|--|--\\|>|<\\|\\.\\.|\\.\\.\\|>|\\*--|\\*\\.\\.|--\\*|\\.\\.\\*|o--|o\\.\\.|--o|\\.\\.o|-->|\\.\\.>|<--|<\\.\\.|--|\\.\\.)\\s*(\"[^\"]*\")?\\s*(\\w+)\\s*(:)?(.*)?",
"captures": {
"1": {
"name": "entity.name.type"
},
"2": {
"name": "string"
},
"3": {
"name": "keyword.control.pintora"
},
"4": {
"name": "string"
},
"5": {
"name": "entity.name.type"
},
"6": {
"name": "keyword.control.pintora"
},
"7": {
"name": "string"
}
}
},
{
"comment": "class member",
"match": "([\\w\\d+-]+)\\s*(:)\\s*(.*)",
"captures": {
"1": {
"name": "variable.pintora"
},
"2": {
"name": "keyword.control.pintora"
},
"3": {
"name": "entity.name.type"
}
}
}
]
}
}
}

0 comments on commit 92e1da3

Please sign in to comment.