File tree Expand file tree Collapse file tree 3 files changed +89
-3
lines changed
Expand file tree Collapse file tree 3 files changed +89
-3
lines changed Original file line number Diff line number Diff line change 66//! ```
77//! let code = "";
88//! let mut parser = tree_sitter::Parser::new();
9- //! parser.set_language(tree_sitter_go_template::language()).expect("Error loading YOUR_LANGUAGE_NAME grammar");
9+ //! parser.set_language(tree_sitter_go_template::language()).expect("Error loading go-template grammar");
1010//! let tree = parser.parse(code, None).unwrap();
1111//! ```
1212//!
Original file line number Diff line number Diff line change 1919 "scripts" : {
2020 "build" : " tree-sitter generate && node-gyp build" ,
2121 "test" : " tree-sitter test" ,
22- "parse" : " tree-sitter parse"
23- }
22+ "parse" : " tree-sitter parse" ,
23+ "highlight" : " tree-sitter highlight"
24+ },
25+ "tree-sitter" : [
26+ {
27+ "scope" : " source.gotexttmpl" ,
28+ "file-types" : [
29+ " gotexttmpl" ,
30+ " gohtmltmpl" ,
31+ " gotmpl"
32+ ]
33+ }
34+ ]
2435}
Original file line number Diff line number Diff line change 1+ ; Identifiers
2+
3+ [
4+ (field)
5+ (field_identifier)
6+ ] @property
7+
8+ (variable) @variable
9+
10+ ; Function calls
11+
12+ (function_call
13+ function: (identifier) @function )
14+
15+ (method_call
16+ method: (selector_expression
17+ field: (field_identifier) @function ))
18+
19+ ; Operators
20+
21+ "|" @operator
22+ ":=" @operator
23+
24+ ; Builtin functions
25+
26+ ((identifier) @function.builtin
27+ (#match? @function.builtin "^(and|call|html|index|slice|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|ge|gt|ge)$"))
28+
29+ ; Delimiters
30+
31+ "." @punctuation.delimiter
32+ "," @punctuation.delimiter
33+
34+ "{{" @punctuation.bracket
35+ "}}" @punctuation.bracket
36+ "{{-" @punctuation.bracket
37+ "-}}" @punctuation.bracket
38+ ")" @punctuation.bracket
39+ "(" @punctuation.bracket
40+
41+ ; Keywords
42+
43+ "else" @keyword
44+ "if" @keyword
45+ "range" @keyword
46+ "with" @keyword
47+ "end" @keyword
48+ "template" @keyword
49+ "define" @keyword
50+ "block" @keyword
51+
52+ ; Literals
53+
54+ [
55+ (interpreted_string_literal)
56+ (raw_string_literal)
57+ (rune_literal)
58+ ] @string
59+
60+ (escape_sequence) @string.special
61+
62+ [
63+ (int_literal)
64+ (float_literal)
65+ (imaginary_literal)
66+ ] @number
67+
68+ [
69+ (true)
70+ (false)
71+ (nil)
72+ ] @constant.builtin
73+
74+ (comment) @comment
75+ (ERROR) @error
You can’t perform that action at this time.
0 commit comments