//! Rust Parser
item = _{ SOI ~ line* ~ EOI }
line = _{ regexp | string | other }
other = ${ !(string) ~ ANY }
WHITESPACE = { " " | "\t" | NEWLINE }
/// Comment
COMMENT = { line_comment | block_comment }
line_comment = _{ "//" ~ ("!" | "/")* ~ (!(NEWLINE) ~ ANY)* }
block_comment = _{ "/*" ~ (!("*/") ~ ANY)* ~ "*/" }
/// String
string = ${
PUSH("\"") ~ inner_string ~ POP
| "r" ~ PUSH("#"*) ~ "\"" ~ inner_string ~ "\"" ~ POP
}
inner_string = @{ (!(PEEK) ~ ANY)* }
/// Regexp
regexp = ${
("r\"" ~ (!(NEWLINE | "\"") ~ ANY)* ~ "\"")
}