mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-16 09:35:07 +01:00
a bunch of stuff mostly
This commit is contained in:
parent
56e7f77a0d
commit
b9a2f939c4
29 changed files with 734 additions and 345 deletions
|
|
@ -3,9 +3,9 @@ use std::fmt::Debug;
|
|||
use bitflags::bitflags;
|
||||
use dbg_pls::DebugPls;
|
||||
|
||||
use crate::Spanned;
|
||||
use crate::{sym::Symbol, Spanned};
|
||||
|
||||
pub type Ident = Spanned<String>;
|
||||
pub type Ident = Spanned<Symbol>;
|
||||
|
||||
//
|
||||
// --- Expr
|
||||
|
|
@ -114,7 +114,7 @@ pub enum Stmt {
|
|||
},
|
||||
Compound(Vec<Spanned<Stmt>>),
|
||||
If {
|
||||
cond: Expr,
|
||||
cond: Spanned<Expr>,
|
||||
then: Vec<Spanned<Stmt>>,
|
||||
otherwise: Option<Vec<Spanned<Stmt>>>,
|
||||
},
|
||||
|
|
@ -141,7 +141,7 @@ pub enum Stmt {
|
|||
// --- Types and decls and garbage whatever
|
||||
//
|
||||
|
||||
#[derive(Debug, DebugPls)]
|
||||
#[derive(Debug, DebugPls, Clone, Copy)]
|
||||
pub enum IntTySignedness {
|
||||
Signed,
|
||||
Unsigned,
|
||||
|
|
@ -154,7 +154,7 @@ impl Default for IntTySignedness {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, DebugPls)]
|
||||
#[derive(Debug, DebugPls, Clone, Copy)]
|
||||
pub enum IntTyKind {
|
||||
Short,
|
||||
Int,
|
||||
|
|
@ -162,7 +162,7 @@ pub enum IntTyKind {
|
|||
LongLong,
|
||||
}
|
||||
|
||||
#[derive(Debug, DebugPls)]
|
||||
#[derive(Debug, DebugPls, Clone, Copy)]
|
||||
pub struct IntTy {
|
||||
pub sign: IntTySignedness,
|
||||
pub kind: IntTyKind,
|
||||
|
|
@ -283,4 +283,11 @@ impl DirectDeclarator {
|
|||
DirectDeclarator::WithParams { ident, params } => (ident, params),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> Ident {
|
||||
match *self {
|
||||
DirectDeclarator::Ident(ident) => ident,
|
||||
DirectDeclarator::WithParams { ident, .. } => ident,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue