mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
maint: The macro usage for shapes was confusing
This commit is contained in:
parent
9d419f9521
commit
9ab2ce2be5
@ -236,42 +236,33 @@ pub struct ModuleShapeDef {
|
|||||||
ret: Box<Shape>,
|
ret: Box<Shape>,
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! value_enum {
|
#[doc = "Value types represent the Values that UCG can have."]
|
||||||
($doc:meta $i:tt, $t:ty, $l:ty, $($extra:tt)*) => {
|
#[derive(PartialEq, Debug, Clone)]
|
||||||
#[$doc]
|
pub enum Value {
|
||||||
#[derive(PartialEq, Debug, Clone)]
|
Empty(Position),
|
||||||
pub enum $i {
|
Boolean(PositionedItem<bool>),
|
||||||
// Simple Values
|
Int(PositionedItem<i64>),
|
||||||
Empty(Position),
|
Float(PositionedItem<f64>),
|
||||||
Boolean(PositionedItem<bool>),
|
Str(PositionedItem<String>),
|
||||||
Int(PositionedItem<i64>),
|
Symbol(PositionedItem<String>),
|
||||||
Float(PositionedItem<f64>),
|
Tuple(PositionedItem<FieldList>),
|
||||||
Str(PositionedItem<String>),
|
List(ListDef),
|
||||||
Symbol(PositionedItem<String>),
|
|
||||||
// Complex Values
|
|
||||||
Tuple(PositionedItem<$t>),
|
|
||||||
List($l),
|
|
||||||
// Extra items
|
|
||||||
$( $extra )*
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
value_enum!(
|
#[doc = "Shapes represent the types that UCG values or expressions can have."]
|
||||||
doc="Value types represent the Values that UCG can have."
|
#[derive(PartialEq, Debug, Clone)]
|
||||||
Value,
|
pub enum Shape {
|
||||||
FieldList,
|
Empty(Position),
|
||||||
ListDef,
|
Boolean(PositionedItem<bool>),
|
||||||
);
|
Int(PositionedItem<i64>),
|
||||||
|
Float(PositionedItem<f64>),
|
||||||
value_enum!(
|
Str(PositionedItem<String>),
|
||||||
doc="Shapes represent the types that UCG values or expressions can have."
|
Symbol(PositionedItem<String>),
|
||||||
Shape,
|
Tuple(PositionedItem<ShapeTuple>),
|
||||||
ShapeTuple,
|
List(PositionedItem<ShapeList>),
|
||||||
PositionedItem<ShapeList>,
|
|
||||||
Func(FuncShapeDef),
|
Func(FuncShapeDef),
|
||||||
Module(ModuleShapeDef),
|
Module(ModuleShapeDef),
|
||||||
);
|
}
|
||||||
|
|
||||||
impl Shape {
|
impl Shape {
|
||||||
pub fn merge(&self, right: &Shape) -> Option<Self> {
|
pub fn merge(&self, right: &Shape) -> Option<Self> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user