//! Gettext Parser
item = _{ SOI ~ line* ~ EOI }
line = _{ pair | key | value | string | refrence | other }
other = ${ !(string) ~ ANY }
WHITESPACE = { " " | "\t" | NEWLINE }
/// Comment
line_comment = _{ "#" ~ (!(NEWLINE) ~ ANY)* }
block_comment = _{ "/*" ~ (!("*/") ~ ANY)* ~ "*/" }
COMMENT = ${ line_comment | block_comment }
/// refrence
refrence = ${ "#:" ~ (!(NEWLINE) ~ ANY)* }
/// string
string = @{ inner_string }
inner_string = @{
("'" ~ (!(NEWLINE | "'") ~ ANY)* ~ "'")
| ("\"" ~ (!(NEWLINE | "\"") ~ ANY)* ~ "\"")
}
/// pair
pair = _{ key ~ NEWLINE+ ~ value }
key = ${ key_func ~ other* ~ inner_string }
value = ${ value_func ~ other* ~ string }
/// key value
key_func = @{ "msgid" | "msgid_plural" | "msgctxt" }
value_func = @{ "msgstr" }