Skip to content

Commit 4b40b45

Browse files
authored
Add Flatbuffers language and grammar (#14275)
1 parent 95c378a commit 4b40b45

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

book/src/generated/lang-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
| fga |||| | | |
6969
| fidl || | | | | |
7070
| fish |||| | | `fish-lsp` |
71+
| flatbuffers || | | | | |
7172
| forth || | | | | `forth-lsp` |
7273
| fortran || || | | `fortls` |
7374
| fsharp || | | | | `fsautocomplete` |

languages.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,18 @@ formatter = { command = "fish_indent" }
446446
name = "fish"
447447
source = { git = "https://github.com/ram02z/tree-sitter-fish", rev = "a78aef9abc395c600c38a037ac779afc7e3cc9e0" }
448448

449+
[[language]]
450+
name = "flatbuffers"
451+
scope = "source.flatbuffers"
452+
injection-regex = "(flatbuffers?|fbs)"
453+
file-types = ["fbs"]
454+
comment-token = "//"
455+
indent = { tab-width = 2, unit = " " }
456+
457+
[[grammar]]
458+
name = "flatbuffers"
459+
source = { git = "https://github.com/yuanchenxi95/tree-sitter-flatbuffers", rev = "95e6f9ef101ea97e870bf6eebc0bd1fdfbaf5490" }
460+
449461
[[language]]
450462
name = "mint"
451463
scope = "source.mint"
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[
2+
"namespace"
3+
"attribute"
4+
"table"
5+
"struct"
6+
"union"
7+
"enum"
8+
"root_type"
9+
"rpc_service"
10+
"file_extension"
11+
"file_identifier"
12+
] @keyword
13+
14+
"include" @keyword.control.import
15+
16+
[
17+
";"
18+
"."
19+
","
20+
] @punctuation.delimiter
21+
22+
(type) @type.builtin
23+
(string_constant) @string
24+
25+
[
26+
(true)
27+
(false)
28+
] @constant.builtin.boolean
29+
30+
[
31+
(inf_token)
32+
(nan_token)
33+
] @constant.builtin
34+
35+
[
36+
(int_lit)
37+
(int_constant)
38+
] @constant.numeric.integer
39+
40+
[
41+
(float_lit)
42+
(float_constant)
43+
] @constant.numeric.float
44+
45+
46+
(comment) @comment
47+
(documentation) @comment.line.documentation
48+
49+
[
50+
"("
51+
")"
52+
"["
53+
"]"
54+
"{"
55+
"}"
56+
] @punctuation.bracket
57+
58+
[
59+
(metadata)
60+
] @attribute
61+
62+
(attribute_decl
63+
attribute_name: (identifier) @string)
64+
65+
(namespace_decl
66+
namespace_ident: (full_ident) @namespace)
67+
68+
(type_decl
69+
table_or_struct_name: (identifier) @type)
70+
71+
(enum_decl
72+
enum_name: (identifier) @type)
73+
74+
(enum_val_decl
75+
enum_key: (identifier) @type)
76+
77+
(union_decl
78+
union_name: (identifier) @type)
79+
80+
(root_decl
81+
root_type_ident: (identifier) @type)
82+
83+
(rpc_decl
84+
rpc_name: (identifier) @type)
85+
86+
(rpc_method
87+
rpc_method_name: (identifier) @function
88+
rpc_parameter: (identifier) @variable.parameter
89+
rpc_return_type: (identifier) @type)

0 commit comments

Comments
 (0)