Fix multiline tables. Add node: (hr). resolve #8
This commit is contained in:
parent
049e3861e1
commit
dda23ecf90
6 changed files with 14894 additions and 14870 deletions
|
|
@ -1724,7 +1724,7 @@ a c=a+d
|
|||
(document (body (paragraph)))
|
||||
|
||||
==========
|
||||
Table.1 -
|
||||
Table.1 - 1x1
|
||||
==========
|
||||
|a|
|
||||
----------
|
||||
|
|
@ -1732,7 +1732,7 @@ Table.1 -
|
|||
(document (body (table (row (cell)))))
|
||||
|
||||
==========
|
||||
Table.2 -
|
||||
Table.2 - 1x2
|
||||
==========
|
||||
|a|b|
|
||||
----------
|
||||
|
|
@ -1742,7 +1742,7 @@ Table.2 -
|
|||
)))
|
||||
|
||||
==========
|
||||
Table.3 -
|
||||
Table.3 - 2x2
|
||||
==========
|
||||
|a|b|
|
||||
|c|d|
|
||||
|
|
@ -1754,7 +1754,7 @@ Table.3 -
|
|||
)))
|
||||
|
||||
==========
|
||||
Table.4 -
|
||||
Table.4 - empty cell
|
||||
==========
|
||||
|a|b|
|
||||
| |d|
|
||||
|
|
@ -1767,7 +1767,7 @@ Table.4 -
|
|||
|
||||
|
||||
==========
|
||||
Table.5 -
|
||||
Table.5 - empty cells
|
||||
==========
|
||||
|| |
|
||||
----------
|
||||
|
|
@ -1777,15 +1777,15 @@ Table.5 -
|
|||
)))
|
||||
|
||||
==========
|
||||
Table.6 -
|
||||
Table.6 - simple hr
|
||||
==========
|
||||
|-|
|
||||
----------
|
||||
|
||||
(document (body (table)))
|
||||
(document (body (table (hr))))
|
||||
|
||||
==========
|
||||
Table.7 -
|
||||
Table.7 - words
|
||||
==========
|
||||
|a | b | c|
|
||||
|--+---+---|
|
||||
|
|
@ -1794,12 +1794,13 @@ Table.7 -
|
|||
|
||||
(document (body (table
|
||||
(row (cell) (cell) (cell))
|
||||
(hr)
|
||||
(row (cell) (cell))
|
||||
)))
|
||||
|
||||
|
||||
==========
|
||||
Table.8 -
|
||||
Table.8 - Formula
|
||||
==========
|
||||
|a|b|
|
||||
|c|d|
|
||||
|
|
@ -1814,7 +1815,7 @@ Table.8 -
|
|||
)))
|
||||
|
||||
==========
|
||||
Table.9 -
|
||||
Table.9 - Multiple formula
|
||||
==========
|
||||
|a|b|
|
||||
|c|d|
|
||||
|
|
@ -1831,3 +1832,25 @@ Table.9 -
|
|||
(formula)
|
||||
(formula)
|
||||
)))
|
||||
|
||||
==========
|
||||
Table.10 - Multiline
|
||||
==========
|
||||
|
||||
| 1 |
|
||||
| 2 |
|
||||
| 3 |
|
||||
| 4 |
|
||||
| 5 |
|
||||
| 6 |
|
||||
|
||||
----------
|
||||
|
||||
(document (body (table
|
||||
(row (cell))
|
||||
(row (cell))
|
||||
(row (cell))
|
||||
(row (cell))
|
||||
(row (cell))
|
||||
(row (cell))
|
||||
)))
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ org_grammar = {
|
|||
// Multiline -- continue the item or start a new one?
|
||||
[$.body],
|
||||
[$.paragraph],
|
||||
[$.table],
|
||||
[$.fndef],
|
||||
|
||||
// Subscript and underlines
|
||||
|
|
@ -465,15 +464,15 @@ org_grammar = {
|
|||
// Table =============================================== {{{1
|
||||
|
||||
// prec so a new row is higher precedence than a new table
|
||||
table: $ => prec.dynamic(DYN.multiline, seq(
|
||||
table: $ => prec.right(seq(
|
||||
optional($._directive_list),
|
||||
repeat1(choice($.row, $._hrule)),
|
||||
repeat1(choice($.row, $.hr)),
|
||||
repeat($.formula),
|
||||
)),
|
||||
|
||||
row: $ => seq(repeat1($.cell), '|', $._eol),
|
||||
cell: $ => seq('|', field('contents', repeat($._text))),
|
||||
_hrule: $ => seq(
|
||||
hr: $ => seq(
|
||||
'|',
|
||||
repeat1(seq(/[-+]+/, '|')),
|
||||
$._eol,
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@
|
|||
"lexer"
|
||||
],
|
||||
"dependencies": {
|
||||
"nan": "^2.14.2",
|
||||
"nan": "^2.15.0",
|
||||
"prebuild-install": "^5.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prebuild": "^10.0.0",
|
||||
"tree-sitter-cli": "^0.19.4"
|
||||
"tree-sitter-cli": "^0.19.5"
|
||||
},
|
||||
"scripts": {
|
||||
"install": "prebuild-install || node-gyp rebuild",
|
||||
|
|
|
|||
|
|
@ -2525,8 +2525,8 @@
|
|||
]
|
||||
},
|
||||
"table": {
|
||||
"type": "PREC_DYNAMIC",
|
||||
"value": -1,
|
||||
"type": "PREC_RIGHT",
|
||||
"value": 0,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
|
|
@ -2553,7 +2553,7 @@
|
|||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_hrule"
|
||||
"name": "hr"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -2608,7 +2608,7 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"_hrule": {
|
||||
"hr": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
|
|
@ -2987,9 +2987,6 @@
|
|||
[
|
||||
"paragraph"
|
||||
],
|
||||
[
|
||||
"table"
|
||||
],
|
||||
[
|
||||
"fndef"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -372,6 +372,11 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "hr",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "item",
|
||||
"named": true,
|
||||
|
|
@ -772,7 +777,7 @@
|
|||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "directive",
|
||||
|
|
@ -782,6 +787,10 @@
|
|||
"type": "formula",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "hr",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "row",
|
||||
"named": true
|
||||
|
|
|
|||
29688
src/parser.c
29688
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue