22//
33// For more information see README.md
44
5- /// <reference types="tree-sitter-cli/dsl" />
6-
75const common = require ( '../common/common' ) ;
86
97// key_value defs are in common.js
@@ -86,36 +84,18 @@ module.exports = grammar(add_inline_rules({
8684 $ . _unclosed_span
8785 ] ,
8886 precedences : $ => [
89- // [$._strong_emphasis_star, $._inline_element_no_star],
9087 [ $ . _strong_emphasis_star_no_link , $ . _inline_element_no_star_no_link ] ,
91- // [$._strong_emphasis_underscore, $._inline_element_no_underscore],
9288 [ $ . _strong_emphasis_underscore_no_link , $ . _inline_element_no_underscore_no_link ] ,
9389 [ $ . hard_line_break , $ . _whitespace ] ,
9490 [ $ . hard_line_break , $ . _text_base ] ,
9591 ] ,
9692 // More conflicts are defined in `add_inline_rules`
9793 conflicts : $ => [
9894
99- [ $ . _link_text_non_empty , $ . _inline_element ] ,
100- [ $ . _link_text_non_empty , $ . _inline_element_no_star ] ,
101- [ $ . _link_text_non_empty , $ . _inline_element_no_underscore ] ,
10295 [ $ . _link_text_non_empty , $ . _inline_element_no_tilde ] ,
103- [ $ . _link_text , $ . _inline_element ] ,
104- [ $ . _link_text , $ . _inline_element_no_star ] ,
105- [ $ . _link_text , $ . _inline_element_no_underscore ] ,
10696 [ $ . _link_text , $ . _inline_element_no_tilde ] ,
107-
108- [ $ . _image_description , $ . _image_description_non_empty , $ . _text_base ] ,
109- // [$._image_description, $._image_description_non_empty, $._text_inline],
110- // [$._image_description, $._image_description_non_empty, $._text_inline_no_star],
111- // [$._image_description, $._image_description_non_empty, $._text_inline_no_underscore],
112-
113- // [$._image_shortcut_link, $._image_description],
114- // [$.shortcut_link, $._link_text],
11597 [ $ . link_destination , $ . link_title ] ,
11698 [ $ . _link_destination_parenthesis , $ . link_title ] ,
117-
118- [ $ . commonmark_attribute , $ . language_attribute ] ,
11999 [ $ . _shortcode_value , $ . shortcode_keyword_param ] ,
120100 ] ,
121101 extras : $ => [ ] ,
@@ -472,31 +452,19 @@ function add_inline_rules(grammar) {
472452 alias ( $ [ '_emphasis_underscore' + suffix_link ] , $ . emphasis ) ,
473453 alias ( $ [ '_strong_emphasis_underscore' + suffix_link ] , $ . strong_emphasis ) ,
474454 ] ;
475- // elements.push(alias($['_strikeout' + suffix_link], $.strikeout));
476455 if ( delimiter !== "star" ) {
477456 elements . push ( $ . _emphasis_open_star ) ;
478457 }
479458 if ( delimiter !== "underscore" ) {
480459 elements . push ( $ . _emphasis_open_underscore ) ;
481460 }
482- // if (delimiter !== "tilde") {
483- // elements.push($._strikeout_open);
484- // }
485461 if ( link ) {
486462 elements = elements . concat ( [
487463 $ . inline_link ,
488- // seq(choice('[', ']'), optional($._last_token_punctuation)),
489464 ] ) ;
490465 }
491466 return choice ( ...elements ) ;
492467 } ;
493- // if (suffix === "") {
494- // grammar.rules["_inline"] = $ => prec.left(1, seq(
495- // repeat1($._inline_element),
496- // optional(seq($._whitespace, $._qmd_attribute))));
497- // } else {
498- // grammar.rules["_inline" + suffix] = $ => repeat1($["_inline_element" + suffix]);
499- // }
500468 grammar . rules [ "_inline" + suffix ] = $ => repeat1 ( $ [ "_inline_element" + suffix ] ) ;
501469 if ( delimiter !== "star" ) {
502470 conflicts . push ( [ '_emphasis_star' + suffix_link , '_inline_element' + suffix_delimiter + suffix_link ] ) ;
@@ -509,12 +477,8 @@ function add_inline_rules(grammar) {
509477 conflicts . push ( [ '_emphasis_underscore' + suffix_link , '_inline_element' + suffix_delimiter + suffix_link ] ) ;
510478 conflicts . push ( [ '_emphasis_underscore' + suffix_link , '_strong_emphasis_underscore' + suffix_link , '_inline_element' + suffix_delimiter + suffix_link ] ) ;
511479 }
512- // if (delimiter !== "tilde") {
513- // conflicts.push(['_strikeout' + suffix_link, '_inline_element' + suffix_delimiter + suffix_link]);
514- // }
515480 }
516481
517- // grammar.rules['_strikeout' + suffix_link] = $ => prec.dynamic(PRECEDENCE_LEVEL_EMPHASIS, seq(alias($._strikeout_open, $.strikeout_delimiter), optional($._last_token_punctuation), $['_inline' + '_no_tilde' + suffix_link], alias($._strikeout_close, $.strikeout_delimiter)));
518482 grammar . rules [ '_emphasis_star' + suffix_link ] = $ => prec . dynamic ( PRECEDENCE_LEVEL_EMPHASIS , seq ( alias ( $ . _emphasis_open_star , $ . emphasis_delimiter ) , optional ( $ . _last_token_punctuation ) , $ [ '_inline' + '_no_star' + suffix_link ] , alias ( $ . _emphasis_close_star , $ . emphasis_delimiter ) ) ) ;
519483 grammar . rules [ '_strong_emphasis_star' + suffix_link ] = $ => prec . dynamic ( 2 * PRECEDENCE_LEVEL_EMPHASIS , seq ( alias ( $ . _emphasis_open_star , $ . emphasis_delimiter ) , $ [ '_emphasis_star' + suffix_link ] , alias ( $ . _emphasis_close_star , $ . emphasis_delimiter ) ) ) ;
520484 grammar . rules [ '_emphasis_underscore' + suffix_link ] = $ => prec . dynamic ( PRECEDENCE_LEVEL_EMPHASIS , seq ( alias ( $ . _emphasis_open_underscore , $ . emphasis_delimiter ) , optional ( $ . _last_token_punctuation ) , $ [ '_inline' + '_no_underscore' + suffix_link ] , alias ( $ . _emphasis_close_underscore , $ . emphasis_delimiter ) ) ) ;
0 commit comments