array = _{
"[" ~ "]"
- | "[" ~ " "* ~ string ~ (" "* ~ "," ~ " "* ~ string)* ~ " "* ~ "]"
+ | "["
+ ~ WHITESPACE*
+ ~ string
+ ~ (WHITESPACE* ~ "," ~ WHITESPACE* ~ string)*
+ ~ WHITESPACE* ~ ","? ~ WHITESPACE*
+ ~ "]"
}
key_chars = @{ (ASCII_ALPHANUMERIC | "_" | ".")* }
test_str!(r#"${v='v'}@{a=['a']}&{p='p'}"#);
}
+#[test]
+fn newlines_in_array() {
+ test_str!("@{ a = [\n'stuff',\n'other stuff'\n] }");
+}
+
+#[test]
+fn trailing_commas() {
+ test_str!(r#"@{ a = ['stuff','other stuff',] }"#);
+}
+
#[test]
fn just_source_string() {
test_str!(r#"This is just a &{source} snippet"#);