From cdc34d45f7c6b7b8c7ea9b65ea9946a2316a641f Mon Sep 17 00:00:00 2001 From: Olivier Date: Wed, 19 Jun 2024 23:51:15 +0100 Subject: [PATCH] Allow kebab case identifiers (i.e. identifiers with `-`) Signed-off-by: Olivier --- hornbeam_grammar/src/hornbeam.pest | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hornbeam_grammar/src/hornbeam.pest b/hornbeam_grammar/src/hornbeam.pest index 3cd06ec..cb8ac5f 100644 --- a/hornbeam_grammar/src/hornbeam.pest +++ b/hornbeam_grammar/src/hornbeam.pest @@ -198,7 +198,9 @@ bracketedTerm = _{ "(" ~ Expr ~ ")" } IntLiteral = @{ (ASCII_NONZERO_DIGIT ~ ASCII_DIGIT+ | ASCII_DIGIT) } -Identifier = { (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_")* } +// `-` is important in identifiers for `kebab-case` HTML element attributes +// We could consider splitting this out into its own kind of identifier but let's not bother now. +Identifier = { (ASCII_ALPHA | "_") ~ (ASCII_ALPHANUMERIC | "_" | "-")* } commaSeparatedExprs = _{ wsnl* ~ (Expr ~ wsnl* ~ ("," ~ wsnl* ~ Expr ~ wsnl*)* ~ ("," ~ wsnl*)?)? } FunctionCall = { Identifier ~ "(" ~ commaSeparatedExprs ~ ")" } Variable = { "$" ~ Identifier }