//! PHP Parser item = _{ SOI ~ line* ~ EOI } line = _{ php | other } other = ${ !(php) ~ ANY } WHITESPACE = { " " | "\t" | NEWLINE } /// Comment COMMENT = ${ line_comment | block_comment } line_comment = _{ ("//" | "#") ~ (!(NEWLINE) ~ ANY)* } block_comment = _{ "/*" ~ (!("*/") ~ ANY)* ~ "*/" } /// PHP entry php = _{ open_php ~ (!close_php ~ expr)* ~ close_php } open_php = ${ "" } /// Expressions expr = { regexp | string | other } /// String string = ${ inner_string } inner_string = _{ ("\"\"\"" ~ (!("\"\"\"") ~ ANY)* ~ "\"\"\"") | ("\"" ~ (!("\"") ~ ANY)* ~ "\"") } /// Regexp regexp = ${ (("preg_match_all" | "preg_match") ~ "(" ~ " "* ~ inner_string ~ (!")" ~ ANY)* ~ ")") }