fix!: long (paragraph)s now parse as a single (paragraph), resolve #8

breaking: Newline characters after the last element of the (body),
before the next (section) are now part of (body).
This commit is contained in:
Emilia Simmons 2021-11-01 23:28:35 -04:00
parent dda23ecf90
commit 39a377f507
5 changed files with 59136 additions and 61093 deletions

View file

@ -443,6 +443,25 @@ a
(body (paragraph) (paragraph))
)
==============
Paragraph.6 - Long paragraph
==============
a
a
a
a
a
a
a
a
a
a
a
a
----------
(document (body (paragraph)))
==============
Timestamp.1 - Basic
==============
@ -626,7 +645,7 @@ a
==========
Drawer.3 - Junk
==========
:l 1
:l
----------
(document (body (paragraph)))
@ -758,6 +777,51 @@ words
(document (body (fndef)))
=============
Footnote.5a -
=============
[fn:a] b
a
----------
(document (body (fndef)))
=============
Footnote.5b -
=============
a
[fn:a] b
----------
(document (body
(paragraph
(footnote))
))
=============
Footnote.5c -
=============
a
[fn:a] b
----------
(document (body
(paragraph)
(fndef)
))
=============
Footnote.5d -
=============
[fn:a] b
:a:
:end:
----------
(document (body (fndef) (drawer)))
==========
Comment.1
==========
@ -1658,41 +1722,7 @@ a
))
=============
Combined.6a -
=============
[fn:a] b
a
----------
(document (body (fndef)))
=============
Combined.6b -
=============
a
[fn:a] b
----------
(document (body
(paragraph
(footnote))
))
=============
Combined.6c -
=============
a
[fn:a] b
----------
(document (body
(paragraph)
(fndef)
))
=============
Combined.7 -
Combined.6 -
=============
a
:AB:

View file

@ -7,11 +7,12 @@ DYN = {
}
org_grammar = {
// Externals, inline =================================== {{{1
name: 'org',
// Treat newlines explicitly, all other whitespace is extra
extras: _ => [/[ \f\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/],
// Externals =========================================== {{{1
externals: $ => [
$._liststart,
$._listend,
@ -23,78 +24,91 @@ org_grammar = {
$._eof, // Basically just '\0', but allows multiple to be matched
],
// Inline ============================================== {{{1
inline: $ => [
$._nl,
$._eol,
$._body_body,
$._ts_contents,
$._ts_contents_range,
$._docbody,
$._directive_list,
$._fnref_label,
$._fnref_definition,
$._start_of_paragraph,
$._start_of_textline,
],
// Precedences, conflict =============================== {{{1
// Precedences ========================================= {{{1
precedences: _ => [
['fn_definition', 'footnote'],
['document_directive', 'body_directive'],
],
// Conflicts =========================================== {{{1
conflicts: $ => [
[$.description, $._textelement], // textelement in $.itemtext
[$.item], // :tags: in headlines
[$.item], // :tags: in headlines
// Markup
[$._conflicts, $.markup],
// Multiline -- continue the item or start a new one?
[$.body],
[$.paragraph],
[$.fndef],
// Subscript and underlines
[$._textelement, $.subscript, $._conflicts],
// Unresolved markup: _markup '*' • '_active_start' …
// Unfinished markup is not an error
[$._te_conflicts, $.markup],
// Subscript and underlines: _markup '_' _text • '_' …
[$._textelement, $.subscript, $._te_conflicts],
],
rules: {
// Document, sections, body, & paragraph =============== {{{1
// Document ============================================ {{{1
// prec over body -> element for directive list
document: $ => prec(1, seq(
document: $ => prec('document_directive', seq(
optional(choice(
$._directive_list, // required in combination with:
seq($._directive_list, $._eof), // equal precedence with _element
seq($._directive_list, repeat(prec('document_directive', $._nl))),
seq(repeat($._nl), $.body),
seq($._directive_list, repeat1($._nl), $.body),
seq($._directive_list, $._nl, $.body),
repeat1($._nl),
)),
repeat($._nl),
repeat($.section),
)),
_nl: _ => choice('\n', '\r'),
_eol: $ => choice('\n', '\r', $._eof),
// Body ================================================ {{{1
// Set up to prevent lexing conflicts of having two paragraphs in a row
body: $ => prec('body_directive', choice(
seq($._body_body, optional(choice($.paragraph, $._directive_list))),
seq(choice($.paragraph, $._directive_list)),
)),
_body_body: $ => repeat1(prec('body_directive', seq(
choice(
seq($.paragraph, $._nl),
seq($._directive_list, $._nl),
seq(optional($.paragraph), $._element),
),
prec('body_directive', repeat($._nl)),
))),
// Section ============================================= {{{1
section: $ => seq(
$.headline, $._eol,
optional(seq($.plan)),
optional(seq($.property_drawer)),
optional($.plan),
optional($.property_drawer),
repeat($._nl),
optional(seq($.body, repeat($._nl))),
optional($.body),
repeat($.section),
$._sectionend,
),
body: $ => choice(
seq(sep1($._element, repeat($._nl))),
seq(sep1($._element, repeat($._nl)), $._directive_list),
$._directive_list,
), // the directive list + choice Solves Directive.7
// Element and textelement ============================= {{{1
// Element ============================================= {{{1
_element: $ => choice(
seq($._directive_list, $._eof),
$.comment,
// Have attached directive
$.paragraph,
// Have attached directive:
$.fndef,
$.drawer,
$.list,
@ -104,9 +118,11 @@ org_grammar = {
$.latex_env,
),
// Textelement ========================================= {{{1
_textelement: $ => choice(
$._text,
$._conflicts,
$._te_conflicts,
$.timestamp,
$.footnote,
@ -120,12 +136,42 @@ org_grammar = {
// Paragraph =========================================== {{{1
// Prec prefers one paragraph over multiple for multi-line
paragraph: $ => prec.dynamic(DYN.multiline, seq(
paragraph: $ => prec.right(seq(
optional($._directive_list),
repeat1(seq(repeat1($._textelement), $._eol)),
$._start_of_paragraph, repeat($._textelement), $._eol,
repeat(seq($._start_of_textline, repeat($._textelement), $._eol)),
)),
_start_of_paragraph: $ => choice(
$._sol_conflicts,
$._te_conflicts,
$._text,
$.timestamp,
$.link,
$.markup,
$.subscript,
$.superscript,
$.latex_fragment,
),
_start_of_textline: $ => choice(
$._sol_conflicts,
$._te_conflicts,
$._text,
$.timestamp,
$.footnote,
$.link,
$.markup,
$.subscript,
$.superscript,
$.latex_fragment,
),
// Headlines =========================================== {{{1
headline: $ => seq(
@ -334,30 +380,30 @@ org_grammar = {
// Footnote ============================================ {{{1
_fn_label: _ => /[\p{L}\p{N}_-]+/,
_fn: _ => caseInsensitive('[fn:'),
_fn_textline: $ => prec.right(repeat1(seq(repeat1($._textelement), $._eol))),
_fn: $ => caseInsensitive('[fn:'),
fndef: $ => prec('fn_definition',
fndef: $ => seq(
optional($._directive_list),
seq(
optional($._directive_list),
$._fn,
$._fn_label,
']',
repeat1(seq(repeat1($._textelement), $._eol)),
)),
/[\p{L}\p{N}_-]+/,
']'
),
$._fn_textline
),
footnote: $ => prec('footnote', seq(
footnote: $ => seq(
$._fn,
choice(
$._fn_label,
seq(':', sep1(repeat1($._textelement), $._nl)),
seq(
optional($._fn_label),
token.immediate(':'),
sep1(repeat1($._textelement), $._eol)
/[\p{L}\p{N}_-]+/,
optional(seq(':', sep1(repeat1($._textelement), $._nl)))
),
),
']',
)),
']'
),
// Directive & Comment ================================= {{{1
@ -375,7 +421,6 @@ org_grammar = {
// Drawer ============================================== {{{1
// precedence over :
drawer: $ => seq(
optional($._directive_list),
$._drawer_begin,
@ -384,9 +429,8 @@ org_grammar = {
$._drawer_end,
),
_drawer_begin: $ => seq(':', $._drawername, token.immediate(':'), $._nl),
_drawer_begin: $ => seq(/:[\p{L}\p{N}\p{Pd}\p{Pc}]+:/, $._nl),
_drawer_end: $ => seq(caseInsensitive(':END:'), $._eol),
_drawername: _ => token.immediate(/[\p{L}\p{N}\p{Pd}\p{Pc}]+/),
// Block =============================================== {{{1
@ -511,16 +555,19 @@ org_grammar = {
/[^\p{Z}\p{L}\p{N}\n\r]/, // Everything else, minus whitespace
),
_conflicts: $ => prec.dynamic(DYN.conflicts, choice(
_te_conflicts: $ => prec.dynamic(DYN.conflicts, choice(
$._active_start,
$._inactive_start,
seq($._markup, choice('*', '/', '_', '+', '~', '=', '`')),
seq(':', optional($._drawername)),
seq('\\', /[^\p{L}]+/),
seq($._text, '^', /[^{]/),
seq('$', token.immediate(/[^\p{Z}\n\r$]+/)),
// seq($._text, '^', /[^{]/),
seq($._text, token.immediate('_'), token.immediate(/[^\p{Z}]/))
seq($._text, token.immediate('_'), token.immediate(/[^\p{Z}]/)),
)),
_sol_conflicts: $ => prec.dynamic(DYN.conflicts, choice(
/:[\p{L}\p{N}\p{Pd}\p{Pc}]+/,
seq('\\', /[^\p{L}]+/),
)),
contents: $ => seq(
@ -529,18 +576,18 @@ org_grammar = {
),
}
};
}; // }}}
function sep1(rule, separator) { // {{{1
function sep1(rule, separator) { // === {{{1
return seq(rule, repeat(seq(separator, rule)))
}
function caseInsensitive(str) { // {{{1
function caseInsensitive(str) { // === {{{1
return new RegExp(str
.split('')
.map(caseInsensitiveChar)
.join('')
)
.split('')
.map(caseInsensitiveChar)
.join('')
)
}
function caseInsensitiveChar(char) {
@ -550,4 +597,3 @@ function caseInsensitiveChar(char) {
// }}}
module.exports = grammar(org_grammar);
// vim: set fm=marker sw=2

View file

@ -3,7 +3,7 @@
"rules": {
"document": {
"type": "PREC",
"value": 1,
"value": "document_directive",
"content": {
"type": "SEQ",
"members": [
@ -13,10 +13,6 @@
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_directive_list"
},
{
"type": "SEQ",
"members": [
@ -25,8 +21,15 @@
"name": "_directive_list"
},
{
"type": "SYMBOL",
"name": "_eof"
"type": "REPEAT",
"content": {
"type": "PREC",
"value": "document_directive",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
}
]
},
@ -54,17 +57,21 @@
"name": "_directive_list"
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
"type": "SYMBOL",
"name": "_nl"
},
{
"type": "SYMBOL",
"name": "body"
}
]
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
]
},
@ -73,13 +80,6 @@
}
]
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
},
{
"type": "REPEAT",
"content": {
@ -120,6 +120,138 @@
}
]
},
"body": {
"type": "PREC",
"value": "body_directive",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_body_body"
},
{
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "paragraph"
},
{
"type": "SYMBOL",
"name": "_directive_list"
}
]
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "paragraph"
},
{
"type": "SYMBOL",
"name": "_directive_list"
}
]
}
]
}
]
}
},
"_body_body": {
"type": "REPEAT1",
"content": {
"type": "PREC",
"value": "body_directive",
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "paragraph"
},
{
"type": "SYMBOL",
"name": "_nl"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_directive_list"
},
{
"type": "SYMBOL",
"name": "_nl"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "paragraph"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_element"
}
]
}
]
},
{
"type": "PREC",
"value": "body_directive",
"content": {
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
}
]
}
}
},
"section": {
"type": "SEQ",
"members": [
@ -135,13 +267,8 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "plan"
}
]
"type": "SYMBOL",
"name": "plan"
},
{
"type": "BLANK"
@ -152,13 +279,8 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "property_drawer"
}
]
"type": "SYMBOL",
"name": "property_drawer"
},
{
"type": "BLANK"
@ -176,20 +298,8 @@
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "body"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
}
]
"type": "SYMBOL",
"name": "body"
},
{
"type": "BLANK"
@ -209,109 +319,13 @@
}
]
},
"body": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_element"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
},
{
"type": "SYMBOL",
"name": "_element"
}
]
}
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_element"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_nl"
}
},
{
"type": "SYMBOL",
"name": "_element"
}
]
}
}
]
},
{
"type": "SYMBOL",
"name": "_directive_list"
}
]
},
{
"type": "SYMBOL",
"name": "_directive_list"
}
]
},
"_element": {
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_directive_list"
},
{
"type": "SYMBOL",
"name": "_eof"
}
]
},
{
"type": "SYMBOL",
"name": "comment"
},
{
"type": "SYMBOL",
"name": "paragraph"
},
{
"type": "SYMBOL",
"name": "fndef"
@ -351,7 +365,7 @@
},
{
"type": "SYMBOL",
"name": "_conflicts"
"name": "_te_conflicts"
},
{
"type": "SYMBOL",
@ -384,8 +398,8 @@
]
},
"paragraph": {
"type": "PREC_DYNAMIC",
"value": -1,
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
@ -402,12 +416,31 @@
]
},
{
"type": "REPEAT1",
"type": "SYMBOL",
"name": "_start_of_paragraph"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
},
{
"type": "SYMBOL",
"name": "_eol"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"type": "SYMBOL",
"name": "_start_of_textline"
},
{
"type": "REPEAT",
"content": {
"type": "SYMBOL",
"name": "_textelement"
@ -423,6 +456,92 @@
]
}
},
"_start_of_paragraph": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_sol_conflicts"
},
{
"type": "SYMBOL",
"name": "_te_conflicts"
},
{
"type": "SYMBOL",
"name": "_text"
},
{
"type": "SYMBOL",
"name": "timestamp"
},
{
"type": "SYMBOL",
"name": "link"
},
{
"type": "SYMBOL",
"name": "markup"
},
{
"type": "SYMBOL",
"name": "subscript"
},
{
"type": "SYMBOL",
"name": "superscript"
},
{
"type": "SYMBOL",
"name": "latex_fragment"
}
]
},
"_start_of_textline": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_sol_conflicts"
},
{
"type": "SYMBOL",
"name": "_te_conflicts"
},
{
"type": "SYMBOL",
"name": "_text"
},
{
"type": "SYMBOL",
"name": "timestamp"
},
{
"type": "SYMBOL",
"name": "footnote"
},
{
"type": "SYMBOL",
"name": "link"
},
{
"type": "SYMBOL",
"name": "markup"
},
{
"type": "SYMBOL",
"name": "subscript"
},
{
"type": "SYMBOL",
"name": "superscript"
},
{
"type": "SYMBOL",
"name": "latex_fragment"
}
]
},
"headline": {
"type": "SEQ",
"members": [
@ -1826,146 +1945,185 @@
"type": "PATTERN",
"value": "[^\\]]*"
},
"_fn_label": {
"type": "PATTERN",
"value": "[\\p{L}\\p{N}_-]+"
"_fn_textline": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
},
{
"type": "SYMBOL",
"name": "_eol"
}
]
}
}
},
"_fn": {
"type": "PATTERN",
"value": "\\[[Ff][Nn]:"
},
"fndef": {
"type": "PREC",
"value": "fn_definition",
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_directive_list"
},
{
"type": "BLANK"
}
]
},
{
"type": "SYMBOL",
"name": "_fn"
},
{
"type": "SYMBOL",
"name": "_fn_label"
},
{
"type": "STRING",
"value": "]"
},
{
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_directive_list"
},
{
"type": "BLANK"
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_fn"
},
{
"type": "PATTERN",
"value": "[\\p{L}\\p{N}_-]+"
},
{
"type": "STRING",
"value": "]"
}
]
},
{
"type": "SYMBOL",
"name": "_fn_textline"
}
]
},
"footnote": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_fn"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "_eol"
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_nl"
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
}
]
}
}
]
}
]
}
}
]
}
},
"footnote": {
"type": "PREC",
"value": "footnote",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_fn"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_fn_label"
},
{
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_fn_label"
},
{
"type": "BLANK"
}
]
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": ":"
}
},
{
"type": "SEQ",
"members": [
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
},
{
"type": "REPEAT",
"content": {
},
{
"type": "SEQ",
"members": [
{
"type": "PATTERN",
"value": "[\\p{L}\\p{N}_-]+"
},
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ":"
},
{
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_eol"
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "_nl"
},
{
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_textelement"
}
}
]
}
}
]
}
}
]
}
]
}
]
},
{
"type": "STRING",
"value": "]"
}
]
}
]
},
{
"type": "BLANK"
}
]
}
]
}
]
},
{
"type": "STRING",
"value": "]"
}
]
},
"_directive_list": {
"type": "REPEAT1",
@ -2111,19 +2269,8 @@
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ":"
},
{
"type": "SYMBOL",
"name": "_drawername"
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "STRING",
"value": ":"
}
"type": "PATTERN",
"value": ":[\\p{L}\\p{N}\\p{Pd}\\p{Pc}]+:"
},
{
"type": "SYMBOL",
@ -2144,13 +2291,6 @@
}
]
},
"_drawername": {
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "PATTERN",
"value": "[\\p{L}\\p{N}\\p{Pd}\\p{Pc}]+"
}
},
"block": {
"type": "SEQ",
"members": [
@ -2767,7 +2907,7 @@
}
]
},
"_conflicts": {
"_te_conflicts": {
"type": "PREC_DYNAMIC",
"value": -1,
"content": {
@ -2823,40 +2963,6 @@
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": ":"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_drawername"
},
{
"type": "BLANK"
}
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\\"
},
{
"type": "PATTERN",
"value": "[^\\p{L}]+"
}
]
},
{
"type": "SEQ",
"members": [
@ -2916,6 +3022,32 @@
]
}
},
"_sol_conflicts": {
"type": "PREC_DYNAMIC",
"value": -1,
"content": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": ":[\\p{L}\\p{N}\\p{Pd}\\p{Pc}]+"
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "\\"
},
{
"type": "PATTERN",
"value": "[^\\p{L}]+"
}
]
}
]
}
},
"contents": {
"type": "SEQ",
"members": [
@ -2978,22 +3110,13 @@
"item"
],
[
"_conflicts",
"_te_conflicts",
"markup"
],
[
"body"
],
[
"paragraph"
],
[
"fndef"
],
[
"_textelement",
"subscript",
"_conflicts"
"_te_conflicts"
]
],
"precedences": [
@ -3006,6 +3129,16 @@
"type": "STRING",
"value": "footnote"
}
],
[
{
"type": "STRING",
"value": "document_directive"
},
{
"type": "STRING",
"value": "body_directive"
}
]
],
"externals": [
@ -3043,10 +3176,15 @@
}
],
"inline": [
"_nl",
"_eol",
"_body_body",
"_ts_contents",
"_ts_contents_range",
"ReferenceError",
"_directive_list"
"ReferenceError",
"_start_of_paragraph",
"_start_of_textline"
],
"supertypes": []
}

119138
src/parser.c

File diff suppressed because it is too large Load diff

View file

@ -154,7 +154,6 @@ struct Scanner { // {{{1
bool scan(TSLexer *lexer, const bool *valid_symbols) { // {{{1
// - Section ends {{{2
int16_t indent_length = 0;
@ -166,8 +165,6 @@ bool scan(TSLexer *lexer, const bool *valid_symbols) { // {{{1
indent_length += 8;
} else if (lexer->lookahead == '\0') {
// if (valid_symbols[LISTITEMEND]) { lexer->result_symbol = LISTITEMEND; }
// else
if (valid_symbols[LISTEND]) { lexer->result_symbol = LISTEND; }
else if (valid_symbols[SECTIONEND]) { lexer->result_symbol = SECTIONEND; }
else if (valid_symbols[ENDOFFILE]) { lexer->result_symbol = ENDOFFILE; }