2022-06-09 08:18:08 +00:00
|
|
|
use crate::sql::comment::comment;
|
|
|
|
use crate::sql::error::IResult;
|
|
|
|
use crate::sql::operator::{assigner, operator};
|
|
|
|
use nom::branch::alt;
|
2022-08-31 13:00:43 +00:00
|
|
|
use nom::bytes::complete::tag;
|
2022-06-09 08:18:08 +00:00
|
|
|
use nom::character::complete::char;
|
|
|
|
use nom::character::complete::multispace1;
|
|
|
|
use nom::combinator::eof;
|
|
|
|
use nom::combinator::map;
|
|
|
|
use nom::combinator::peek;
|
|
|
|
|
|
|
|
pub fn number(i: &str) -> IResult<&str, ()> {
|
|
|
|
peek(alt((
|
|
|
|
map(multispace1, |_| ()),
|
|
|
|
map(operator, |_| ()),
|
|
|
|
map(assigner, |_| ()),
|
|
|
|
map(comment, |_| ()),
|
|
|
|
map(char(')'), |_| ()),
|
|
|
|
map(char(']'), |_| ()),
|
|
|
|
map(char('}'), |_| ()),
|
2022-09-14 22:40:19 +00:00
|
|
|
map(char('"'), |_| ()),
|
2022-06-09 08:18:08 +00:00
|
|
|
map(char(';'), |_| ()),
|
|
|
|
map(char(','), |_| ()),
|
2022-08-31 13:00:43 +00:00
|
|
|
map(tag(".."), |_| ()),
|
2022-06-09 08:18:08 +00:00
|
|
|
map(eof, |_| ()),
|
|
|
|
)))(i)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn ident(i: &str) -> IResult<&str, ()> {
|
|
|
|
peek(alt((
|
|
|
|
map(multispace1, |_| ()),
|
|
|
|
map(operator, |_| ()),
|
|
|
|
map(assigner, |_| ()),
|
|
|
|
map(comment, |_| ()),
|
|
|
|
map(char(')'), |_| ()),
|
|
|
|
map(char(']'), |_| ()),
|
|
|
|
map(char('}'), |_| ()),
|
|
|
|
map(char(';'), |_| ()),
|
|
|
|
map(char(','), |_| ()),
|
|
|
|
map(char('.'), |_| ()),
|
|
|
|
map(char('['), |_| ()),
|
|
|
|
map(char('-'), |_| ()),
|
|
|
|
map(eof, |_| ()),
|
|
|
|
)))(i)
|
|
|
|
}
|