ok/jj
1
0
Fork 0
forked from mirrors/jj

templater: move whitespace rule out of template node

For the same reason as b2825c22d7 "revset: move whitespace rule out of
expression."
This commit is contained in:
Yuya Nishihara 2023-02-09 18:32:29 +09:00
parent a67fbb6714
commit 8749a325e9

View file

@ -31,15 +31,15 @@ integer_literal = {
identifier = @{ (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")* } identifier = @{ (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")* }
function = { identifier ~ "(" ~ function_arguments ~ ")" } function = { identifier ~ "(" ~ whitespace* ~ function_arguments ~ whitespace* ~ ")" }
function_arguments = { function_arguments = {
template ~ ("," ~ template)* ~ ("," ~ whitespace*)? template ~ (whitespace* ~ "," ~ whitespace* ~ template)* ~ (whitespace* ~ ",")?
| whitespace* | ""
} }
// Note that "x(y)" is a function call but "x (y)" concatenates "x" and "y" // Note that "x(y)" is a function call but "x (y)" concatenates "x" and "y"
primary = _{ primary = _{
("(" ~ template ~ ")") ("(" ~ whitespace* ~ template ~ whitespace* ~ ")")
| function | function
| identifier | identifier
| literal | literal
@ -54,8 +54,6 @@ list = _{
term ~ (whitespace+ ~ term)+ term ~ (whitespace+ ~ term)+
} }
template = { template = { list | term }
whitespace* ~ (list | term) ~ whitespace*
}
program = _{ SOI ~ (template | whitespace*) ~ EOI } program = _{ SOI ~ whitespace* ~ template? ~ whitespace* ~ EOI }