summaryrefslogtreecommitdiff
path: root/mlir/utils
diff options
context:
space:
mode:
authorRiver Riddle <riddleriver@gmail.com>2022-05-16 16:52:49 -0700
committerRiver Riddle <riddleriver@gmail.com>2022-05-27 00:34:42 -0700
commitd6708b741936870a1d214eccc2fe86f25f796a37 (patch)
tree85071ae6edfc8ad33421ccd168145cd1c6c07f99 /mlir/utils
parentbdd0093f4d57790893d679ad590cd40c1dc3978c (diff)
downloadllvm-d6708b741936870a1d214eccc2fe86f25f796a37.tar.gz
[mlir-vscode] Add support for highlighting pdll and tablegen markdown code blocks
This essentially just piggy backs off of the existing mlir support. Differential Revision: https://reviews.llvm.org/D125734
Diffstat (limited to 'mlir/utils')
-rw-r--r--mlir/utils/vscode/markdown-grammar.json72
-rw-r--r--mlir/utils/vscode/package.json4
2 files changed, 75 insertions, 1 deletions
diff --git a/mlir/utils/vscode/markdown-grammar.json b/mlir/utils/vscode/markdown-grammar.json
index 2f1f68d42cbe..2a285a0705bc 100644
--- a/mlir/utils/vscode/markdown-grammar.json
+++ b/mlir/utils/vscode/markdown-grammar.json
@@ -4,6 +4,12 @@
"patterns": [
{
"include": "#mlir-code-block"
+ },
+ {
+ "include": "#pdll-code-block"
+ },
+ {
+ "include": "#tablegen-code-block"
}
],
"repository": {
@@ -39,6 +45,72 @@
]
}
]
+ },
+ "pdll-code-block": {
+ "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(pdll)(\\s+[^`~]*)?$)",
+ "name": "markup.fenced_code.block.markdown",
+ "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
+ "beginCaptures": {
+ "3": {
+ "name": "punctuation.definition.markdown"
+ },
+ "4": {
+ "name": "fenced_code.block.language.markdown"
+ },
+ "5": {
+ "name": "fenced_code.block.language.attributes.markdown"
+ }
+ },
+ "endCaptures": {
+ "3": {
+ "name": "punctuation.definition.markdown"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "(^|\\G)(\\s*)(.*)",
+ "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
+ "contentName": "meta.embedded.block.pdll",
+ "patterns": [
+ {
+ "include": "source.pdll"
+ }
+ ]
+ }
+ ]
+ },
+ "tablegen-code-block": {
+ "begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(tablegen)(\\s+[^`~]*)?$)",
+ "name": "markup.fenced_code.block.markdown",
+ "end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
+ "beginCaptures": {
+ "3": {
+ "name": "punctuation.definition.markdown"
+ },
+ "4": {
+ "name": "fenced_code.block.language.markdown"
+ },
+ "5": {
+ "name": "fenced_code.block.language.attributes.markdown"
+ }
+ },
+ "endCaptures": {
+ "3": {
+ "name": "punctuation.definition.markdown"
+ }
+ },
+ "patterns": [
+ {
+ "begin": "(^|\\G)(\\s*)(.*)",
+ "while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
+ "contentName": "meta.embedded.block.tablegen",
+ "patterns": [
+ {
+ "include": "source.tablegen"
+ }
+ ]
+ }
+ ]
}
},
"scopeName": "markdown.mlir.codeblock"
diff --git a/mlir/utils/vscode/package.json b/mlir/utils/vscode/package.json
index 793ea00e18fe..55033c3304ba 100644
--- a/mlir/utils/vscode/package.json
+++ b/mlir/utils/vscode/package.json
@@ -106,7 +106,9 @@
"text.html.markdown"
],
"embeddedLanguages": {
- "meta.embedded.block.mlir": "mlir"
+ "meta.embedded.block.mlir": "mlir",
+ "meta.embedded.block.pdll": "pdll",
+ "meta.embedded.block.tablegen": "tablegen"
}
},
{