File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-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> <CSI> <C-S-x> <C-x> <M-^> <x-y>
6
+ CTRL-{char} ctr-z CTRL-SHIFT-\ CTRL-+ CTRL-Break ALT-?
5
7
6
8
7
9
--------------------------------------------------------------------------------
@@ -10,7 +12,21 @@ Simple text
10
12
(block
11
13
(line
12
14
(word)
13
- (word))))
15
+ (word))
16
+ (line
17
+ (keycode)
18
+ (keycode)
19
+ (keycode)
20
+ (keycode)
21
+ (keycode)
22
+ (keycode))
23
+ (line
24
+ (keycode)
25
+ (word)
26
+ (keycode)
27
+ (keycode)
28
+ (keycode)
29
+ (keycode))))
14
30
15
31
================================================================================
16
32
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,17 @@ module.exports = grammar({
71
78
/\w+\(/,
72
79
),
73
80
81
+ keycode: () => choice(
82
+ /<[-a-zA-Z0-9_]+>/,
83
+ /<[SCMAD]-.>/,
84
+ /CTRL-./,
85
+ /CTRL-SHIFT-./,
86
+ /CTRL-(Break|PageUp|PageDown|Insert|Del)/,
87
+ /CTRL-\{char\}/,
88
+ /META-./,
89
+ /ALT-./,
90
+ ),
91
+
74
92
// First part (minus tags) of h3 or column_heading.
75
93
uppercase_name: () => seq(
76
94
token.immediate(_uppercase_word), // No whitespace before heading.
You can’t perform that action at this time.
0 commit comments