This commit is contained in:
nora 2022-07-24 18:22:52 +02:00
parent b74c11987b
commit 475a520de3
8 changed files with 61 additions and 8 deletions

View file

@ -261,4 +261,4 @@ pub enum ExternalDecl {
FunctionDef(FunctionDef),
}
pub type TranslationUnit = Vec<ExternalDecl>;
pub type TranslationUnit = Vec<Spanned<ExternalDecl>>;

View file

@ -6,7 +6,7 @@ use std::fmt::Debug;
use crate::token::Token;
mod ast;
pub mod ast;
mod parser;
mod pre;
mod pretty;

View file

@ -5,7 +5,7 @@ use crate::{
ast::{
Decl, DeclAttr, DeclSpec, Declarator, DirectDeclarator, ExternalDecl, FunctionDef,
FunctionParamDecl, Ident, InitDecl, IntTy, IntTyKind, IntTySignedness, NormalDecl, Stmt,
TypeSpecifier,
TypeSpecifier, TranslationUnit,
},
pre::Punctuator as P,
token::{Keyword as Kw, Token as Tok},
@ -567,7 +567,7 @@ where
pub fn parse_declarations<'src>(
src: impl Iterator<Item = (Tok<'src>, Span)>,
) -> Result<Vec<Spanned<ExternalDecl>>> {
) -> Result<TranslationUnit> {
use peekmore::PeekMore;
let mut parser = Parser {