|
|
@ -13,10 +13,18 @@ token = { string | keyword }
|
|
|
|
// has to be atomic for no implicit separate (spaces)
|
|
|
|
// has to be atomic for no implicit separate (spaces)
|
|
|
|
keyword = @{ (!(WHITESPACE | NEWLINE) ~ ANY)+ }
|
|
|
|
keyword = @{ (!(WHITESPACE | NEWLINE) ~ ANY)+ }
|
|
|
|
|
|
|
|
|
|
|
|
// strings cannot contain quotes
|
|
|
|
single_quote_string_data = @{ (
|
|
|
|
// TODO: escaped quotes
|
|
|
|
"\\'" // Escaped single quotes
|
|
|
|
string_data = @{ (!"\"" ~ ANY)* }
|
|
|
|
| (!"'" ~ ANY)
|
|
|
|
string = ${ "\"" ~ string_data ~ "\"" }
|
|
|
|
)* }
|
|
|
|
|
|
|
|
double_quote_string_data = @{ (
|
|
|
|
|
|
|
|
"\\\"" // Escaped double quotes
|
|
|
|
|
|
|
|
| (!"\"" ~ ANY)
|
|
|
|
|
|
|
|
)* }
|
|
|
|
|
|
|
|
string = ${
|
|
|
|
|
|
|
|
("'" ~ single_quote_string_data ~ "'")
|
|
|
|
|
|
|
|
| ("\"" ~ double_quote_string_data ~ "\"")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// comments are a # followed by
|
|
|
|
// comments are a # followed by
|
|
|
|
// any number of non-newline characters
|
|
|
|
// any number of non-newline characters
|
|
|
|