mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
expose less
This commit is contained in:
parent
3b647274dc
commit
dc7c384b49
3 changed files with 2 additions and 15 deletions
|
@ -5,7 +5,7 @@ use crate::keyword;
|
||||||
use crate::parser::{
|
use crate::parser::{
|
||||||
self, backtrackable, optional, sep_by1, sep_by1_e, specialize, specialize_ref, then,
|
self, backtrackable, optional, sep_by1, sep_by1_e, specialize, specialize_ref, then,
|
||||||
trailing_sep_by0, word1, word2, EExpr, EInParens, ELambda, EPattern, ERecord, EString, Either,
|
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::pattern::loc_closure_param;
|
||||||
use crate::type_annotation;
|
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>> {
|
pub fn expr_help<'a>(min_indent: u16) -> impl Parser<'a, Expr<'a>, EExpr<'a>> {
|
||||||
move |arena, state: State<'a>| {
|
move |arena, state: State<'a>| {
|
||||||
parse_expr_help(min_indent, arena, state).map(|(a, b, c)| (a, b.value, c))
|
parse_expr_help(min_indent, arena, state).map(|(a, b, c)| (a, b.value, c))
|
||||||
|
|
|
@ -28,6 +28,7 @@ mod test_parse {
|
||||||
AppHeader, Effects, ExposesEntry, ImportsEntry, InterfaceHeader, ModuleName, PackageEntry,
|
AppHeader, Effects, ExposesEntry, ImportsEntry, InterfaceHeader, ModuleName, PackageEntry,
|
||||||
PackageName, PackageOrPath, PlatformHeader, To,
|
PackageName, PackageOrPath, PlatformHeader, To,
|
||||||
};
|
};
|
||||||
|
use roc_parse::module::module_defs;
|
||||||
use roc_parse::parser::{Parser, State, SyntaxError};
|
use roc_parse::parser::{Parser, State, SyntaxError};
|
||||||
use roc_parse::test_helpers::parse_expr_with;
|
use roc_parse::test_helpers::parse_expr_with;
|
||||||
use roc_region::all::{Located, Region};
|
use roc_region::all::{Located, Region};
|
||||||
|
|
|
@ -18,7 +18,6 @@ use roc_module::operator::CalledVia;
|
||||||
use roc_module::symbol::{IdentIds, ModuleId, ModuleIds, Symbol};
|
use roc_module::symbol::{IdentIds, ModuleId, ModuleIds, Symbol};
|
||||||
use roc_parse::ast;
|
use roc_parse::ast;
|
||||||
use roc_parse::ast::StrLiteral;
|
use roc_parse::ast::StrLiteral;
|
||||||
use roc_parse::expr::expr;
|
|
||||||
use roc_parse::parser::{loc, Parser, State, SyntaxError};
|
use roc_parse::parser::{loc, Parser, State, SyntaxError};
|
||||||
use roc_problem::can::{Problem, RuntimeError};
|
use roc_problem::can::{Problem, RuntimeError};
|
||||||
use roc_region::all::{Located, Region};
|
use roc_region::all::{Located, Region};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue