2023-11-18 13:56:13 +00:00
|
|
|
pub(crate) use super::v1::builtin::builtin_name;
|
|
|
|
use crate::sql::{Array, Expression, Idiom, Param, Script, Thing, Value};
|
|
|
|
|
|
|
|
use super::v1::test::*;
|
2022-01-13 17:36:41 +00:00
|
|
|
|
|
|
|
pub trait Parse<T> {
|
|
|
|
fn parse(val: &str) -> T;
|
|
|
|
}
|
|
|
|
|
2022-10-04 21:51:18 +00:00
|
|
|
impl Parse<Self> for Value {
|
|
|
|
fn parse(val: &str) -> Self {
|
2022-01-13 17:36:41 +00:00
|
|
|
value(val).unwrap().1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-04 21:51:18 +00:00
|
|
|
impl Parse<Self> for Array {
|
|
|
|
fn parse(val: &str) -> Self {
|
2022-01-22 21:16:13 +00:00
|
|
|
array(val).unwrap().1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-04 21:51:18 +00:00
|
|
|
impl Parse<Self> for Param {
|
|
|
|
fn parse(val: &str) -> Self {
|
2022-01-13 17:36:41 +00:00
|
|
|
param(val).unwrap().1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-04 21:51:18 +00:00
|
|
|
impl Parse<Self> for Idiom {
|
|
|
|
fn parse(val: &str) -> Self {
|
2022-01-13 17:36:41 +00:00
|
|
|
idiom(val).unwrap().1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-04 21:51:18 +00:00
|
|
|
impl Parse<Self> for Script {
|
|
|
|
fn parse(val: &str) -> Self {
|
2022-02-23 13:20:00 +00:00
|
|
|
script(val).unwrap().1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-04 21:51:18 +00:00
|
|
|
impl Parse<Self> for Thing {
|
|
|
|
fn parse(val: &str) -> Self {
|
2022-03-23 14:01:04 +00:00
|
|
|
thing(val).unwrap().1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-04 21:51:18 +00:00
|
|
|
impl Parse<Self> for Expression {
|
|
|
|
fn parse(val: &str) -> Self {
|
2023-11-18 13:56:13 +00:00
|
|
|
expression(val).unwrap().1
|
2022-01-13 17:36:41 +00:00
|
|
|
}
|
|
|
|
}
|