Introduce Type::Signature to the AST

This commit is contained in:
Pranav Gaddamadugu 2023-08-02 19:49:30 -04:00
parent e180118a30
commit 46e9313e55
3 changed files with 6 additions and 0 deletions

View File

@ -40,6 +40,8 @@ pub enum Type {
Mapping(MappingType),
/// The `scalar` type.
Scalar,
/// The `signature` type.
Signature,
/// The `string` type.
String,
/// A static tuple of at least one type.
@ -64,6 +66,7 @@ impl Type {
| (Type::Field, Type::Field)
| (Type::Group, Type::Group)
| (Type::Scalar, Type::Scalar)
| (Type::Signature, Type::Signature)
| (Type::String, Type::String)
| (Type::Unit, Type::Unit) => true,
(Type::Integer(left), Type::Integer(right)) => left.eq(right),
@ -90,6 +93,7 @@ impl fmt::Display for Type {
Type::Integer(ref integer_type) => write!(f, "{integer_type}"),
Type::Mapping(ref mapping_type) => write!(f, "{mapping_type}"),
Type::Scalar => write!(f, "scalar"),
Type::Signature => write!(f, "signature"),
Type::String => write!(f, "string"),
Type::Tuple(ref tuple) => write!(f, "{tuple}"),
Type::Unit => write!(f, "()"),

View File

@ -26,6 +26,7 @@ impl<'a> CodeGenerator<'a> {
| Type::Field
| Type::Group
| Type::Scalar
| Type::Signature
| Type::String
| Type::Integer(..) => format!("{input}"),
Type::Identifier(ident) => format!("{ident}"),

View File

@ -208,6 +208,7 @@ symbols! {
i128,
record,
scalar,
signature,
string,
Struct: "struct",
u8,