diff options
Diffstat (limited to 'compiler/src/ast/parser.rs')
| -rw-r--r-- | compiler/src/ast/parser.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/src/ast/parser.rs b/compiler/src/ast/parser.rs index 263e5b7..33b36be 100644 --- a/compiler/src/ast/parser.rs +++ b/compiler/src/ast/parser.rs | |||
| @@ -1,8 +1,8 @@ | |||
| 1 | use std::iter::Peekable; | 1 | use std::iter::Peekable; |
| 2 | 2 | ||
| 3 | use crate::{ | 3 | use crate::{ |
| 4 | ast::{Atom, Error, Expr, Program}, | 4 | ast::{Ast, Atom, Error, Expr}, |
| 5 | lexer::Token, | 5 | lex::Token, |
| 6 | span::{Pos, Span, Spanned}, | 6 | span::{Pos, Span, Spanned}, |
| 7 | }; | 7 | }; |
| 8 | 8 | ||
| @@ -174,13 +174,13 @@ where | |||
| 174 | Err(Spanned::new(Error::UnclosedLeftPar, left_par_span)) | 174 | Err(Spanned::new(Error::UnclosedLeftPar, left_par_span)) |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | pub fn parse(mut self) -> Result<Program, Spanned<Error>> { | 177 | pub fn parse(mut self) -> Result<Ast, Spanned<Error>> { |
| 178 | let mut program = Vec::new(); | 178 | let mut ast = Vec::new(); |
| 179 | 179 | ||
| 180 | while self.peek().is_some() { | 180 | while self.peek().is_some() { |
| 181 | program.push(self.parse_expr()?) | 181 | ast.push(self.parse_expr()?) |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | Ok(Program(program)) | 184 | Ok(Ast::new(ast)) |
| 185 | } | 185 | } |
| 186 | } | 186 | } |
