From 1d66084ee3113ab5d06343c6eb1ffbcc22344e4a Mon Sep 17 00:00:00 2001 From: Huck Boles Date: Mon, 15 May 2023 19:13:02 -0500 Subject: [PATCH] updated grammar to include '-' as a sigil --- src/meta.pest | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/meta.pest b/src/meta.pest index 3a2a686..b108f26 100644 --- a/src/meta.pest +++ b/src/meta.pest @@ -1,10 +1,10 @@ WHITESPACE = _{ " " | "\t" | NEWLINE } COMMENT = _{ "-{" ~ (!"}" ~ ANY)* ~ "}" } -sigil = _{ ("$" | "@" | "&" | "#") ~ "{" } +sigil = _{ ("$" | "@" | "&" | "#" | "-") ~ "{" } raw_char = _{ !(sigil) ~ ANY } -char_seq = { raw_char+ } +char_seq = ${ raw_char+ } string = { escaped_string | raw_string } escaped_string = @{ "\"" ~ char+ ~ "\"" } @@ -12,7 +12,6 @@ raw_string = @{ "'" ~ (!("'") ~ ANY)+ ~ "'" } char = _{ !("\"" | "\\") ~ ANY | "\\" ~ ("\"" | "\\" | "/" | "b" | "f" | "n" | "r" | "t") - | "\\" ~ ("u" ~ ASCII_HEX_DIGIT{4}) } array = _{ @@ -24,14 +23,17 @@ key_chars = @{ (ASCII_ALPHANUMERIC | "_" | ".")* } key = @{ key_chars } value = ${ string | array | "BLANK" | "DEFAULT" } -assign = { key ~ "=" ~ value } +assign = { "*"? ~ key ~ "=" ~ value } def_block = _{ sigil ~ assign* ~ "}" } var_def = { &("$") ~ def_block } arr_def = { &("@") ~ def_block } pat_def = { &("&") ~ def_block } definition = _{ var_def | arr_def | pat_def } -header = { &("#") ~ def_block } + +header_assign = { "!"? ~ key ~ "=" ~ value } +header_block = _{ sigil ~ header_assign* ~ "}" } +header = { &("#") ~ header_block } substitution = _{ sigil ~ key ~ "}" } var_sub = { &("$") ~ substitution } -- 2.45.2