feat: add (expr) in plan for non-matched generic text.

Also allow other characters in day names (#16)
This commit is contained in:
Emilia Simmons 2022-03-28 13:30:16 -04:00
parent 1c3eb533a9
commit 7f9a7e51e4
5 changed files with 13817 additions and 13160 deletions

View file

@ -2140,7 +2140,7 @@ Plan.8b - Junk
(expr)))))
================================================================================
Plan.9 - Expression
Plan.9 - TsExpression
================================================================================
* a
<%%(b)> [%%c]
@ -2291,3 +2291,22 @@ Plan.14a - Successful
(entry_name)
(timestamp
(date))))))
================================================================================
Plan.15 - Expr
================================================================================
* a
<1-1-1 *123>
--------------------------------------------------------------------------------
(document
(section
(headline
(stars)
(item
(expr)))
(plan
(entry
(timestamp
(date)
(expr))))))

View file

@ -161,11 +161,12 @@ org_grammar = {
date: $ => /\p{N}{1,4}-\p{N}{1,4}-\p{N}{1,4}/,
_ts_element: $ => choice(
alias(/\p{L}+/, $.day),
alias(/\p{L}[^\]>\p{Z}\n\r]*/, $.day),
alias(/\p{N}?\p{N}[:.]\p{N}\p{N}( ?\p{L}{1,2})?/, $.time),
alias(/\p{N}?\p{N}[:.]\p{N}\p{N}( ?\p{L}{1,2})?-\p{N}?\p{N}[:.]\p{N}\p{N}( ?\p{L}{1,2})?/, $.duration),
alias(/[.+]?\+\p{N}+\p{L}/, $.repeat),
alias(/--?\p{N}+\p{L}/, $.delay),
alias(prec(-1, /[^\]>\p{Z}\n\r]+/), $.expr),
),
paragraph: $ => seq(optional($._directive_list), $._multiline_text),

View file

@ -786,7 +786,7 @@
"type": "ALIAS",
"content": {
"type": "PATTERN",
"value": "\\p{L}+"
"value": "\\p{L}[^\\]>\\p{Z}\\n\\r]*"
},
"named": true,
"value": "day"
@ -826,6 +826,19 @@
},
"named": true,
"value": "delay"
},
{
"type": "ALIAS",
"content": {
"type": "PREC",
"value": -1,
"content": {
"type": "PATTERN",
"value": "[^\\]>\\p{Z}\\n\\r]+"
}
},
"named": true,
"value": "expr"
}
]
},

View file

@ -795,6 +795,10 @@
"type": "duration",
"named": true
},
{
"type": "expr",
"named": true
},
{
"type": "repeat",
"named": true

26934
src/parser.c

File diff suppressed because it is too large Load diff