parse toplevel defs into an SOA structure

This commit is contained in:
Folkert 2022-05-23 22:07:37 +02:00
parent 37fed3fbdb
commit 2ae804790a
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
13 changed files with 750 additions and 512 deletions

View file

@ -1,11 +1,11 @@
use crate::ast;
use crate::module::module_defs;
use crate::ast::Def;
use crate::module::module_defs_help;
// use crate::module::module_defs;
use crate::parser::Parser;
use crate::parser::SourceError;
use crate::parser::SyntaxError;
use crate::state::State;
use bumpalo::collections::Vec as BumpVec;
use bumpalo::Bump;
use roc_region::all::Loc;
use roc_region::all::Position;
@ -35,10 +35,10 @@ pub fn parse_loc_with<'a>(
pub fn parse_defs_with<'a>(
arena: &'a Bump,
input: &'a str,
) -> Result<BumpVec<'a, Loc<ast::Def<'a>>>, SyntaxError<'a>> {
) -> Result<bumpalo::collections::Vec<'a, Loc<Def<'a>>>, SyntaxError<'a>> {
let state = State::new(input.trim().as_bytes());
match module_defs().parse(arena, state) {
match module_defs_help().parse(arena, state) {
Ok(tuple) => Ok(tuple.1),
Err(tuple) => Err(tuple.1),
}