yfelo 0.1.1

the Yfelo template engine
Documentation
WHITESPACE = _{ " " | "\t" | "\r" | "\n" }
COMMENT = _{ inline_comment | block_comment }

inline_comment = { "//" ~ (!"\n" ~ ANY)* ~ "\n" }
block_comment = { "/*" ~ (!"*/" ~ ANY)* ~ "*/" }

letter = _{ 'a'..'z' | 'A'..'Z' }
digit = _{ '0'..'9' }
ident = @{ (letter | "_") ~ (letter | digit | "_")* }
number = @{ digit+ ~ ("." ~ digit+)? }
string = @{ string_single | string_double }
string_double = _{ "\"" ~ (!("\"" | "\\") ~ ANY | "\\" ~ ANY)* ~ "\"" }
string_single = _{ "'" ~ (!("'" | "\\") ~ ANY | "\\" ~ ANY)* ~ "'" }

pattern = { ident }
expr_list = _{ (expr ~ ",")* ~ expr? }

prefix = { "!" | "-" | "+" }
suffix = { "(" ~ expr_list ~ ")" | "[" ~ expr ~ "]" | "." ~ ident }
literal = { number | string | ident | array | object | "(" ~ expr ~ ")" }
array = { "[" ~ expr_list ~ "]" }
object = { "{" ~ (entry ~ ",")* ~ entry? ~ "}" }

entry = { (number | string | ident | "[" ~ expr ~ "]") ~ ":" ~ expr | ident }

pow = { "**" }
mul = { "*" | "/" | "%" }
add = { "+" | "-" }
shift = { "<<" | ">>" }
comp = { "<=" | ">=" | "<" | ">" }
eq = { "==" | "!=" }
bitand = { "&" }
bitxor = { "^" }
bitor = { "|" }
and = { "&&" }
or = { "||" }

expr_unary = { prefix* ~ literal ~ suffix* }
expr_pow = { expr_unary ~ (pow ~ expr_unary)* }
expr_mul = { expr_pow ~ (mul ~ expr_pow)* }
expr_add = { expr_mul ~ (add ~ expr_mul)* }
expr_shift = { expr_add ~ (shift ~ expr_add)* }
expr_comp = { expr_shift ~ (comp ~ expr_shift)* }
expr_eq = { expr_comp ~ (eq ~ expr_comp)* }
expr_bitand = { expr_eq ~ (bitand ~ expr_eq)* }
expr_bitxor = { expr_bitand ~ (bitxor ~ expr_bitand)* }
expr_bitor = { expr_bitxor ~ (bitor ~ expr_bitxor)* }
expr_and = { expr_bitor ~ (and ~ expr_bitor)* }
expr_or = { expr_and ~ (or ~ expr_and)* }
expr = { expr_or }