diff options
author | hh9527 | 2022-10-31 23:48:01 +0000 |
---|---|---|
committer | GitHub | 2022-10-31 23:48:01 +0000 |
commit | 9df43584924a72be88f537ac432e5976430fa3f1 (patch) | |
tree | e769a7e075f29ce3d89e5d97097a9be5a2c47d19 /runtime | |
parent | df3c6412acc2c0948450653a67a4993092abf5fb (diff) |
Support WIT grammar (#4525)
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/queries/wit/highlights.scm | 67 | ||||
-rw-r--r-- | runtime/queries/wit/indents.scm | 13 |
2 files changed, 80 insertions, 0 deletions
diff --git a/runtime/queries/wit/highlights.scm b/runtime/queries/wit/highlights.scm new file mode 100644 index 00000000..45754a5a --- /dev/null +++ b/runtime/queries/wit/highlights.scm @@ -0,0 +1,67 @@ +(line_comment) @comment.line +(block_comment) @comment.block +(ty (ident) @type) + +(item_type name: (ident) @type) +(item_record name: (ident) @type) +(item_variant name: (ident) @type) +(item_flags name: (ident) @type) +(item_enum name: (ident) @type) +(item_union name: (ident) @type) +(item_resource name: (ident) @type) + +(item_use from: (ident) @namespace) +(use_item name: (ident) @type) +(item_func name: (ident) @function) +(method name: (ident) @function.method) +(fields (named_ty name: (ident) @variable.other.member)) +(input (args (named_ty name: (ident) @variable.parameter))) +(output (args (named_ty name: (ident) @variable.other.member))) +(flags (ident) @constant) +(enum_items (ident) @constant) +(variant_item tag: (ident) @type.enum.variant) + +[ + (unit) + + "u8" "u16" "u32" "u64" + "s8" "s16" "s32" "s64" + "float32" "float64" + "char" "bool" "string" +] @type.builtin + +[ + "list" + "option" + "result" + "tuple" + "future" + "stream" +] @function.macro + +[ "," ":" ] @punctuation.delimiter +[ "(" ")" "{" "}" "<" ">" ] @punctuation.bracket +[ "=" "->" ] @operator + +[ + "record" + "flags" + "variant" + "enum" + "union" + "type" + "resource" +] @keyword.storage.type + +"func" @keyword + +[ + "static" +] @keyword.storage.modifier + +[ + (star) + "use" + "as" + "from" +] @keyword.control.import diff --git a/runtime/queries/wit/indents.scm b/runtime/queries/wit/indents.scm new file mode 100644 index 00000000..db6c148b --- /dev/null +++ b/runtime/queries/wit/indents.scm @@ -0,0 +1,13 @@ +[ + (use_items) + (fields) + (variant_items) + (variant_payload) + (flags) + (enum_items) + (union_items) + (args) + (resource_items) +] @indent + +[ "}" ")" ] @outdent |