mirror of
https://github.com/Noratrieb/uwucc.git
synced 2026-01-14 16:45:07 +01:00
pretty colors
This commit is contained in:
parent
79ab4bbb75
commit
bf2ea3f7f4
10 changed files with 54 additions and 52 deletions
|
|
@ -11,7 +11,7 @@ use crate::{
|
|||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
struct ParserError {
|
||||
pub struct ParserError {
|
||||
span: Span,
|
||||
message: String,
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ where
|
|||
/// function-specifier declaration-specifiers.opt
|
||||
/// alignment-specifier declaration-specifiers.opt
|
||||
fn decl_specifiers(&mut self) -> Result<Spanned<DeclSpec>> {
|
||||
let mut decl_attr = DeclAttr::default();
|
||||
let mut decl_attr = DeclAttr::empty();
|
||||
let &(_, initial_span) = self.peek_t()?;
|
||||
let (ty, span) = loop {
|
||||
match self.peek_t()?.0 {
|
||||
|
|
@ -224,15 +224,15 @@ where
|
|||
}
|
||||
Tok::Kw(Kw::Extern) => {
|
||||
self.next_t()?;
|
||||
decl_attr.is_extern = true;
|
||||
decl_attr |= DeclAttr::EXTERN;
|
||||
}
|
||||
Tok::Kw(Kw::Static) => {
|
||||
self.next_t()?;
|
||||
decl_attr.is_static = true;
|
||||
decl_attr |= DeclAttr::STATIC;
|
||||
}
|
||||
Tok::Kw(Kw::ThreadLocal) => {
|
||||
self.next_t()?;
|
||||
decl_attr.is_thread_local = true;
|
||||
decl_attr |= DeclAttr::THREAD_LOCAL;
|
||||
}
|
||||
// (6.7.3) type-qualifier:
|
||||
Tok::Kw(Kw::Const | Kw::Restrict | Kw::Volatile | Kw::Atomic) => {
|
||||
|
|
@ -406,5 +406,17 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_declarations<'src>(
|
||||
src: impl Iterator<Item = (Tok<'src>, Span)>,
|
||||
) -> Result<Vec<Spanned<ExternalDecl>>> {
|
||||
use peekmore::PeekMore;
|
||||
|
||||
let mut parser = Parser {
|
||||
lex: src.peekmore(),
|
||||
};
|
||||
|
||||
parser.external_declarations()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue