Require a newline after table definition
This commit is contained in:
parent
2cd1116e06
commit
848227c605
|
@ -447,7 +447,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn lookup_advanced_table() {
|
fn lookup_advanced_table() {
|
||||||
let value: Value = r#"[table."name.other"] value = "my value""#.parse().unwrap();
|
let value: Value = "[table.\"name.other\"]\nvalue = \"my value\"".parse().unwrap();
|
||||||
let looked = value.lookup(r#"table."name.other".value"#).unwrap();
|
let looked = value.lookup(r#"table."name.other".value"#).unwrap();
|
||||||
assert_eq!(*looked, Value::String(String::from("my value")));
|
assert_eq!(*looked, Value::String(String::from("my value")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,6 +271,16 @@ impl<'a> Parser<'a> {
|
||||||
values: BTreeMap::new(),
|
values: BTreeMap::new(),
|
||||||
defined: true,
|
defined: true,
|
||||||
};
|
};
|
||||||
|
self.ws();
|
||||||
|
self.comment();
|
||||||
|
if !self.newline() {
|
||||||
|
self.errors.push(ParserError {
|
||||||
|
lo: start,
|
||||||
|
hi: start,
|
||||||
|
desc: format!("expected a newline after table definition"),
|
||||||
|
});
|
||||||
|
return None
|
||||||
|
}
|
||||||
if !self.values(&mut table) { return None }
|
if !self.values(&mut table) { return None }
|
||||||
if array {
|
if array {
|
||||||
self.insert_array(&mut ret, &keys, Value::Table(table),
|
self.insert_array(&mut ret, &keys, Value::Table(table),
|
||||||
|
|
Loading…
Reference in a new issue