From: Huck Boles Date: Tue, 16 May 2023 00:13:02 +0000 (-0500) Subject: updated grammar to include '-' as a sigil X-Git-Url: https://git.huck.website/?a=commitdiff_plain;h=1d66084ee3113ab5d06343c6eb1ffbcc22344e4a;p=metaforge.git updated grammar to include '-' as a sigil --- 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 }