Add support for multiple integer types.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pub use crate::syntax::tokens::ConstantType;
|
||||
use crate::syntax::Location;
|
||||
|
||||
/// The set of valid binary operators.
|
||||
@@ -76,7 +77,7 @@ impl PartialEq for Expression {
|
||||
Expression::Cast(_, t1, e1) => match other {
|
||||
Expression::Cast(_, t2, e2) => t1 == t2 && e1 == e2,
|
||||
_ => false,
|
||||
}
|
||||
},
|
||||
Expression::Primitive(_, prim1, args1) => match other {
|
||||
Expression::Primitive(_, prim2, args2) => prim1 == prim2 && args1 == args2,
|
||||
_ => false,
|
||||
@@ -88,6 +89,12 @@ impl PartialEq for Expression {
|
||||
/// A value from the source syntax
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Value {
|
||||
/// The value of the number, and an optional base that it was written in
|
||||
Number(Option<u8>, i64),
|
||||
/// The value of the number, an optional base that it was written in, and any
|
||||
/// type information provided.
|
||||
///
|
||||
/// u64 is chosen because it should be big enough to carry the amount of
|
||||
/// information we need, and technically we interpret -4 as the primitive unary
|
||||
/// operation "-" on the number 4. We'll translate this into a type-specific
|
||||
/// number at a later time.
|
||||
Number(Option<u8>, Option<ConstantType>, u64),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user