//! Scala Parser item = _{ SOI ~ line* ~ EOI } line = _{ regexp | string_literal | string | other } other = ${ !(string) ~ ANY } WHITESPACE = { " " | "\t" | NEWLINE } /// Comment COMMENT = ${ line_comment | block_comment } line_comment = _{ "//" ~ (!(NEWLINE) ~ ANY)* } block_comment = _{ "/*" ~ (!("*/") ~ ANY)* ~ "*/" } /// String string = ${ inner_string } inner_string = _{ ("\"\"\"" ~ (!("\"\"\"") ~ ANY)* ~ "\"\"\"") | ("\"" ~ (!(NEWLINE | "\"") ~ ANY)* ~ "\"") } string_literal = ${ "s" ~ inner_string } /// Regexp regexp = ${ ("Regex(" ~ " "* ~ inner_string ~ (!")" ~ ANY)* ~ ")") | (inner_string ~ ".r") }