mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 11:46:42 +01:00
wip: directionalize!
can't fit all into 1 trait because of directionality of trait implementation rules and constraints :(
This commit is contained in:
parent
f797a7143d
commit
7c1cddc759
10 changed files with 221 additions and 222 deletions
|
|
@ -1,49 +1,61 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
pub trait Dsl<State>: Sized {
|
pub trait Dsl<Other>: Sized {
|
||||||
fn take_from <'state, 'source: 'state> (state: &'state State, _: &mut TokenIter<'source>)
|
fn take <'state, 'source: 'state> (
|
||||||
-> Perhaps<Self>
|
&'state self,
|
||||||
{
|
token: &mut TokenIter<'source>
|
||||||
unimplemented!()
|
)
|
||||||
}
|
-> Perhaps<Other>;
|
||||||
fn take_from_or_fail <'state, 'source: 'state> (
|
fn take_or_fail <'state, 'source: 'state> (
|
||||||
state: &'state State,
|
&'state self,
|
||||||
token: &mut TokenIter<'source>,
|
token: &mut TokenIter<'source>,
|
||||||
error: impl Into<Box<dyn std::error::Error>>
|
error: impl Into<Box<dyn std::error::Error>>
|
||||||
) -> Usually<Self> {
|
) -> Usually<Other> {
|
||||||
if let Some(value) = Dsl::<State>::take_from(state, token)? {
|
if let Some(value) = Dsl::<Other>::take(self, token)? {
|
||||||
Ok(value)
|
Ok(value)
|
||||||
} else {
|
} else {
|
||||||
Result::Err(error.into())
|
Result::Err(error.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub trait FromDsl<State>: Sized {
|
||||||
impl<T, U: Dsl<T>> DslFrom<U> for T {}
|
fn take_from <'state, 'source: 'state> (state: &'state State, token: &mut TokenIter<'source>)
|
||||||
|
-> Perhaps<Self>;
|
||||||
pub trait DslFrom<T: Dsl<Self>>: Sized {
|
fn take_from_or_fail <'state, 'source: 'state> (
|
||||||
|
state: &'state State,
|
||||||
|
token: &mut TokenIter<'source>,
|
||||||
|
error: impl Into<Box<dyn std::error::Error>>
|
||||||
|
) -> Usually<Self> {
|
||||||
|
if let Some(value) = FromDsl::<State>::take_from(state, token)? {
|
||||||
|
Ok(value)
|
||||||
|
} else {
|
||||||
|
Result::Err(error.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl<T: FromDsl<State>, State> Dsl<T> for State {
|
||||||
fn take <'state, 'source: 'state> (&'state self, token: &mut TokenIter<'source>)
|
fn take <'state, 'source: 'state> (&'state self, token: &mut TokenIter<'source>)
|
||||||
-> Perhaps<T>
|
-> Perhaps<T>
|
||||||
{
|
{
|
||||||
T::take_from(self, token)
|
FromDsl::take_from(self, token)
|
||||||
}
|
|
||||||
fn take_or_fail <'state, 'source: 'state> (
|
|
||||||
&'state self,
|
|
||||||
token: &mut TokenIter<'source>,
|
|
||||||
error: impl Into<Box<dyn std::error::Error>>
|
|
||||||
) -> Usually<T> {
|
|
||||||
T::take_from_or_fail(self, token, error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//impl<State: Dsl<T>, T> FromDsl<State> for T {
|
||||||
|
//fn take_from <'state, 'source: 'state> (state: &'state State, token: &mut TokenIter<'source>)
|
||||||
|
//-> Perhaps<Self>
|
||||||
|
//{
|
||||||
|
//Dsl::take(state, token)
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
|
||||||
/// Implement the [Dsl] trait, which boils down to
|
/// Implement the [Dsl] trait, which boils down to
|
||||||
/// specifying two types and providing an expression.
|
/// specifying two types and providing an expression.
|
||||||
#[macro_export] macro_rules! dsl {
|
#[macro_export] macro_rules! from_dsl {
|
||||||
($T:ty: |$self:ident:$S:ty, $iter:ident|$expr:expr) => {
|
($T:ty: |$state:ident:$S:ty, $words:ident|$expr:expr) => {
|
||||||
impl ::tengri::dsl::Dsl<$S> for $T {
|
impl ::tengri::dsl::FromDsl<$S> for $T {
|
||||||
fn take_from <'state, 'source: 'state> (
|
fn take_from <'state, 'source: 'state> (
|
||||||
state: &'state $S,
|
$state: &'state $S,
|
||||||
$iter: &mut ::tengri::dsl::TokenIter<'source>,
|
$words: &mut ::tengri::dsl::TokenIter<'source>,
|
||||||
) -> ::tengri::Perhaps<$T> {
|
) -> ::tengri::Perhaps<$T> {
|
||||||
$expr
|
$expr
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@ use std::marker::PhantomData;
|
||||||
pub trait DslInput: Input { fn matches_dsl (&self, token: &str) -> bool; }
|
pub trait DslInput: Input { fn matches_dsl (&self, token: &str) -> bool; }
|
||||||
|
|
||||||
/// A pre-configured mapping of input events to commands.
|
/// A pre-configured mapping of input events to commands.
|
||||||
pub trait KeyMap<S, C: Dsl<S> + Command<S>, I: DslInput> {
|
pub trait KeyMap<S: Dsl<C>, C: Command<S>, I: DslInput> {
|
||||||
/// Try to find a command that matches the current input event.
|
/// Try to find a command that matches the current input event.
|
||||||
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C>;
|
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [SourceIter] can be a [KeyMap].
|
/// A [SourceIter] can be a [KeyMap].
|
||||||
impl<'source, S, C: Dsl<S> + Command<S>, I: DslInput> KeyMap<S, C, I> for SourceIter<'source> {
|
impl<'source, S: Dsl<C>, C: Command<S>, I: DslInput> KeyMap<S, C, I> for SourceIter<'source> {
|
||||||
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
||||||
let mut iter = self.clone();
|
let mut iter = self.clone();
|
||||||
while let Some((token, rest)) = iter.next() {
|
while let Some((token, rest)) = iter.next() {
|
||||||
|
|
@ -22,7 +22,7 @@ impl<'source, S, C: Dsl<S> + Command<S>, I: DslInput> KeyMap<S, C, I> for Source
|
||||||
match exp_iter.next() {
|
match exp_iter.next() {
|
||||||
Some(Token { value: Value::Sym(binding), .. }) => {
|
Some(Token { value: Value::Sym(binding), .. }) => {
|
||||||
if input.matches_dsl(binding) {
|
if input.matches_dsl(binding) {
|
||||||
if let Some(command) = Dsl::take_from(state, &mut exp_iter)? {
|
if let Some(command) = state.take(&mut exp_iter)? {
|
||||||
return Ok(Some(command))
|
return Ok(Some(command))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ impl<'source, S, C: Dsl<S> + Command<S>, I: DslInput> KeyMap<S, C, I> for Source
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A [TokenIter] can be a [KeyMap].
|
/// A [TokenIter] can be a [KeyMap].
|
||||||
impl<'source, S, C: Dsl<S> + Command<S>, I: DslInput> KeyMap<S, C, I> for TokenIter<'source> {
|
impl<'source, S: Dsl<C>, C: Command<S>, I: DslInput> KeyMap<S, C, I> for TokenIter<'source> {
|
||||||
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
||||||
let mut iter = self.clone();
|
let mut iter = self.clone();
|
||||||
while let Some(next) = iter.next() {
|
while let Some(next) = iter.next() {
|
||||||
|
|
@ -48,7 +48,7 @@ impl<'source, S, C: Dsl<S> + Command<S>, I: DslInput> KeyMap<S, C, I> for TokenI
|
||||||
match e.next() {
|
match e.next() {
|
||||||
Some(Token { value: Value::Sym(binding), .. }) => {
|
Some(Token { value: Value::Sym(binding), .. }) => {
|
||||||
if input.matches_dsl(binding) {
|
if input.matches_dsl(binding) {
|
||||||
if let Some(command) = C::take_from(state, &mut e)? {
|
if let Some(command) = state.take(&mut e)? {
|
||||||
return Ok(Some(command))
|
return Ok(Some(command))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -68,20 +68,20 @@ pub type InputLayerCond<S> = Box<dyn Fn(&S)->Usually<bool> + Send + Sync>;
|
||||||
/// A collection of pre-configured mappings of input events to commands,
|
/// A collection of pre-configured mappings of input events to commands,
|
||||||
/// which may be made available subject to given conditions.
|
/// which may be made available subject to given conditions.
|
||||||
pub struct InputMap<S, C, I, M>
|
pub struct InputMap<S, C, I, M>
|
||||||
where C: Dsl<S> + Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
where S: Dsl<C>, C: Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
||||||
__: PhantomData<(S, C, I)>,
|
__: PhantomData<(S, C, I)>,
|
||||||
pub layers: Vec<(InputLayerCond<S>, M)>,
|
pub layers: Vec<(InputLayerCond<S>, M)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, C, I, M> Default for InputMap<S, C, I, M>
|
impl<S, C, I, M> Default for InputMap<S, C, I, M>
|
||||||
where C: Dsl<S> + Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
where S: Dsl<C>, C: Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
||||||
fn default () -> Self {
|
fn default () -> Self {
|
||||||
Self { __: PhantomData, layers: vec![] }
|
Self { __: PhantomData, layers: vec![] }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S: 'static, C, I, M> InputMap<S, C, I, M>
|
impl<S: 'static, C, I, M> InputMap<S, C, I, M>
|
||||||
where C: Dsl<S> + Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
where S: Dsl<C>, C: Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
||||||
pub fn new (keymap: M) -> Self {
|
pub fn new (keymap: M) -> Self {
|
||||||
Self::default().layer(keymap)
|
Self::default().layer(keymap)
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ where C: Dsl<S> + Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, C, I, M> std::fmt::Debug for InputMap<S, C, I, M>
|
impl<S, C, I, M> std::fmt::Debug for InputMap<S, C, I, M>
|
||||||
where C: Dsl<S> + Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
where S: Dsl<C>, C: Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
||||||
fn fmt (&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
fn fmt (&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
|
||||||
write!(f, "[InputMap: {} layer(s)]", self.layers.len())
|
write!(f, "[InputMap: {} layer(s)]", self.layers.len())
|
||||||
}
|
}
|
||||||
|
|
@ -112,7 +112,7 @@ where C: Dsl<S> + Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
||||||
|
|
||||||
/// An [InputMap] can be a [KeyMap].
|
/// An [InputMap] can be a [KeyMap].
|
||||||
impl<S, C, I, M> KeyMap<S, C, I> for InputMap<S, C, I, M>
|
impl<S, C, I, M> KeyMap<S, C, I> for InputMap<S, C, I, M>
|
||||||
where C: Dsl<S> + Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
where S: Dsl<C>, C: Command<S>, I: DslInput, M: KeyMap<S, C, I> + Send + Sync {
|
||||||
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
fn keybind_resolve (&self, state: &S, input: &I) -> Perhaps<C> {
|
||||||
for (condition, keymap) in self.layers.iter() {
|
for (condition, keymap) in self.layers.iter() {
|
||||||
if !condition(state)? {
|
if !condition(state)? {
|
||||||
|
|
|
||||||
|
|
@ -36,20 +36,17 @@ pub enum Alignment { #[default] Center, X, Y, NW, N, NE, E, SE, S, SW, W }
|
||||||
pub struct Align<A>(Alignment, A);
|
pub struct Align<A>(Alignment, A);
|
||||||
|
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'state, E: Output + 'state, T: ViewContext<'state, E>>
|
impl<State: Dsl<A>, A> FromDsl<State> for Align<A> {
|
||||||
Dsl<T> for Align<RenderBox<'state, E>> {
|
fn take_from <'state, 'source: 'state> (state: &'state State, iter: &mut TokenIter<'source>)
|
||||||
fn take_from <'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
-> Perhaps<Self>
|
||||||
|
{
|
||||||
if let Some(Token { value: Value::Key(key), .. }) = iter.peek() {
|
if let Some(Token { value: Value::Key(key), .. }) = iter.peek() {
|
||||||
match key {
|
match key {
|
||||||
"align/c"|"align/x"|"align/y"|
|
"align/c"|"align/x"|"align/y"|
|
||||||
"align/n"|"align/s"|"align/e"|"align/w"|
|
"align/n"|"align/s"|"align/e"|"align/w"|
|
||||||
"align/nw"|"align/sw"|"align/ne"|"align/se" => {
|
"align/nw"|"align/sw"|"align/ne"|"align/se" => {
|
||||||
let _ = iter.next().unwrap();
|
let _ = iter.next().unwrap();
|
||||||
let content = if let Some(content) = state.get_content(&mut iter.clone())? {
|
let content = state.take_or_fail(&mut iter.clone(), "expected content")?;
|
||||||
content
|
|
||||||
} else {
|
|
||||||
panic!("no content corresponding to {:?}", &iter);
|
|
||||||
};
|
|
||||||
return Ok(Some(match key {
|
return Ok(Some(match key {
|
||||||
"align/c" => Self::c(content),
|
"align/c" => Self::c(content),
|
||||||
"align/x" => Self::x(content),
|
"align/x" => Self::x(content),
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,8 @@ impl<E: Output, A: Content<E>, B: Content<E>> Content<E> for Bsp<A, B> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'state, E: Output + 'state, T: ViewContext<'state, E>>
|
impl<A, B, T: Dsl<A> + Dsl<B>> FromDsl<T> for Bsp<A, B> {
|
||||||
Dsl<T> for Bsp<RenderBox<'state, E>, RenderBox<'state, E>> {
|
fn take_from <'state, 'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
||||||
fn take_from <'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
|
||||||
Ok(if let Some(Token {
|
Ok(if let Some(Token {
|
||||||
value: Value::Key("bsp/n"|"bsp/s"|"bsp/e"|"bsp/w"|"bsp/a"|"bsp/b"),
|
value: Value::Key("bsp/n"|"bsp/s"|"bsp/e"|"bsp/w"|"bsp/a"|"bsp/b"),
|
||||||
..
|
..
|
||||||
|
|
@ -31,23 +30,23 @@ Dsl<T> for Bsp<RenderBox<'state, E>, RenderBox<'state, E>> {
|
||||||
let base = iter.clone();
|
let base = iter.clone();
|
||||||
return Ok(Some(match iter.next() {
|
return Ok(Some(match iter.next() {
|
||||||
Some(Token { value: Value::Key("bsp/n"), .. }) =>
|
Some(Token { value: Value::Key("bsp/n"), .. }) =>
|
||||||
Self::n(state.get_content_or_fail(iter)?,
|
Self::n(state.take_or_fail(iter, "expected content 1")?,
|
||||||
state.get_content_or_fail(iter)?),
|
state.take_or_fail(iter, "expected content 2")?),
|
||||||
Some(Token { value: Value::Key("bsp/s"), .. }) =>
|
Some(Token { value: Value::Key("bsp/s"), .. }) =>
|
||||||
Self::s(state.get_content_or_fail(iter)?,
|
Self::s(state.take_or_fail(iter, "expected content 1")?,
|
||||||
state.get_content_or_fail(iter)?),
|
state.take_or_fail(iter, "expected content 2")?),
|
||||||
Some(Token { value: Value::Key("bsp/e"), .. }) =>
|
Some(Token { value: Value::Key("bsp/e"), .. }) =>
|
||||||
Self::e(state.get_content_or_fail(iter)?,
|
Self::e(state.take_or_fail(iter, "expected content 1")?,
|
||||||
state.get_content_or_fail(iter)?),
|
state.take_or_fail(iter, "expected content 2")?),
|
||||||
Some(Token { value: Value::Key("bsp/w"), .. }) =>
|
Some(Token { value: Value::Key("bsp/w"), .. }) =>
|
||||||
Self::w(state.get_content_or_fail(iter)?,
|
Self::w(state.take_or_fail(iter, "expected content 1")?,
|
||||||
state.get_content_or_fail(iter)?),
|
state.take_or_fail(iter, "expected content 2")?),
|
||||||
Some(Token { value: Value::Key("bsp/a"), .. }) =>
|
Some(Token { value: Value::Key("bsp/a"), .. }) =>
|
||||||
Self::a(state.get_content_or_fail(iter)?,
|
Self::a(state.take_or_fail(iter, "expected content 1")?,
|
||||||
state.get_content_or_fail(iter)?),
|
state.take_or_fail(iter, "expected content 2")?),
|
||||||
Some(Token { value: Value::Key("bsp/b"), .. }) =>
|
Some(Token { value: Value::Key("bsp/b"), .. }) =>
|
||||||
Self::b(state.get_content_or_fail(iter)?,
|
Self::b(state.take_or_fail(iter, "expected content 1")?,
|
||||||
state.get_content_or_fail(iter)?),
|
state.take_or_fail(iter, "expected content 2")?),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -17,44 +17,26 @@ impl<A, B> Either<A, B> {
|
||||||
Self(c, a, b)
|
Self(c, a, b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'state, E: Output + 'state, T: ViewContext<'state, E>>
|
impl<A, T: Dsl<bool> + Dsl<A>> FromDsl<T> for When<A> {
|
||||||
Dsl<T> for When<RenderBox<'state, E>> {
|
fn take_from <'state, 'source: 'state> (
|
||||||
fn take_from <'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
state: &'state T,
|
||||||
|
token: &mut TokenIter<'source>
|
||||||
|
) -> Perhaps<Self> {
|
||||||
Ok(if let Some(Token {
|
Ok(if let Some(Token {
|
||||||
value: Value::Key("when"),
|
value: Value::Key("when"),
|
||||||
..
|
..
|
||||||
}) = iter.peek() {
|
}) = token.peek() {
|
||||||
let base = iter.clone();
|
let base = token.clone();
|
||||||
return Ok(Some(Self(
|
return Ok(Some(Self(
|
||||||
state.take(iter)?.unwrap_or_else(||panic!("cond: no condition: {base:?}")),
|
state.take_or_fail(token, "cond: no condition")?,
|
||||||
state.get_content_or_fail(iter)?
|
state.take_or_fail(token, "cond: no content")?,
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "dsl")]
|
|
||||||
impl<'state, E: Output + 'state, T: ViewContext<'state, E>>
|
|
||||||
Dsl<T> for Either<RenderBox<'state, E>, RenderBox<'state, E>> {
|
|
||||||
fn take_from <'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
|
||||||
if let Some(Token { value: Value::Key("either"), .. }) = iter.peek() {
|
|
||||||
let base = iter.clone();
|
|
||||||
let _ = iter.next().unwrap();
|
|
||||||
//panic!("{iter:?}");
|
|
||||||
return Ok(Some(Self(
|
|
||||||
state.take(iter)?.unwrap_or_else(||panic!("either: no condition: {base:?}")),
|
|
||||||
state.get_content_or_fail(iter)?,
|
|
||||||
state.get_content_or_fail(iter)?,
|
|
||||||
)))
|
|
||||||
}
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<E: Output, A: Render<E>> Content<E> for When<A> {
|
impl<E: Output, A: Render<E>> Content<E> for When<A> {
|
||||||
fn layout (&self, to: E::Area) -> E::Area {
|
fn layout (&self, to: E::Area) -> E::Area {
|
||||||
let Self(cond, item) = self;
|
let Self(cond, item) = self;
|
||||||
|
|
@ -73,7 +55,24 @@ impl<E: Output, A: Render<E>> Content<E> for When<A> {
|
||||||
if *cond { item.render(to) }
|
if *cond { item.render(to) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#[cfg(feature = "dsl")]
|
||||||
|
impl<A, B, T: Dsl<bool> + Dsl<A> + Dsl<B>> FromDsl<T> for Either<A, B> {
|
||||||
|
fn take_from <'state, 'source: 'state> (
|
||||||
|
state: &'state T,
|
||||||
|
token: &mut TokenIter<'source>
|
||||||
|
) -> Perhaps<Self> {
|
||||||
|
if let Some(Token { value: Value::Key("either"), .. }) = token.peek() {
|
||||||
|
let base = token.clone();
|
||||||
|
let _ = token.next().unwrap();
|
||||||
|
return Ok(Some(Self(
|
||||||
|
state.take_or_fail(token, "either: no condition")?,
|
||||||
|
state.take_or_fail(token, "either: no content 1")?,
|
||||||
|
state.take_or_fail(token, "either: no content 2")?,
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
}
|
||||||
impl<E: Output, A: Render<E>, B: Render<E>> Content<E> for Either<A, B> {
|
impl<E: Output, A: Render<E>, B: Render<E>> Content<E> for Either<A, B> {
|
||||||
fn layout (&self, to: E::Area) -> E::Area {
|
fn layout (&self, to: E::Area) -> E::Area {
|
||||||
let Self(cond, a, b) = self;
|
let Self(cond, a, b) = self;
|
||||||
|
|
|
||||||
|
|
@ -26,31 +26,24 @@ use crate::*;
|
||||||
/// along either the X axis, the Y axis, or both.
|
/// along either the X axis, the Y axis, or both.
|
||||||
macro_rules! transform_xy {
|
macro_rules! transform_xy {
|
||||||
($x:literal $y:literal $xy:literal |$self:ident : $Enum:ident, $to:ident|$area:expr) => {
|
($x:literal $y:literal $xy:literal |$self:ident : $Enum:ident, $to:ident|$area:expr) => {
|
||||||
pub enum $Enum<T> { X(T), Y(T), XY(T) }
|
pub enum $Enum<A> { X(A), Y(A), XY(A) }
|
||||||
impl<T> $Enum<T> {
|
impl<A> $Enum<A> {
|
||||||
#[inline] pub const fn x (item: T) -> Self {
|
#[inline] pub const fn x (item: A) -> Self { Self::X(item) }
|
||||||
Self::X(item)
|
#[inline] pub const fn y (item: A) -> Self { Self::Y(item) }
|
||||||
}
|
#[inline] pub const fn xy (item: A) -> Self { Self::XY(item) }
|
||||||
#[inline] pub const fn y (item: T) -> Self {
|
|
||||||
Self::Y(item)
|
|
||||||
}
|
|
||||||
#[inline] pub const fn xy (item: T) -> Self {
|
|
||||||
Self::XY(item)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'state, E: Output + 'state, T: ViewContext<'state, E>>
|
impl<A, T: Dsl<A>> FromDsl<T> for $Enum<A> {
|
||||||
Dsl<T> for $Enum<RenderBox<'state, E>> {
|
fn take_from <'state, 'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
||||||
fn take_from <'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
|
||||||
if let Some(Token { value: Value::Key(k), .. }) = iter.peek() {
|
if let Some(Token { value: Value::Key(k), .. }) = iter.peek() {
|
||||||
let mut base = iter.clone();
|
let mut base = iter.clone();
|
||||||
return Ok(Some(match iter.next() {
|
return Ok(Some(match iter.next() {
|
||||||
Some(Token{value:Value::Key($x),..}) =>
|
Some(Token{value:Value::Key($x),..}) =>
|
||||||
Self::x(state.get_content_or_fail(iter)?),
|
Self::x(state.take_or_fail(iter, "x: no content")?),
|
||||||
Some(Token{value:Value::Key($y),..}) =>
|
Some(Token{value:Value::Key($y),..}) =>
|
||||||
Self::y(state.get_content_or_fail(iter)?),
|
Self::y(state.take_or_fail(iter, "y: no content")?),
|
||||||
Some(Token{value:Value::Key($xy),..}) =>
|
Some(Token{value:Value::Key($xy),..}) =>
|
||||||
Self::xy(state.get_content_or_fail(iter)?),
|
Self::xy(state.take_or_fail(iter, "xy: no content")?),
|
||||||
_ => unreachable!()
|
_ => unreachable!()
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
@ -77,31 +70,30 @@ macro_rules! transform_xy {
|
||||||
/// along either the X axis, the Y axis, or both.
|
/// along either the X axis, the Y axis, or both.
|
||||||
macro_rules! transform_xy_unit {
|
macro_rules! transform_xy_unit {
|
||||||
($x:literal $y:literal $xy:literal |$self:ident : $Enum:ident, $to:ident|$layout:expr) => {
|
($x:literal $y:literal $xy:literal |$self:ident : $Enum:ident, $to:ident|$layout:expr) => {
|
||||||
pub enum $Enum<U, T> { X(U, T), Y(U, T), XY(U, U, T), }
|
pub enum $Enum<U, A> { X(U, A), Y(U, A), XY(U, U, A), }
|
||||||
impl<U, T> $Enum<U, T> {
|
impl<U, A> $Enum<U, A> {
|
||||||
#[inline] pub const fn x (x: U, item: T) -> Self { Self::X(x, item) }
|
#[inline] pub const fn x (x: U, item: A) -> Self { Self::X(x, item) }
|
||||||
#[inline] pub const fn y (y: U, item: T) -> Self { Self::Y(y, item) }
|
#[inline] pub const fn y (y: U, item: A) -> Self { Self::Y(y, item) }
|
||||||
#[inline] pub const fn xy (x: U, y: U, item: T) -> Self { Self::XY(x, y, item) }
|
#[inline] pub const fn xy (x: U, y: U, item: A) -> Self { Self::XY(x, y, item) }
|
||||||
}
|
}
|
||||||
#[cfg(feature = "dsl")]
|
#[cfg(feature = "dsl")]
|
||||||
impl<'state, E: Output + 'state, T: ViewContext<'state, E>>
|
impl<A, U: Coordinate, T: Dsl<A> + Dsl<U>> FromDsl<T> for $Enum<U, A> {
|
||||||
Dsl<T> for $Enum<E::Unit, RenderBox<'state, E>> {
|
fn take_from <'state, 'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
||||||
fn take_from <'source: 'state> (state: &'state T, iter: &mut TokenIter<'source>) -> Perhaps<Self> {
|
|
||||||
Ok(if let Some(Token { value: Value::Key($x|$y|$xy), .. }) = iter.peek() {
|
Ok(if let Some(Token { value: Value::Key($x|$y|$xy), .. }) = iter.peek() {
|
||||||
let mut base = iter.clone();
|
let mut base = iter.clone();
|
||||||
Some(match iter.next() {
|
Some(match iter.next() {
|
||||||
Some(Token { value: Value::Key($x), .. }) => Self::x(
|
Some(Token { value: Value::Key($x), .. }) => Self::x(
|
||||||
state.take_or_fail(iter, "no unit specified")?,
|
state.take_or_fail(iter, "x: no unit")?,
|
||||||
state.get_content_or_fail(iter)?,
|
state.take_or_fail(iter, "x: no content")?,
|
||||||
),
|
),
|
||||||
Some(Token { value: Value::Key($y), .. }) => Self::y(
|
Some(Token { value: Value::Key($y), .. }) => Self::y(
|
||||||
state.take_or_fail(iter, "no unit specified")?,
|
state.take_or_fail(iter, "y: no unit")?,
|
||||||
state.get_content_or_fail(iter)?,
|
state.take_or_fail(iter, "y: no content")?,
|
||||||
),
|
),
|
||||||
Some(Token { value: Value::Key($x), .. }) => Self::xy(
|
Some(Token { value: Value::Key($x), .. }) => Self::xy(
|
||||||
state.take_or_fail(iter, "no unit specified")?,
|
state.take_or_fail(iter, "xy: no unit x")?,
|
||||||
state.take_or_fail(iter, "no unit specified")?,
|
state.take_or_fail(iter, "xy: no unit y")?,
|
||||||
state.get_content_or_fail(iter)?
|
state.take_or_fail(iter, "xy: no content")?
|
||||||
),
|
),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,54 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
#[cfg(feature = "dsl")]
|
//#[cfg(feature = "dsl")]
|
||||||
#[macro_export] macro_rules! try_delegate {
|
//#[macro_export] macro_rules! try_delegate {
|
||||||
($s:ident, $dsl:expr, $T:ty) => {
|
//($s:ident, $dsl:expr, $T:ty) => {
|
||||||
let value: Option<$T> = Dsl::take_from($s, $dsl)?;
|
//let value: Option<$T> = Dsl::take_from($s, $dsl)?;
|
||||||
if let Some(value) = value {
|
//if let Some(value) = value {
|
||||||
return Ok(Some(value.boxed()))
|
//return Ok(Some(value.boxed()))
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
|
|
||||||
// Provides components to the view.
|
//// Provides components to the view.
|
||||||
#[cfg(feature = "dsl")]
|
//#[cfg(feature = "dsl")]
|
||||||
pub trait ViewContext<'state, E: Output + 'state>: Send + Sync where
|
//pub trait ViewContext<'state, E: Output + 'state>:
|
||||||
bool: Dsl<Self>,
|
//FromDsl<bool> + FromDsl<usize> + FromDsl<E::Unit> + Send + Sync
|
||||||
usize: Dsl<Self>,
|
//{
|
||||||
E::Unit: Dsl<Self>,
|
//fn get_content_sym <'source: 'state> (&'state self, iter: &mut TokenIter<'source>)
|
||||||
{
|
//-> Perhaps<RenderBox<'state, E>>;
|
||||||
fn get_content_or_fail <'source: 'state> (&'state self, iter: &mut TokenIter<'source>)
|
//fn get_content_exp <'source: 'state> (&'state self, iter: &mut TokenIter<'source>)
|
||||||
-> Usually<RenderBox<'state, E>>
|
//-> Perhaps<RenderBox<'state, E>>
|
||||||
{
|
//{
|
||||||
let base = iter.clone();
|
//try_delegate!(self, iter, When::<RenderBox<'state, E>>);
|
||||||
if let Some(content) = self.get_content(iter)? {
|
//try_delegate!(self, iter, Either::<RenderBox<'state, E>, RenderBox<'state, E>>);
|
||||||
Ok(content)
|
//try_delegate!(self, iter, Align::<RenderBox<'state, E>>);
|
||||||
} else {
|
//try_delegate!(self, iter, Bsp::<RenderBox<'state, E>, RenderBox<'state, E>>);
|
||||||
Err(format!("not found: {iter:?}").into())
|
//try_delegate!(self, iter, Fill::<RenderBox<'state, E>>);
|
||||||
}
|
//try_delegate!(self, iter, Fixed::<_, RenderBox<'state, E>>);
|
||||||
}
|
//try_delegate!(self, iter, Min::<_, RenderBox<'state, E>>);
|
||||||
fn get_content <'source: 'state> (&'state self, iter: &mut TokenIter<'source>)
|
//try_delegate!(self, iter, Max::<_, RenderBox<'state, E>>);
|
||||||
-> Perhaps<RenderBox<'state, E>>
|
//try_delegate!(self, iter, Shrink::<_, RenderBox<'state, E>>);
|
||||||
{
|
//try_delegate!(self, iter, Expand::<_, RenderBox<'state, E>>);
|
||||||
match iter.peek() {
|
//try_delegate!(self, iter, Push::<_, RenderBox<'state, E>>);
|
||||||
Some(Token { value: Value::Sym(_), .. }) =>
|
//try_delegate!(self, iter, Pull::<_, RenderBox<'state, E>>);
|
||||||
self.get_content_sym(iter),
|
//try_delegate!(self, iter, Margin::<_, RenderBox<'state, E>>);
|
||||||
Some(Token { value: Value::Exp(_, _), .. }) =>
|
//try_delegate!(self, iter, Padding::<_, RenderBox<'state, E>>);
|
||||||
self.get_content_exp(iter),
|
//Ok(None)
|
||||||
None => Ok(None),
|
//}
|
||||||
_ => panic!("only :symbols and (expressions) accepted here")
|
//}
|
||||||
}
|
|
||||||
}
|
//#[cfg(feature = "dsl")]
|
||||||
fn get_content_sym <'source: 'state> (&'state self, iter: &mut TokenIter<'source>)
|
//impl<'context, O: Output + 'context, T: ViewContext<'context, O>> FromDsl<T> for RenderBox<'context, O> {
|
||||||
-> Perhaps<RenderBox<'state, E>>;
|
//fn take_from <'state, 'source: 'state> (state: &'state T, token: &mut TokenIter<'source>)
|
||||||
fn get_content_exp <'source: 'state> (&'state self, iter: &mut TokenIter<'source>)
|
//-> Perhaps<RenderBox<'context, O>>
|
||||||
-> Perhaps<RenderBox<'state, E>>
|
//{
|
||||||
{
|
//Ok(if let Some(content) = state.get_content_sym(token)? {
|
||||||
try_delegate!(self, iter, When::<RenderBox<'state, E>>);
|
//Some(content)
|
||||||
try_delegate!(self, iter, Either::<RenderBox<'state, E>, RenderBox<'state, E>>);
|
//} else if let Some(content) = state.get_content_exp(token)? {
|
||||||
try_delegate!(self, iter, Align::<RenderBox<'state, E>>);
|
//Some(content)
|
||||||
try_delegate!(self, iter, Bsp::<RenderBox<'state, E>, RenderBox<'state, E>>);
|
//} else {
|
||||||
try_delegate!(self, iter, Fill::<RenderBox<'state, E>>);
|
//None
|
||||||
try_delegate!(self, iter, Fixed::<_, RenderBox<'state, E>>);
|
//})
|
||||||
try_delegate!(self, iter, Min::<_, RenderBox<'state, E>>);
|
//}
|
||||||
try_delegate!(self, iter, Max::<_, RenderBox<'state, E>>);
|
//}
|
||||||
try_delegate!(self, iter, Shrink::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Expand::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Push::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Pull::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Margin::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Padding::<_, RenderBox<'state, E>>);
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -144,12 +144,11 @@ impl ToTokens for CommandDef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Generated by [tengri_proc].
|
/// Generated by [tengri_proc].
|
||||||
impl ::tengri::dsl::Dsl<#command_enum> for #state {
|
impl ::tengri::dsl::FromDsl<#state> for #command_enum {
|
||||||
fn take <'source, 'state> (
|
fn take_from <'state, 'source: 'state> (
|
||||||
&'state self, words: &mut TokenIter<'source>
|
state: &'state #state,
|
||||||
)
|
words: &mut TokenIter<'source>,
|
||||||
-> ::tengri::Perhaps<#command_enum>
|
) -> Perhaps<Self> {
|
||||||
{
|
|
||||||
let mut words = words.clone();
|
let mut words = words.clone();
|
||||||
let token = words.next();
|
let token = words.next();
|
||||||
todo!()//Ok(match token { #(#matchers)* _ => None })
|
todo!()//Ok(match token { #(#matchers)* _ => None })
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ impl ToTokens for ExposeDef {
|
||||||
impl ToTokens for ExposeImpl {
|
impl ToTokens for ExposeImpl {
|
||||||
fn to_tokens (&self, out: &mut TokenStream2) {
|
fn to_tokens (&self, out: &mut TokenStream2) {
|
||||||
let Self(block, exposed) = self;
|
let Self(block, exposed) = self;
|
||||||
let target = &block.self_ty;
|
let exposed_impl_type = &block.self_ty;
|
||||||
write_quote_to(out, quote! { #block });
|
write_quote_to(out, quote! { #block });
|
||||||
for (t, variants) in exposed.iter() {
|
for (t, variants) in exposed.iter() {
|
||||||
let formatted_type = format!("{}", quote! { #t });
|
let formatted_type = format!("{}", quote! { #t });
|
||||||
|
|
@ -84,12 +84,13 @@ impl ToTokens for ExposeImpl {
|
||||||
};
|
};
|
||||||
let values = variants.iter().map(ExposeArm::from);
|
let values = variants.iter().map(ExposeArm::from);
|
||||||
write_quote_to(out, quote! {
|
write_quote_to(out, quote! {
|
||||||
/// Generated by [tengri_proc].
|
/// Generated by [tengriproc].
|
||||||
impl ::tengri::dsl::Dsl<#t> for #target {
|
impl ::tengri::dsl::Dsl<#t> for #exposed_impl_type {
|
||||||
fn take <'state, 'source> (
|
fn take <'state, 'source: 'state> (
|
||||||
&'state self, iter: &mut ::tengri::dsl::TokenIter<'source>
|
&'state self,
|
||||||
|
words: &mut ::tengri::dsl::TokenIter<'source>
|
||||||
) -> Perhaps<#t> {
|
) -> Perhaps<#t> {
|
||||||
Ok(Some(match iter.next().map(|x|x.value) {
|
Ok(Some(match words.next().map(|x|x.value) {
|
||||||
#predefined
|
#predefined
|
||||||
#(#values,)*
|
#(#values,)*
|
||||||
_ => return Ok(None)
|
_ => return Ok(None)
|
||||||
|
|
|
||||||
|
|
@ -41,15 +41,33 @@ impl Parse for ViewImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn builtins () -> [TokenStream2;14] {
|
||||||
|
[
|
||||||
|
quote! { When::<A> },
|
||||||
|
quote! { Either::<A, B> },
|
||||||
|
quote! { Align::<A> },
|
||||||
|
quote! { Bsp::<A, B> },
|
||||||
|
quote! { Fill::<A> },
|
||||||
|
quote! { Fixed::<_, A> },
|
||||||
|
quote! { Min::<_, A> },
|
||||||
|
quote! { Max::<_, A> },
|
||||||
|
quote! { Shrink::<_, A> },
|
||||||
|
quote! { Expand::<_, A> },
|
||||||
|
quote! { Push::<_, A> },
|
||||||
|
quote! { Pull::<_, A> },
|
||||||
|
quote! { Margin::<_, A> },
|
||||||
|
quote! { Padding::<_, A> },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
impl ToTokens for ViewDef {
|
impl ToTokens for ViewDef {
|
||||||
fn to_tokens (&self, out: &mut TokenStream2) {
|
fn to_tokens (&self, out: &mut TokenStream2) {
|
||||||
let Self(ViewMeta { output }, ViewImpl { block, exposed }) = self;
|
let Self(ViewMeta { output }, ViewImpl { block, exposed }) = self;
|
||||||
let view = &block.self_ty;
|
let view = &block.self_ty;
|
||||||
let mut available = vec![];
|
let mut available = vec![];
|
||||||
let exposed: Vec<_> = exposed.iter().map(|(k,v)|{
|
let exposed: Vec<_> = exposed.iter()
|
||||||
available.push(k.clone());
|
.map(|(k,v)|{ available.push(k.clone()); ViewArm(k.clone(), v.clone()) })
|
||||||
ViewArm(k.clone(), v.clone())
|
.collect();
|
||||||
}).collect();
|
|
||||||
let available: String = available.join(", ");
|
let available: String = available.join(", ");
|
||||||
let error_msg = LitStr::new(
|
let error_msg = LitStr::new(
|
||||||
&format!("expected Sym(content), got: {{token:?}}, available: {available}"),
|
&format!("expected Sym(content), got: {{token:?}}, available: {available}"),
|
||||||
|
|
@ -58,43 +76,33 @@ impl ToTokens for ViewDef {
|
||||||
for token in quote! {
|
for token in quote! {
|
||||||
#block
|
#block
|
||||||
/// Generated by [tengri_proc].
|
/// Generated by [tengri_proc].
|
||||||
|
///
|
||||||
|
/// Delegates the rendering of [#view] to the [#view::view} method,
|
||||||
|
/// which you will need to implement, e.g. passing a [TokenIter]
|
||||||
|
/// containing a layout and keybindings config from user dirs.
|
||||||
impl ::tengri::output::Content<#output> for #view {
|
impl ::tengri::output::Content<#output> for #view {
|
||||||
fn content (&self) -> impl Render<#output> {
|
fn content (&self) -> impl Render<#output> {
|
||||||
self.view()
|
self.view()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Generated by [tengri_proc].
|
/// Generated by [tengri_proc].
|
||||||
impl<'state> ::tengri::dsl::FromDsl<'state, #view>
|
///
|
||||||
for ::tengri::output::RenderBox<'state, #output> {
|
/// Gives [#view] the ability to construct the [Render]able
|
||||||
fn take_from <'source: 'state> (
|
/// which might corresponds to a given [TokenStream],
|
||||||
state: &'state #view,
|
/// while taking [#view]'s state into consideration.
|
||||||
token: &mut ::tengri::dsl::TokenIter<'source>
|
impl<'context> ::tengri::dsl::FromDsl<#view> for RenderBox<'context, #output> {
|
||||||
|
fn take_from <'state, 'source: 'state> (
|
||||||
|
state: &'state #view, words: &mut ::tengri::dsl::TokenIter<'source>
|
||||||
) -> Perhaps<Self> {
|
) -> Perhaps<Self> {
|
||||||
Ok(match token.peek() {
|
Ok(match words.peek() {
|
||||||
Some(::tengri::dsl::Token {
|
Some(::tengri::dsl::Token { value: ::tengri::dsl::Value::Exp(exp), .. }) => {
|
||||||
::tengri::dsl::value: Value::Exp(exp), ..
|
if let Some(value) = FromDsl::take_from(state, words)? {
|
||||||
}) => {
|
|
||||||
let value: Option<$T> = FromDsl::take_from($s, $dsl)?;
|
|
||||||
if let Some(value) = value {
|
|
||||||
return Ok(Some(value.boxed()))
|
return Ok(Some(value.boxed()))
|
||||||
}
|
}
|
||||||
try_delegate!(self, iter, When::<RenderBox<'state, E>>);
|
//#builtins
|
||||||
try_delegate!(self, iter, Either::<RenderBox<'state, E>, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Align::<RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Bsp::<RenderBox<'state, E>, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Fill::<RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Fixed::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Min::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Max::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Shrink::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Expand::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Push::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Pull::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Margin::<_, RenderBox<'state, E>>);
|
|
||||||
try_delegate!(self, iter, Padding::<_, RenderBox<'state, E>>);
|
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
#(#exposed),*
|
#(#exposed)*
|
||||||
_ => None
|
_ => None
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -162,5 +170,6 @@ impl ToTokens for ViewArm {
|
||||||
out.append(Group::new(Delimiter::Parenthesis, TokenStream2::new()));
|
out.append(Group::new(Delimiter::Parenthesis, TokenStream2::new()));
|
||||||
out
|
out
|
||||||
}));
|
}));
|
||||||
|
out.append(Punct::new(',', Alone));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue