expose less

This commit is contained in:
Folkert 2021-03-18 14:52:37 +01:00
parent 3b647274dc
commit dc7c384b49
3 changed files with 2 additions and 15 deletions

View File

@ -5,7 +5,7 @@ use crate::keyword;
use crate::parser::{
self, backtrackable, optional, sep_by1, sep_by1_e, specialize, specialize_ref, then,
trailing_sep_by0, word1, word2, EExpr, EInParens, ELambda, EPattern, ERecord, EString, Either,
If, List, Number, ParseResult, Parser, State, SyntaxError, Type, When,
If, List, Number, ParseResult, Parser, State, Type, When,
};
use crate::pattern::loc_closure_param;
use crate::type_annotation;
@ -34,19 +34,6 @@ pub fn test_parse_expr<'a>(
}
}
// public for testing purposes
pub fn expr<'a>(min_indent: u16) -> impl Parser<'a, Expr<'a>, SyntaxError<'a>> {
// Recursive parsers must not directly invoke functions which return (impl Parser),
// as this causes rustc to stack overflow. Thus, parse_expr must be a
// separate function which recurses by calling itself directly.
specialize(
|e, _, _| SyntaxError::Expr(e),
move |arena, state: State<'a>| {
parse_expr_help(min_indent, arena, state).map(|(a, b, c)| (a, b.value, c))
},
)
}
pub fn expr_help<'a>(min_indent: u16) -> impl Parser<'a, Expr<'a>, EExpr<'a>> {
move |arena, state: State<'a>| {
parse_expr_help(min_indent, arena, state).map(|(a, b, c)| (a, b.value, c))

View File

@ -28,6 +28,7 @@ mod test_parse {
AppHeader, Effects, ExposesEntry, ImportsEntry, InterfaceHeader, ModuleName, PackageEntry,
PackageName, PackageOrPath, PlatformHeader, To,
};
use roc_parse::module::module_defs;
use roc_parse::parser::{Parser, State, SyntaxError};
use roc_parse::test_helpers::parse_expr_with;
use roc_region::all::{Located, Region};

View File

@ -18,7 +18,6 @@ use roc_module::operator::CalledVia;
use roc_module::symbol::{IdentIds, ModuleId, ModuleIds, Symbol};
use roc_parse::ast;
use roc_parse::ast::StrLiteral;
use roc_parse::expr::expr;
use roc_parse::parser::{loc, Parser, State, SyntaxError};
use roc_problem::can::{Problem, RuntimeError};
use roc_region::all::{Located, Region};