Skip to content

Commit 9a25e4a

Browse files
committed
feat(inline): better struct
Signed-off-by: loongtao.zhang <[email protected]>
1 parent 5993be0 commit 9a25e4a

25 files changed

+4439
-3660
lines changed

tree-sitter-loongdoc_inline/grammar.js

+22-23
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,26 @@ module.exports = grammar({
1616
],
1717

1818
rules: {
19-
inline: $ =>
20-
repeat1(
21-
choice(
22-
$.replacement,
23-
$._word,
24-
$.autolink,
25-
$.passthrough,
26-
$.inline_passthrough,
27-
$._punctuation,
28-
$.xref,
29-
$.emphasis,
30-
$.ltalic,
31-
$.monospace,
32-
$.highlight,
33-
$.inline_macro,
34-
$.stem_macro,
35-
$.footnote,
36-
$.index_term,
37-
$.index_term2,
38-
$.id_assignment,
39-
),
19+
inline: $ => repeat($.inline_element),
20+
inline_element: $ =>
21+
choice(
22+
$.replacement,
23+
$._word,
24+
$.autolink,
25+
$.passthrough,
26+
$.macro_passthrough,
27+
$._punctuation,
28+
$.xref,
29+
$.emphasis,
30+
$.ltalic,
31+
$.monospace,
32+
$.highlight,
33+
$.inline_macro,
34+
$.stem_macro,
35+
$.footnote,
36+
$.index_term,
37+
$.index_term2,
38+
$.id_assignment,
4039
),
4140
...autolink.rules,
4241
id_assignment: $ => choice(seq('[#', $.id, ']'), seq('[[', $.id, ']]')),
@@ -108,7 +107,7 @@ module.exports = grammar({
108107
$.replacement,
109108
$.escaped_sequence,
110109
$.passthrough,
111-
$.inline_passthrough,
110+
$.macro_passthrough,
112111
),
113112
),
114113
attr: $ =>
@@ -143,7 +142,7 @@ module.exports = grammar({
143142
optional(alias($._stem_attr, $.attr)),
144143
']',
145144
),
146-
inline_passthrough: $ =>
145+
macro_passthrough: $ =>
147146
seq(
148147
'pass',
149148
token.immediate(':'),

tree-sitter-loongdoc_inline/src/grammar.json

+78-74
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tree-sitter-loongdoc_inline/src/node-types.json

+37-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)