feat: add fields to (document)
This commit is contained in:
parent
447fedff48
commit
63c9563fee
6 changed files with 44185 additions and 44156 deletions
|
|
@ -45,7 +45,7 @@ Text
|
|||
Parses as:
|
||||
```
|
||||
(document [0, 0] - [16, 0]
|
||||
(body [0, 0] - [4, 0]
|
||||
body: (body [0, 0] - [4, 0]
|
||||
directive: (directive [0, 0] - [1, 0]
|
||||
name: (expr [0, 2] - [0, 7])
|
||||
value: (value [0, 9] - [0, 16]
|
||||
|
|
@ -55,7 +55,7 @@ Parses as:
|
|||
(expr [2, 5] - [2, 12])
|
||||
(expr [2, 13] - [2, 16])
|
||||
(expr [2, 17] - [2, 22])))
|
||||
(section [4, 0] - [16, 0]
|
||||
subsection: (section [4, 0] - [16, 0]
|
||||
headline: (headline [4, 0] - [5, 0]
|
||||
stars: (stars [4, 0] - [4, 1])
|
||||
item: (item [4, 2] - [4, 12]
|
||||
|
|
@ -110,7 +110,6 @@ Parses as:
|
|||
body: (body [14, 0] - [16, 0]
|
||||
(paragraph [15, 0] - [16, 0]
|
||||
(expr [15, 0] - [15, 4]))))))
|
||||
|
||||
```
|
||||
|
||||
## Install
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ DynamicBlock.1 - Empty
|
|||
--------------------------------------------------------------------------------
|
||||
|
||||
(document
|
||||
(body
|
||||
body: (body
|
||||
(dynamic_block
|
||||
name: (expr)
|
||||
parameter: (expr))))
|
||||
|
|
@ -426,7 +426,7 @@ c
|
|||
--------------------------------------------------------------------------------
|
||||
|
||||
(document
|
||||
(body
|
||||
body: (body
|
||||
(dynamic_block
|
||||
name: (expr)
|
||||
contents: (contents
|
||||
|
|
|
|||
|
|
@ -53,7 +53,10 @@ org_grammar = {
|
|||
|
||||
rules: {
|
||||
|
||||
document: $ => seq(optional($.body), repeat($.section)),
|
||||
document: $ => seq(
|
||||
optional(field('body', $.body)),
|
||||
repeat(field('subsection', $.section)),
|
||||
),
|
||||
|
||||
// Set up to prevent lexing conflicts of having two paragraphs in a row
|
||||
body: $ => $._body_contents,
|
||||
|
|
|
|||
|
|
@ -8,8 +8,12 @@
|
|||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "body"
|
||||
"type": "FIELD",
|
||||
"name": "body",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "body"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
|
|
@ -19,8 +23,12 @@
|
|||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "section"
|
||||
"type": "FIELD",
|
||||
"name": "subsection",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "section"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -193,20 +193,27 @@
|
|||
{
|
||||
"type": "document",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "body",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
"fields": {
|
||||
"body": {
|
||||
"multiple": false,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "body",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"subsection": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "section",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
88276
src/parser.c
88276
src/parser.c
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue