-
Notifications
You must be signed in to change notification settings - Fork 1
/
c3-ts-mode.el
647 lines (560 loc) · 20.3 KB
/
c3-ts-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
;;; c3-ts-mode.el --- Major mode for C3 using tree-sitter -*- lexical-binding: t -*-
;; Author: Christian Buttner <https://github.com/cbuttner>
;; URL: https://github.com/c3lang/c3-ts-mode
;; Keywords: c3 languages tree-sitter
;; Version: 0.9.0
;; Package-Requires : ((emacs "29.1"))
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <https://www.gnu.org/licenses>.
;;; Commentary:
;; This tree-sitter powered Emacs 29+ major mode provides syntax highlighting, indentation, imenu and which-function support for C3.
;; It's built against the tree-sitter grammar located at <https://github.com/c3lang/tree-sitter-c3>.
;;; Code:
(require 'treesit)
(require 'c-ts-common)
(eval-when-compile (require 'rx))
(declare-function treesit-node-child-by-field-name "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-text "treesit.c")
(declare-function treesit-parser-create "treesit.c")
(defgroup c3-ts nil
"Major mode for editing C3 files."
:prefix "c3-ts-"
:group 'languages)
(defcustom c3-ts-mode-indent-offset 2
"Number of spaces for each indentation step in `c3-ts-mode'."
:version "29.1"
:type 'integer
:safe 'integerp
:group 'c3-ts)
(defcustom c3-ts-mode-highlight-variable 't
"Enable highlighting of variables in `c3-ts-mode'."
:version "29.1"
:type 'boolean
:safe 'booleanp
:group 'c3-ts)
(defcustom c3-ts-mode-highlight-property 't
"Enable highlighting of members in `c3-ts-mode'."
:version "29.1"
:type 'boolean
:safe 'booleanp
:group 'c3-ts)
(defcustom c3-ts-mode-highlight-assignment 't
"Enable highlighting of assignments in `c3-ts-mode'."
:version "29.1"
:type 'boolean
:safe 'booleanp
:group 'c3-ts)
(defcustom c3-ts-mode-highlight-punctuation 't
"Enable highlighting of punctuation in `c3-ts-mode'."
:version "29.1"
:type 'boolean
:safe 'booleanp
:group 'c3-ts)
(defcustom c3-ts-mode-module-path-face '@font-lock-constant-face
"The face to use for highlighting module paths in `c3-ts-mode'."
:version "29.1"
:type 'symbol
:group 'c3-ts)
(defcustom c3-ts-mode-assignment-face '@font-lock-variable-name-face
"The face to use for highlighting assignments in `c3-ts-mode'."
:version "29.1"
:type 'symbol
:group 'c3-ts)
(defcustom c3-ts-mode-hook nil
"Hook run after entering `c3-ts-mode'."
:version "29.1"
:type 'hook
:group 'c3-ts)
(defvar c3-ts-mode--syntax-table
(let ((table (make-syntax-table)))
;; Taken from c-ts-mode.el
(modify-syntax-entry ?_ "_" table)
(modify-syntax-entry ?\\ "\\" table)
(modify-syntax-entry ?+ "." table)
(modify-syntax-entry ?- "." table)
(modify-syntax-entry ?= "." table)
(modify-syntax-entry ?% "." table)
(modify-syntax-entry ?< "." table)
(modify-syntax-entry ?> "." table)
(modify-syntax-entry ?& "." table)
(modify-syntax-entry ?| "." table)
(modify-syntax-entry ?\' "\"" table)
(modify-syntax-entry ?` "\"" table)
(modify-syntax-entry ?\240 "." table)
(modify-syntax-entry ?/ ". 124b" table)
(modify-syntax-entry ?* ". 23" table)
(modify-syntax-entry ?\n "> b" table)
(modify-syntax-entry ?\^m "> b" table)
table)
"Syntax table for `c3-ts-mode'.")
(defvar c3-ts-mode--keywords
;; From "c3c --list-keywords", without base types
'("assert"
"asm"
"bitstruct"
"break"
"case"
"catch"
"const"
"continue"
"def"
"default"
"defer"
"distinct"
"do"
"else"
"enum"
"extern"
;; "false" ;; NOTE Treated as constant
"fault"
"for"
"foreach"
"foreach_r"
"fn"
"tlocal"
"if"
"inline"
"import"
"macro"
"module"
"nextcase"
;; "null" ;; NOTE Treated as constant
"interface"
"return"
"static"
"struct"
"switch"
;; "true" ;; NOTE Treated as constant
"try"
"union"
"var"
"while"
"$alignof"
"$and"
"$append"
"$assert"
"$assignable"
"$case"
"$concat"
"$default"
"$defined"
"$echo"
"$else"
"$embed"
"$endfor"
"$endforeach"
"$endif"
"$endswitch"
"$eval"
"$evaltype"
"$error"
"$exec"
"$extnameof"
"$feature"
"$for"
"$foreach"
"$if"
"$include"
"$is_const"
"$nameof"
"$offsetof"
"$or"
"$qnameof"
"$sizeof"
"$stringify"
"$switch"
"$typefrom"
"$typeof"
"$vacount"
"$vatype"
"$vaconst"
"$varef"
"$vaarg"
"$vaexpr"
"$vasplat"))
(defvar c3-ts-mode--type-properties
;; From "c3c --list-type-properties"
'("alignof"
"associated"
"elements"
"extnameof"
"inf"
"is_eq"
"is_ordered"
"is_substruct"
"len"
"max"
"membersof"
"min"
"nan"
"inner"
"kindof"
"names"
"nameof"
"params"
"parentof"
"qnameof"
"returns"
"sizeof"
"values"
;; Extra token in grammar
"typeid"))
(defvar c3-ts-mode--operators
;; From "c3c --list-operators"
'("&"
"!"
"~"
"|"
"^"
":"
;; ","
;; ";"
"="
">"
"/"
"."
;; "#"
"<"
;; "{"
;; "["
;; "("
"-"
"%"
"+"
"?"
;; "}"
;; "]"
;; ")"
"*"
;; "_"
"&&"
;; "->"
"!!"
"&="
"|="
"^="
"/="
".."
"?:"
"=="
">="
"=>"
"<="
;; "{|"
;; "(<"
;; "[<"
"-="
"--"
"%="
"*="
"!="
"||"
"+="
"++"
;; "|}"
;; ">)"
;; ">]"
"??"
;; "::"
"<<"
">>"
"..."
"<<="
">>="))
(defvar c3-ts-mode--feature-list
`((comment definition)
(keyword string type)
;; TODO Not clear if assignment should go in level 4 or not (3 is the default level).
,(append
'(builtin attribute escape-sequence literal constant assembly module function)
(when c3-ts-mode-highlight-assignment '(assignment)))
,(append
'(type-property operator bracket)
(when c3-ts-mode-highlight-punctuation '(punctuation))
(when c3-ts-mode-highlight-variable '(variable))
(when c3-ts-mode-highlight-property '(property)))
;; (error) ;; Disabled by default
)
"`treesit-font-lock-feature-list' for `c3-ts-mode'.")
(defvar c3-ts-mode--font-lock-settings
;; NOTE Earlier rules have precedence over later rules
(treesit-font-lock-rules
:language 'c3
:feature 'comment
'((line_comment) @font-lock-comment-face
(block_comment) @font-lock-comment-face
(doc_comment) @font-lock-doc-face)
:language 'c3
:feature 'literal
'((integer_literal) @font-lock-number-face
(real_literal) @font-lock-number-face
(char_literal) @font-lock-constant-face
(bytes_literal) @font-lock-constant-face)
:language 'c3
:feature 'string
'((string_literal) @font-lock-string-face
(raw_string_literal) @font-lock-string-face)
:language 'c3
:feature 'escape-sequence
:override t
'((escape_sequence) @font-lock-escape-face)
:language 'c3
:feature 'keyword
`([,@c3-ts-mode--keywords] @font-lock-keyword-face)
:language 'c3
:feature 'builtin
'((builtin) @font-lock-builtin-face)
:language 'c3
:feature 'type-property
`((type_access_expr (access_ident [(ident) "typeid"] @font-lock-constant-face (:match ,(rx-to-string `(: bos (or ,@c3-ts-mode--type-properties) eos)) @font-lock-constant-face))))
:language 'c3
:feature 'constant
'((const_ident) @font-lock-constant-face
["true" "false" "null"] @font-lock-constant-face)
:language 'c3
:feature 'assembly
'((asm_instr [(ident) "int"] @font-lock-function-call-face)
(asm_expr [(ct_ident) (ct_const_ident)] @font-lock-variable-use-face))
:language 'c3
:feature 'module
`((module_resolution (ident) ,c3-ts-mode-module-path-face)
(module (path_ident (ident) ,c3-ts-mode-module-path-face))
(import_declaration (path_ident (ident) ,c3-ts-mode-module-path-face)))
:language 'c3
:feature 'attribute
'((attribute name: (_) @font-lock-builtin-face)
(define_attribute name: (_) @font-lock-builtin-face)
(call_inline_attributes (at_ident) @font-lock-builtin-face))
:language 'c3
:feature 'type
'((type_ident) @font-lock-type-face
(ct_type_ident) @font-lock-type-face
(base_type_name) @font-lock-type-face
;; TODO Probably don't want these
;; (type_suffix ["[" "[<" ">]" "]"] @font-lock-type-face)
;; (type "!" @font-lock-type-face :anchor)
)
:language 'c3
:feature 'definition
'((func_header name: (_) @font-lock-function-name-face)
(macro_header name: (_) @font-lock-function-name-face))
:language 'c3
:feature 'function
'((call_expr function: [(ident) (at_ident)] @font-lock-function-call-face)
(call_expr function: (module_ident_expr ident: (_) @font-lock-function-call-face))
(call_expr function: (trailing_generic_expr argument: (module_ident_expr ident: (_) @font-lock-function-call-face)))
(call_expr function: (field_expr field: (access_ident [(ident) (at_ident)] @font-lock-function-call-face))) ; NOTE Ambiguous, could be calling a method or function pointer
;; Method on type
(call_expr function: (type_access_expr field: (access_ident [(ident) (at_ident)] @font-lock-function-call-face))))
:language 'c3
:feature 'assignment
`((assignment_expr left: (ident) ,c3-ts-mode-assignment-face)
(assignment_expr left: (module_ident_expr (ident) ,c3-ts-mode-assignment-face))
(assignment_expr left: (field_expr field: (_) ,c3-ts-mode-assignment-face))
(assignment_expr left: (unary_expr operator: "*" ,c3-ts-mode-assignment-face))
(assignment_expr left: (subscript_expr ["[" "]"] ,c3-ts-mode-assignment-face))
(update_expr argument: (ident) ,c3-ts-mode-assignment-face)
(update_expr argument: (module_ident_expr ident: (ident) ,c3-ts-mode-assignment-face))
(update_expr argument: (field_expr field: (_) ,c3-ts-mode-assignment-face))
(update_expr argument: (unary_expr operator: "*" ,c3-ts-mode-assignment-face))
(update_expr argument: (subscript_expr ["[" "]"] ,c3-ts-mode-assignment-face))
(unary_expr operator: ["--" "++"] argument: (ident) ,c3-ts-mode-assignment-face)
(unary_expr operator: ["--" "++"] argument: (module_ident_expr (ident) ,c3-ts-mode-assignment-face))
(unary_expr operator: ["--" "++"] argument: (field_expr field: (access_ident (ident)) ,c3-ts-mode-assignment-face))
(unary_expr operator: ["--" "++"] argument: (subscript_expr ["[" "]"] ,c3-ts-mode-assignment-face)))
:language 'c3
:feature 'operator
`(([,@c3-ts-mode--operators]) @font-lock-operator-face)
:language 'c3
:feature 'property
'(;; Member
(field_expr field: (access_ident (ident) @font-lock-property-use-face))
(struct_member_declaration (ident) @font-lock-property-name-face)
(struct_member_declaration (identifier_list (ident) @font-lock-property-name-face))
(bitstruct_member_declaration (ident) @font-lock-property-name-face)
(initializer_list (arg (param_path (param_path_element (ident) @font-lock-property-name-face)))))
:language 'c3
:feature 'variable
'([(ident) (ct_ident)] @font-lock-variable-use-face
;; Parameter
(parameter name: (_) @font-lock-variable-name-face)
(call_invocation (call_arg name: (_) @font-lock-variable-name-face))
(enum_param_declaration (ident) @font-lock-variable-name-face)
;; Declaration
(global_declaration (ident) @font-lock-variable-name-face)
(local_decl_after_type name: [(ident) (ct_ident)] @font-lock-variable-name-face)
(var_decl name: [(ident) (ct_ident)] @font-lock-variable-name-face)
(try_unwrap (ident) @font-lock-variable-name-face)
(catch_unwrap (ident) @font-lock-variable-name-face))
:language 'c3
:feature 'bracket
'((["(" ")" "[" "]" "{" "}" "(<" ">)" "[<" ">]" "{|" "|}"]) @font-lock-bracket-face)
:language 'c3
:feature 'punctuation
'(([";" "," "::"]) @font-lock-punctuation-face)
:language 'c3
:feature 'error
:override t
'((ERROR) @font-lock-warning-face))
"Tree-sitter font-lock settings for `c3-ts-mode'.")
(defvar c3-ts-mode--simple-indent-rules
`((c3
((parent-is "source_file") column-0 0)
((node-is "else") parent-bol 0) ;; Also matches $else
((node-is "^\\(case\\|ct_case\\|default\\|ct_default\\)_stmt$") parent-bol c3-ts-mode-indent-offset)
((node-is "ct_stmt_body") parent-bol c3-ts-mode-indent-offset)
((parent-is "ct_stmt_body") standalone-parent 0)
((node-is "$endif") parent-bol 0)
((node-is "$endfor") parent-bol 0)
((node-is "$endswitch") parent-bol 0)
((and (parent-is "block_comment_text") c-ts-common-looking-at-star)
c-ts-common-comment-start-after-first-star -1)
((and (parent-is "doc_comment_text") c-ts-common-looking-at-star)
c-ts-common-comment-start-after-first-star -2)
(c-ts-common-comment-2nd-line-matcher
c-ts-common-comment-2nd-line-anchor 1)
((node-is "}") standalone-parent 0)
((node-is ")") standalone-parent 0)
((match "while" "do_stmt" nil nil nil) standalone-parent 0)
((match "compound_stmt" "else_part" nil nil nil) standalone-parent 0)
;; Attributes
((node-is "attributes") standalone-parent c3-ts-mode-indent-offset)
((parent-is "attributes") parent 0) ;; Align attributes on same column
;; Body/block children
((parent-is "enum_body") standalone-parent c3-ts-mode-indent-offset)
((parent-is "fault_body") standalone-parent c3-ts-mode-indent-offset)
((parent-is "struct_body") standalone-parent c3-ts-mode-indent-offset)
((parent-is "bitstruct_body") standalone-parent c3-ts-mode-indent-offset)
((parent-is "interface_body") standalone-parent c3-ts-mode-indent-offset)
((parent-is "macro_func_body") standalone-parent c3-ts-mode-indent-offset)
((parent-is "implies_body") standalone-parent c3-ts-mode-indent-offset)
((parent-is "compound_stmt") standalone-parent c3-ts-mode-indent-offset)
((parent-is "initializer_list") standalone-parent c3-ts-mode-indent-offset)
((parent-is "expr_block") standalone-parent c3-ts-mode-indent-offset)
((parent-is "case_stmt") standalone-parent c3-ts-mode-indent-offset)
((parent-is "default_stmt") standalone-parent c3-ts-mode-indent-offset)
;; if/switch/for/while/defer with block
((match "compound_stmt" "\\(if\\|switch\\|for\\|foreach\\|while\\|do\\|defer\\)_stmt" nil nil nil) standalone-parent 0)
;; for/while/defer without block
((parent-is "\\(for\\|foreach\\|while\\|defer\\)_stmt") standalone-parent c3-ts-mode-indent-offset)
;; Body not handled so far
((field-is "body") standalone-parent 0)
((field-is "lambda_body") standalone-parent 0)
;; Trailing macro block
((match "compound_stmt" nil "trailing" nil nil) parent 0)
;; Special rule: No indent for expr block (avoid double indented contents)
((match "expr_block" "local_decl_after_type" nil nil nil) parent-bol 0)
((match "expr_block" "assignment_expr" "right" nil nil) parent-bol 0)
((match nil "field_expr" "field" nil nil) parent-bol c3-ts-mode-indent-offset)
((n-p-gp "." "field_expr" nil) parent-bol c3-ts-mode-indent-offset) ;; Field access beginning with "."
((match nil "type_access_expr" "field" nil nil) parent-bol c3-ts-mode-indent-offset)
((match nil "assignment_expr" "right" nil nil) parent-bol c3-ts-mode-indent-offset)
((match nil "const_declaration" "right" nil nil) parent-bol c3-ts-mode-indent-offset)
((match nil "global_declaration" "right" nil nil) parent-bol c3-ts-mode-indent-offset)
;; Multi line declarations
((parent-is "identifier_list") parent 0)
((parent-is "multi_declaration") grand-parent c3-ts-mode-indent-offset)
((parent-is "local_decl_after_type") parent-bol c3-ts-mode-indent-offset)
((parent-is "for_cond") parent 1)
((parent-is "foreach_cond") parent 1)
((parent-is "paren_cond") parent 1)
((parent-is "catch_unwrap_list") parent 0)
((parent-is "comma_decl_or_expr") parent 0)
;; First parameter/argument
((match "^\\(call_\\)?arg\\|parameter\\|enum_param_declaration\\|trailing_block_param\\|attr_param$" nil nil 1 1) parent-bol c3-ts-mode-indent-offset)
;; Subsequent parameters/arguments
((match "^\\(call_\\)?arg\\|parameter\\|enum_param_declaration\\|trailing_block_param\\|attr_param$" nil nil 2 nil) (nth-sibling 1) 0)
;; String/bytes literals
((node-is "raw_string_literal") no-indent)
((match "string_literal" "string_expr" nil 0 0) parent 0)
((match "string_literal" "string_expr" nil 1 nil) (nth-sibling 0) 0)
((match "bytes_literal" "bytes_expr" nil 0 0) parent 0)
((match "bytes_literal" "bytes_expr" nil 1 nil) (nth-sibling 0) 0)
((parent-is "paren") parent 1)
((parent-is "binary") parent 0)
((parent-is "range") parent 0)
((parent-is "elvis_orelse") parent 0)
((parent-is "ternary") parent c3-ts-mode-indent-offset)
((parent-is "subscript") parent c3-ts-mode-indent-offset)
((parent-is "update") parent c3-ts-mode-indent-offset)
((parent-is "call") parent c3-ts-mode-indent-offset)
((parent-is "cast") parent c3-ts-mode-indent-offset)
((parent-is "func_declaration") standalone-parent 0)
((parent-is "func_header") standalone-parent 0)
((parent-is "macro_declaration") standalone-parent 0)
((parent-is "macro_header") standalone-parent 0)
((node-is "initializer_list") parent 0)
;; ((parent-is "ERROR") no-indent 0)
)))
(defun c3-ts-mode--defun-name (node)
"Return the name of the defun NODE."
(let ()
(treesit-node-text
(treesit-node-child-by-field-name
(pcase (treesit-node-type node)
("func_definition" (treesit-node-child node 1))
("macro_declaration" (treesit-node-child node 1))
(_ node))
"name")
t)))
;;;###autoload
(define-derived-mode c3-ts-mode prog-mode "C3"
"Major mode for editing C3 files, powered by tree-sitter."
:group 'c3-ts
:syntax-table c3-ts-mode--syntax-table
;; Comment
(c-ts-common-comment-setup)
;; Electric
(setq-local electric-indent-chars
(append "{}():;," electric-indent-chars))
(when (treesit-ready-p 'c3)
(treesit-parser-create 'c3)
;; Font-lock
(setq-local treesit-font-lock-settings c3-ts-mode--font-lock-settings)
(setq-local treesit-font-lock-feature-list c3-ts-mode--feature-list)
;; Indent
(setq-local treesit-simple-indent-rules c3-ts-mode--simple-indent-rules)
;; Navigation
(setq-local treesit-defun-name-function #'c3-ts-mode--defun-name)
(setq-local treesit-defun-type-regexp
`(,(rx bos
(or "struct_declaration"
"union_declaration"
"bitstruct_declaration"
"enum_declaration"
"fault_declaration"
"interface_declaration"
"func_definition"
"macro_declaration")
eos)))
;; Imenu
(setq-local treesit-simple-imenu-settings
`(("Struct" "\\`struct_declaration\\'" nil nil)
("Union" "\\`union_declaration\\'" nil nil)
("Bitstruct" "\\`bitstruct_declaration\\'" nil nil)
("Enum" "\\`enum_declaration\\'" nil nil)
("Fault" "\\`fault_declaration\\'" nil nil)
("Interface" "\\`interface_declaration\\'" nil nil)
("Function" "\\`func_definition\\'" nil nil)
("Macro" "\\`macro_declaration\\'" nil nil)))
;; Which-function
(setq-local which-func-functions (treesit-defun-at-point))
(treesit-major-mode-setup)))
(when (treesit-ready-p 'c3)
(add-to-list 'auto-mode-alist '("\\.c3\\'" . c3-ts-mode))
(add-to-list 'auto-mode-alist '("\\.c3i\\'" . c3-ts-mode))
(add-to-list 'auto-mode-alist '("\\.c3t\\'" . c3-ts-mode)))
(provide 'c3-ts-mode)
;;; c3-ts-mode.el ends here