Unnamed repository; edit this file 'description' to name the repository.
Add Flatbuffers language and grammar (#14275)
| -rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
| -rw-r--r-- | languages.toml | 12 | ||||
| -rw-r--r-- | runtime/queries/flatbuffers/highlights.scm | 89 |
3 files changed, 102 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index a6cf2833..7b3a56d8 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -68,6 +68,7 @@ | fga | ✓ | ✓ | ✓ | | | | | fidl | ✓ | | | | | | | fish | ✓ | ✓ | ✓ | | | `fish-lsp` | +| flatbuffers | ✓ | | | | | | | forth | ✓ | | | | | `forth-lsp` | | fortran | ✓ | | ✓ | | | `fortls` | | fsharp | ✓ | | | | | `fsautocomplete` | diff --git a/languages.toml b/languages.toml index 2379308c..dcb62684 100644 --- a/languages.toml +++ b/languages.toml @@ -447,6 +447,18 @@ name = "fish" source = { git = "https://github.com/ram02z/tree-sitter-fish", rev = "a78aef9abc395c600c38a037ac779afc7e3cc9e0" } [[language]] +name = "flatbuffers" +scope = "source.flatbuffers" +injection-regex = "(flatbuffers?|fbs)" +file-types = ["fbs"] +comment-token = "//" +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "flatbuffers" +source = { git = "https://github.com/yuanchenxi95/tree-sitter-flatbuffers", rev = "95e6f9ef101ea97e870bf6eebc0bd1fdfbaf5490" } + +[[language]] name = "mint" scope = "source.mint" injection-regex = "mint" diff --git a/runtime/queries/flatbuffers/highlights.scm b/runtime/queries/flatbuffers/highlights.scm new file mode 100644 index 00000000..213bb850 --- /dev/null +++ b/runtime/queries/flatbuffers/highlights.scm @@ -0,0 +1,89 @@ +[ + "namespace" + "attribute" + "table" + "struct" + "union" + "enum" + "root_type" + "rpc_service" + "file_extension" + "file_identifier" +] @keyword + +"include" @keyword.control.import + +[ + ";" + "." + "," +] @punctuation.delimiter + +(type) @type.builtin +(string_constant) @string + +[ + (true) + (false) +] @constant.builtin.boolean + +[ + (inf_token) + (nan_token) +] @constant.builtin + +[ + (int_lit) + (int_constant) +] @constant.numeric.integer + +[ + (float_lit) + (float_constant) +] @constant.numeric.float + + +(comment) @comment +(documentation) @comment.line.documentation + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +[ + (metadata) +] @attribute + +(attribute_decl + attribute_name: (identifier) @string) + +(namespace_decl + namespace_ident: (full_ident) @namespace) + +(type_decl + table_or_struct_name: (identifier) @type) + +(enum_decl + enum_name: (identifier) @type) + +(enum_val_decl + enum_key: (identifier) @type) + +(union_decl + union_name: (identifier) @type) + +(root_decl + root_type_ident: (identifier) @type) + +(rpc_decl + rpc_name: (identifier) @type) + +(rpc_method + rpc_method_name: (identifier) @function + rpc_parameter: (identifier) @variable.parameter + rpc_return_type: (identifier) @type) |