genesys 0.1.2

Component format & build code generation, no more repetitions!
Documentation
WHITESPACE =  _{ " " | "\t" | "\r" | "\n" }
COMMENT = _{ comment_block | comment_line }
comment_block = @{ "###" ~ (!"###" ~ ANY)* ~ "###" }
comment_line = @{ "#" ~ (!("\r" | "\n") ~ ANY)* }


STRING = @{ (ASCII_ALPHANUMERIC | ":" | "_"| "<" | ">" | "*")+ }
cname = @{ (ASCII_ALPHANUMERIC | "_")+ }

ints = _{ "i8" | "i16" | "i32" | "i64" | "i128" | "isize" }
uints = _{ "u8" | "u16" | "u32" | "u64" | "u128" | "usize" }
floats = _{ "f32" | "f64" }
strings = _{ "str" | "String" }
types = @{ strings | ints | uints | floats | STRING }

use_bracket = { STRING ~ "{" ~ use_value+ ~ ","? ~ "}" }
use_value = _{ use_bracket | STRING ~ ","? }

glob_use = { "global_use" ~ "{" ~ (use_value ~ ","?)+ ~ "}" }
glob_derive = { "global_derive" ~ "(" ~ STRING ~ ("," ~ STRING)* ~ ")" }

local_use = {"use" ~ "{" ~ (use_value ~ ","?)+ ~ "}"}
local_derive = {"derive" ~ "(" ~ STRING ~ ("," ~ STRING)* ~ ")"}

pair = { cname ~ ":" ~ types }
single_component = @{ cname ~ NEWLINE }
tuple_component = { cname ~ types ~ ("," ~ types)* }
named_component = { cname ~ pair ~ ("," ~ pair)* }
components = _{ single_component | named_component | tuple_component }

module = {
    "%" ~ cname ~ "{" ~ (local_use | local_derive | module | components)* ~ "}"
}

file = _{
    SOI
    ~ (glob_use | glob_derive | COMMENT | components | module )*
    ~ EOI
}