Skip to content

Commit

Permalink
feat: hide unnecessary nodes from the AST
Browse files Browse the repository at this point in the history
  • Loading branch information
vhyrro committed Oct 30, 2021
1 parent 89202c8 commit 4649fe1
Show file tree
Hide file tree
Showing 6 changed files with 139,002 additions and 111,679 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ BasedOnStyle: Chromium
UseTab: Never
IndentWidth: 4
IndentCaseLabels: false
ColumnLimit: 150
ColumnLimit: 100

BreakBeforeBraces: Allman
AllowShortIfStatementsOnASingleLine: Never
Expand Down
54 changes: 27 additions & 27 deletions grammar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Known bugs:
* Segments get displayed, we should hide them from the grammar
* Fairly incomplete errors related to incomplete modifiers (ones that do not form a pair)
* Idk whether the above issue is even fixable with TreeSitter's limitations
*/

module.exports = grammar({
Expand Down Expand Up @@ -198,6 +199,7 @@ module.exports = grammar({
alias($.space, "_space"),
$.link,
$.escape_sequence,
$._attached_modifier,
),
)
),
Expand All @@ -208,8 +210,6 @@ module.exports = grammar({
choice(
$.paragraph_segment,
$._line_break,

$._attached_modifier,
)
)
),
Expand All @@ -219,9 +219,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.bold_segment,
alias($.bold_segment, "_segment"),
seq(
$.bold_segment_with_nest,
alias($.bold_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -234,7 +234,7 @@ module.exports = grammar({
$.inline_comment,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand All @@ -245,9 +245,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.italic_segment,
alias($.italic_segment, "_segment"),
seq(
$.italic_segment_with_nest,
alias($.italic_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -260,7 +260,7 @@ module.exports = grammar({
$.inline_comment,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand All @@ -271,9 +271,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.strikethrough_segment,
alias($.strikethrough_segment, "_segment"),
seq(
$.strikethrough_segment_with_nest,
alias($.strikethrough_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -286,7 +286,7 @@ module.exports = grammar({
$.inline_comment,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand All @@ -297,9 +297,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.underline_segment,
alias($.underline_segment, "_segment"),
seq(
$.underline_segment_with_nest,
alias($.underline_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -312,7 +312,7 @@ module.exports = grammar({
$.inline_comment,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand All @@ -323,9 +323,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.spoiler_segment,
alias($.spoiler_segment, "_segment"),
seq(
$.spoiler_segment_with_nest,
alias($.spoiler_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -338,7 +338,7 @@ module.exports = grammar({
$.inline_comment,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand All @@ -349,9 +349,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.superscript_segment,
alias($.superscript_segment, "_segment"),
seq(
$.superscript_segment_with_nest,
alias($.superscript_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -363,7 +363,7 @@ module.exports = grammar({
$.inline_comment,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand All @@ -374,9 +374,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.subscript_segment,
alias($.subscript_segment, "_segment"),
seq(
$.subscript_segment_with_nest,
alias($.subscript_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -388,7 +388,7 @@ module.exports = grammar({
$.inline_comment,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand All @@ -399,9 +399,9 @@ module.exports = grammar({
prec.right(0,
repeat1(
choice(
$.inline_comment_segment,
alias($.inline_comment_segment, "_segment"),
seq(
$.inline_comment_segment_with_nest,
alias($.inline_comment_segment_with_nest, "_segment"),
seq(
repeat1(
choice(
Expand All @@ -414,7 +414,7 @@ module.exports = grammar({
$.subscript,
),
),
$.markup_end,
alias($.markup_end, "_end"),
)
),
),
Expand Down
Loading

0 comments on commit 4649fe1

Please sign in to comment.