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