Allow multiple table types in DEFINE FIELD record definition
Closes #15
This commit is contained in:
parent
1869e1ddbc
commit
96225afb44
1 changed files with 19 additions and 15 deletions
|
@ -1,11 +1,12 @@
|
||||||
use crate::sql::comment::mightbespace;
|
use crate::sql::comment::mightbespace;
|
||||||
|
use crate::sql::common::commas;
|
||||||
use crate::sql::error::IResult;
|
use crate::sql::error::IResult;
|
||||||
use crate::sql::table::{table, Table};
|
use crate::sql::table::{table, Table};
|
||||||
use nom::branch::alt;
|
use nom::branch::alt;
|
||||||
use nom::bytes::complete::tag;
|
use nom::bytes::complete::tag;
|
||||||
use nom::character::complete::char;
|
use nom::character::complete::char;
|
||||||
use nom::combinator::map;
|
use nom::combinator::map;
|
||||||
use nom::multi::many1;
|
use nom::multi::separated_list1;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
|
@ -82,7 +83,7 @@ fn record(i: &str) -> IResult<&str, Vec<Table>> {
|
||||||
let (i, _) = tag("record")(i)?;
|
let (i, _) = tag("record")(i)?;
|
||||||
let (i, _) = mightbespace(i)?;
|
let (i, _) = mightbespace(i)?;
|
||||||
let (i, _) = char('(')(i)?;
|
let (i, _) = char('(')(i)?;
|
||||||
let (i, v) = many1(table)(i)?;
|
let (i, v) = separated_list1(commas, table)(i)?;
|
||||||
let (i, _) = char(')')(i)?;
|
let (i, _) = char(')')(i)?;
|
||||||
Ok((i, v))
|
Ok((i, v))
|
||||||
}
|
}
|
||||||
|
@ -91,19 +92,22 @@ fn geometry(i: &str) -> IResult<&str, Vec<String>> {
|
||||||
let (i, _) = tag("geometry")(i)?;
|
let (i, _) = tag("geometry")(i)?;
|
||||||
let (i, _) = mightbespace(i)?;
|
let (i, _) = mightbespace(i)?;
|
||||||
let (i, _) = char('(')(i)?;
|
let (i, _) = char('(')(i)?;
|
||||||
let (i, v) = many1(map(
|
let (i, v) = separated_list1(
|
||||||
alt((
|
commas,
|
||||||
tag("feature"),
|
map(
|
||||||
tag("point"),
|
alt((
|
||||||
tag("line"),
|
tag("feature"),
|
||||||
tag("polygon"),
|
tag("point"),
|
||||||
tag("multipoint"),
|
tag("line"),
|
||||||
tag("multiline"),
|
tag("polygon"),
|
||||||
tag("multipolygon"),
|
tag("multipoint"),
|
||||||
tag("collection"),
|
tag("multiline"),
|
||||||
)),
|
tag("multipolygon"),
|
||||||
String::from,
|
tag("collection"),
|
||||||
))(i)?;
|
)),
|
||||||
|
String::from,
|
||||||
|
),
|
||||||
|
)(i)?;
|
||||||
let (i, _) = char(')')(i)?;
|
let (i, _) = char(')')(i)?;
|
||||||
Ok((i, v))
|
Ok((i, v))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue