mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-14 16:45:07 +01:00
more lowering
This commit is contained in:
parent
e68ec920f5
commit
8bf9849641
7 changed files with 295 additions and 17 deletions
|
|
@ -3,7 +3,8 @@ use std::fmt::Debug;
|
|||
use bitflags::bitflags;
|
||||
use dbg_pls::DebugPls;
|
||||
|
||||
use crate::{sym::Symbol, Spanned};
|
||||
use crate::sym::Symbol;
|
||||
pub use crate::Spanned;
|
||||
|
||||
pub type Ident = Spanned<Symbol>;
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ pub type Ident = Spanned<Symbol>;
|
|||
#[derive(Debug, DebugPls)]
|
||||
pub enum Atom {
|
||||
Ident(Ident),
|
||||
Int(i128),
|
||||
Int(u128),
|
||||
Float(f64),
|
||||
String(String),
|
||||
Char(u8),
|
||||
|
|
|
|||
|
|
@ -512,7 +512,6 @@ where
|
|||
|
||||
// TODO: recover here
|
||||
let stmt = self.statement()?;
|
||||
|
||||
stmts.push(stmt);
|
||||
};
|
||||
Ok((stmts, brace_span.extend(end_span)))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
use std::{cell::RefCell, fmt::Debug, marker::PhantomData};
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
fmt::{Debug, Display},
|
||||
marker::PhantomData,
|
||||
};
|
||||
|
||||
use dbg_pls::DebugPls;
|
||||
use lasso::Spur;
|
||||
|
|
@ -37,3 +41,9 @@ impl DebugPls for Symbol {
|
|||
self.as_str(|s| f.debug_ident(s))
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Symbol {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
INTERNER.with(|i| f.write_str(i.borrow_mut().resolve(&self.spur)))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ pub enum Keyword {
|
|||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum Constant {
|
||||
Int(i128),
|
||||
Int(u128),
|
||||
Float(f64),
|
||||
Char(u8),
|
||||
// adding enumerations here makes no sense.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue