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 22simple file with text
33================================================================================
44Simple text
5+ <Del> <CSI> <C-S-x> <C-x> <M-^> <x-y>
6+ CTRL-{char} ctr-z CTRL-SHIFT-\ CTRL-+ CTRL-Break ALT-?
57
68
79--------------------------------------------------------------------------------
@@ -10,7 +12,21 @@ Simple text
1012 (block
1113 (line
1214 (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))))
1430
1531================================================================================
1632multiline 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+ //
17// https://tree-sitter.github.io/tree-sitter/creating-parsers
28// - Rules starting with underscore are hidden in the syntax tree.
39
@@ -50,6 +56,7 @@ module.exports = grammar({
5056 $ . taglink ,
5157 $ . codespan ,
5258 $ . argument ,
59+ $ . keycode ,
5360 ) ,
5461
5562 // Explicit special cases: these are plaintext, not errors.
@@ -71,6 +78,17 @@ module.exports = grammar({
7178 / \w + \( / ,
7279 ) ,
7380
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 | P a g e U p | P a g e D o w n | I n s e r t | D e l ) / ,
87+ / C T R L - \{ c h a r \} / ,
88+ / M E T A - ./ ,
89+ / A L T - ./ ,
90+ ) ,
91+
7492 // First part (minus tags) of h3 or column_heading.
7593 uppercase_name : ( ) => seq (
7694 token . immediate ( _uppercase_word ) , // No whitespace before heading.
You can’t perform that action at this time.
0 commit comments