File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 2
2
simple file with text
3
3
================================================================================
4
4
Simple text
5
+ <Del>
6
+ <CSI>
5
7
6
8
7
9
--------------------------------------------------------------------------------
@@ -10,7 +12,11 @@ Simple text
10
12
(block
11
13
(line
12
14
(word)
13
- (word))))
15
+ (word))
16
+ (line
17
+ (keycode))
18
+ (line
19
+ (keycode))))
14
20
15
21
================================================================================
16
22
multiline text
Original file line number Diff line number Diff line change
1
+ // https://tree-sitter.github.io/tree-sitter/creating-parsers#conflicting-tokens
2
+ // - Match Specificity: Tree-sitter will prefer a token that is specified in
3
+ // the grammar as a String instead of a RegExp.
4
+ // - Rule Order: Tree-sitter will prefer the token that appears earlier in the
5
+ // grammar.
6
+ //
1
7
// https://tree-sitter.github.io/tree-sitter/creating-parsers
2
8
// - Rules starting with underscore are hidden in the syntax tree.
3
9
@@ -50,6 +56,7 @@ module.exports = grammar({
50
56
$ . taglink ,
51
57
$ . codespan ,
52
58
$ . argument ,
59
+ $ . keycode ,
53
60
) ,
54
61
55
62
// Explicit special cases: these are plaintext, not errors.
@@ -71,6 +78,18 @@ module.exports = grammar({
71
78
/ \w + \( / ,
72
79
) ,
73
80
81
+ keycode : ( ) => choice (
82
+ / < [ - a - z A - Z 0 - 9 _ ] + > / ,
83
+ / < [ S C M A D ] - .> / ,
84
+ / C T R L - ./ ,
85
+ / C T R L - S H I F T - ./ ,
86
+ / C T R L - B r e a k / ,
87
+ / C T R L - ( P a g e U p | P a g e D o w n | I n s e r t | D e l ) / ,
88
+ / C T R L - \{ c h a r \} / ,
89
+ / M E T A - ./ ,
90
+ / A L T - ./ ,
91
+ ) ,
92
+
74
93
// First part (minus tags) of h3 or column_heading.
75
94
uppercase_name : ( ) => seq (
76
95
token . immediate ( _uppercase_word ) , // No whitespace before heading.
You can’t perform that action at this time.
0 commit comments