c what is this

This commit is contained in:
nora 2023-05-23 20:42:51 +02:00
parent ffd3dad040
commit 54226ad499
11 changed files with 305 additions and 57 deletions

View file

@ -17,7 +17,7 @@ pub enum Atom {
Ident(Ident),
Int(u128),
Float(f64),
String(String),
String(Vec<u8>),
Char(u8),
}
@ -157,8 +157,11 @@ impl Default for IntTySignedness {
}
}
#[derive(Debug, DebugPls, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, DebugPls, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
// N.B: Ord, order matters.
pub enum IntTyKind {
Bool,
Char,
Short,
Int,
Long,
@ -175,13 +178,10 @@ pub struct IntTy {
pub enum TypeSpecifier {
Void,
Char,
SChar,
UChar,
Integer(IntTy),
Float,
Double,
LongDouble,
Bool,
// TODO
// complex
// atomic-type-specifier
@ -294,3 +294,13 @@ impl DirectDeclarator {
}
}
}
impl IntTySignedness {
pub fn signed(self) -> bool {
matches!(self, Self::Signed)
}
pub fn unsigned(self) -> bool {
matches!(self, Self::Unsigned)
}
}