wsp = _{ ( " " | "\t" )* }
significant_whitespace = { ( " " | "\t" )+ }
newline = _{ "\n" }
identifier = { ('A'..'z' | '0'..'9' | "_" )+ }
template_empty_line = { "\n" }
template_content = { (!newline ~ ANY)* }
template_line = { significant_whitespace ~ template_content ~ newline }
template_decl = { identifier ~ wsp ~ "=" ~ wsp }
template_terminator = { "-"+ ~ (newline | EOI) }
template = { template_decl ~ newline ~ (template_line | template_empty_line)* ~ template_terminator }
template_one_liner = { template_decl ~ template_content ~ (newline | EOI) }
file = { SOI ~ (template | newline | template_one_liner)* ~ EOI }
placeholder = { "${" ~ identifier ~ "}" }
escaped_dollar = { "\\$" }
not_placeholder = { (!("${" | "\\$") ~ ANY)+ }
template_phase2 = { SOI ~ (escaped_dollar | not_placeholder | placeholder)* ~ EOI }