cleanup blankspace function usage

This commit is contained in:
Folkert 2021-03-11 16:37:42 +01:00
parent 92cff4c32a
commit e214674016
5 changed files with 51 additions and 66 deletions

View file

@ -1,6 +1,5 @@
use crate::ast::{CommentOrNewline, Def, Module};
use crate::blankspace::{space0_around, space0_before_e, space0_e};
use crate::expr::def;
use crate::blankspace::{space0_before_e, space0_e};
use crate::header::{
package_entry, package_name, package_or_path, AppHeader, Effects, ExposesEntry, ImportsEntry,
InterfaceHeader, ModuleName, PackageEntry, PlatformHeader, To, TypedIdent,
@ -252,8 +251,22 @@ fn platform_header<'a>() -> impl Parser<'a, PlatformHeader<'a>, EHeader<'a>> {
#[inline(always)]
pub fn module_defs<'a>() -> impl Parser<'a, Vec<'a, Located<Def<'a>>>, SyntaxError<'a>> {
use crate::parser::EExpr;
// force that we pare until the end of the input
skip_second!(zero_or_more!(space0_around(loc!(def(0)), 0)), end_of_file())
let min_indent = 0;
skip_second!(
specialize(
|e, _, _| SyntaxError::Expr(e),
zero_or_more!(crate::blankspace::space0_around_ee(
loc!(crate::expr::def_help(min_indent)),
min_indent,
EExpr::Space,
EExpr::IndentStart,
EExpr::IndentEnd,
))
),
end_of_file()
)
}
#[derive(Debug)]
struct ProvidesTo<'a> {