if (!skip_token (LEFT_CURLY))
{
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
if (!expr_or_stmt)
{
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
t = lexer.peek_token ();
add_error (std::move (error));
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
// grammar allows for empty block expressions
add_error (Error (locus, "failed to parse inner block in const block"));
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node{});
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
auto block = std::move (block_res.value ());
{
// skip after somewhere?
// error?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
if (!skip_token (RIGHT_PAREN))
{
// skip after somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
return std::unique_ptr<AST::GroupedExpr> (
t->get_token_description ()));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
// again branch based on next token
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
// parse block expr, which is required
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::ClosureExprInnerTyped> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::ClosureExprInner> (
t->get_token_description ()));
// skip?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
// create literal based on stuff in switch
auto expr = parse_expr (AST::AttrVec (), restrictions);
if (!expr)
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::CHILD_ERROR);
return std::unique_ptr<AST::BoxExpr> (
new AST::BoxExpr (std::move (expr.value ()), std::move (outer_attrs),
auto block_expr = parse_block_expr ();
if (!block_expr)
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::CHILD_ERROR);
return std::unique_ptr<AST::TryExpr> (
new AST::TryExpr (std::move (block_expr.value ()), std::move (outer_attrs),
new AST::BreakExpr (std::move (label), tl::nullopt,
std::move (outer_attrs), locus));
else
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::CHILD_ERROR);
}
// Parses a continue expression (including any label to continue from).
if (!skip_token (IF))
{
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
/* parse required condition expr - HACK to prevent struct expr from being
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
// parse required block expr
auto if_body = parse_block_expr ();
if (!if_body)
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::CHILD_ERROR);
// branch to parse end or else (and then else, else if, or else if let)
if (lexer.peek_token ()->get_id () != ELSE)
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::IfExprConseqElse> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::IfExprConseqElse> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::IfExprConseqElse> (
t->get_token_description ()));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
}
if (!skip_token (IF))
{
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
lexer.skip_token ();
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
if (!skip_token (EQUAL))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
// parse expression (required) - HACK to prevent struct expr being parsed
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
/* TODO: check for expression not being a struct expression or lazy boolean
* expression here? or actually probably in semantic analysis. */
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
// branch to parse end or else (and then else, else if, or else if let)
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::IfLetExprConseqElse> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::IfLetExprConseqElse> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::IfLetExprConseqElse> (
t->get_token_description ()));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
}
if (!skip_token (LOOP))
{
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
else
// parse loop body, which is required
auto loop_body = parse_block_expr ();
if (!loop_body)
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::CHILD_ERROR);
return std::unique_ptr<AST::LoopExpr> (
new AST::LoopExpr (std::move (loop_body.value ()), locus, std::move (label),
if (!skip_token (WHILE))
{
skip_after_end_block ();
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
else
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
// parse loop predicate (required) with HACK to prevent struct expr parsing
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
/* TODO: check that it isn't struct expression here? actually, probably in
* semantic analysis */
add_error (std::move (error));
// skip somewhere
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::WhileLoopExpr> (
add_error (std::move (error));
// skip somewhere
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
// as this token is definitely let now, save the computation of comparison
lexer.skip_token ();
Error error (lexer.peek_token ()->get_locus (),
"should be at least 1 pattern");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
if (!skip_token (EQUAL))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
/* parse predicate expression, which is required (and HACK to prevent struct
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
/* TODO: ensure that struct expression is not parsed? Actually, probably in
* semantic analysis. */
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::WhileLetLoopExpr> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
if (!skip_token (IN))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
/* parse iterator expression, which is required - also HACK to prevent
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
// TODO: check to ensure this isn't struct expr? Or in semantic analysis.
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::ForLoopExpr> (
new AST::ForLoopExpr (std::move (pattern), std::move (expr.value ()),
"label) - found %qs",
tok->get_token_description ());
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
else
add_error (std::move (error));
// skip?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
}
t->get_token_description ()));
// skip?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
}
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
/* TODO: check for scrutinee expr not being struct expr? or do so in
* semantic analysis */
if (!skip_token (LEFT_CURLY))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
// parse inner attributes (if they exist)
"failed to parse match arm in match arms");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
if (!skip_token (MATCH_ARROW))
{
// skip after somewhere?
// TODO is returning here a good idea? or is break better?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
ParseRestrictions restrictions;
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
bool is_expr_without_block = expr.value ()->is_expr_without_block ();
"expression in match arm (if not final case)");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
else
{
if (!skip_token (RIGHT_CURLY))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
match_arms.shrink_to_fit ();
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::AsyncBlockExpr> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
return std::unique_ptr<AST::UnsafeBlockExpr> (
new AST::UnsafeBlockExpr (std::move (block_expr.value ()),
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
if (lexer.peek_token ()->get_id () == SEMICOLON)
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
skip_token (RIGHT_SQUARE);
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
exprs.push_back (std::move (expr.value ()));
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::MALFORMED);
}
}
}
add_error (std::move (error));
// skip after somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
// detect whether grouped expression with right parentheses as next token
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Node> (
+ Parse::Error::Node::CHILD_ERROR);
}
exprs.push_back (std::move (expr.value ()));
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Node::MALFORMED);
+ return tl::unexpected<Parse::Error::Node> (Parse::Error::Node::MALFORMED);
}
}
"identifier and expression");
add_error (std::move (error));
- return tl::unexpected (
+ return tl::unexpected<Parse::Error::StructExprField> (
Parse::Error::StructExprField::CHILD_ERROR);
}
if (!skip_token (COLON))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::StructExprField::MALFORMED);
+ return tl::unexpected<Parse::Error::StructExprField> (
+ Parse::Error::StructExprField::MALFORMED);
}
// parse field expression (required)
"field with tuple index");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::StructExprField::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::StructExprField> (
+ Parse::Error::StructExprField::CHILD_ERROR);
}
return std::unique_ptr<AST::StructExprFieldIndexValue> (
/* this is a struct base and can't be parsed here, so just return
* nothing without erroring */
- return tl::unexpected (Parse::Error::StructExprField::STRUCT_BASE);
+ return tl::unexpected<Parse::Error::StructExprField> (
+ Parse::Error::StructExprField::STRUCT_BASE);
default:
add_error (
Error (t->get_locus (),
"expected identifier or integer literal",
t->get_token_description ()));
- return tl::unexpected (Parse::Error::StructExprField::MALFORMED);
+ return tl::unexpected<Parse::Error::StructExprField> (
+ Parse::Error::StructExprField::MALFORMED);
}
}
TokenId id = current_token->get_id ();
if (id == SEMICOLON || id == RIGHT_PAREN || id == RIGHT_CURLY
|| id == RIGHT_SQUARE || id == COMMA || id == LEFT_CURLY)
- return tl::unexpected (Parse::Error::Expr::NULL_EXPR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::NULL_EXPR);
}
ParseRestrictions null_denotation_restrictions = restrictions;
tl::expected<std::unique_ptr<AST::Expr>, Parse::Error::Expr> expr
= null_denotation ({}, null_denotation_restrictions);
if (!expr)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
return left_denotations (std::move (expr), right_binding_power,
std::move (outer_attrs), restrictions);
{
// DEBUG
rust_debug ("null denotation is null; returning null for parse_expr");
- return tl::unexpected (Parse::Error::Expr::NULL_DENOTATION);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::NULL_DENOTATION);
}
const_TokenPtr current_token = lexer.peek_token ();
// DEBUG
rust_debug ("left denotation is null; returning null for parse_expr");
- return tl::unexpected (Parse::Error::Expr::LEFT_DENOTATION);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::LEFT_DENOTATION);
}
current_token = lexer.peek_token ();
if (grouped_or_tuple_expr)
return std::move (grouped_or_tuple_expr.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
/*case PLUS: { // unary plus operator
auto expr = parse_expr (LBP_UNARY_MINUS, {}, entered_from_unary);
if (!expr)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
// can only apply to integer and float expressions
/*if (expr.get_type() != integer_type_node || expr.get_type() !=
float_type_node) { rust_error_at(tok->get_locus(), "operand of unary
auto expr = parse_expr (LBP_UNARY_EXCLAM, {}, entered_from_unary);
if (!expr)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
// can only apply to boolean expressions
/*if (expr.get_type() != boolean_type_node) {
rust_error_at(tok->get_locus(),
entered_from_unary.can_be_struct_expr = false;
auto expr = parse_expr (LBP_UNARY_ASTERISK, {}, entered_from_unary);
if (!expr)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
// FIXME: allow outer attributes on expression
return std::make_unique<AST::DereferenceExpr> (std::move (
expr.value ()),
{
// (single) "borrow" expression - shared (mutable) or immutable
tl::expected<std::unique_ptr<AST::Expr>, Parse::Error::Expr> expr
- = tl::unexpected (Parse::Error::Expr::MALFORMED);
+ = tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
Mutability mutability = Mutability::Imm;
bool raw_borrow = false;
if (expr_result)
expr = std::move (expr_result.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
raw_borrow = true;
}
else if (t->get_id () == MUT)
if (expr_result)
expr = std::move (expr_result.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
mutability = Mutability::Mut;
raw_borrow = false;
}
if (expr_result)
expr = std::move (expr_result.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
raw_borrow = false;
}
auto expr_res
= parse_expr (LBP_UNARY_AMP_MUT, {}, entered_from_unary);
if (!expr_res)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
expr = std::move (expr_res.value ());
mutability = Mutability::Mut;
}
if (expr_result)
expr = std::move (expr_result.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
mutability = Mutability::Imm;
}
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case DOT_DOT:
// either "range to" or "range full" expressions
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case DOT_DOT_EQ:
// range to inclusive expr
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case RETURN_KW:
// FIXME: is this really a null denotation expression?
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case TRY:
// FIXME: is this really a null denotation expression?
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case BREAK:
// FIXME: is this really a null denotation expression?
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case CONTINUE:
return parse_continue_expr (std::move (outer_attrs), tok->get_locus ());
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case IF:
// if or if let, so more lookahead to find out
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
else
{
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case LIFETIME:
{
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case LOOP:
{
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case WHILE:
if (lexer.peek_token ()->get_id () == LET)
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
else
{
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case FOR:
{
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case MATCH_KW:
// also an expression with block
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case LEFT_SQUARE:
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case UNSAFE:
{
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case BOX:
{
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
case UNDERSCORE:
add_error (
Error (tok->get_locus (),
"use of %qs is not allowed on the right-side of an assignment",
tok->get_token_description ()));
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
case CONST:
{
auto ret
if (ret)
return std::move (ret.value ());
else
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
default:
if (!restrictions.expr_can_be_null)
add_error (Error (tok->get_locus (),
"found unexpected token %qs in null denotation",
tok->get_token_description ()));
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
}
"found scope resolution operator in left denotation "
"function - this should probably be handled elsewhere"));
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
case DOT:
{
/* field expression or method call - relies on parentheses after next
"found unexpected token %qs in left denotation",
tok->get_token_description ()));
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
}
auto right = parse_expr (get_lbp_for_arithmetic_or_logical_expr (expr_type),
AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_PLUS, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_MINUS, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_MUL, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_DIV, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_MOD, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_AMP, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_PIPE, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_CARET, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_L_SHIFT, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_R_SHIFT, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
auto right = parse_expr (get_lbp_for_comparison_expr (expr_type),
AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_EQUAL, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_NOT_EQUAL, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_GREATER_THAN, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_SMALLER_THAN, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_GREATER_EQUAL, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_SMALLER_EQUAL, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_LOGICAL_OR, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_LOGICAL_AND, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// TODO: check types. actually, do so during semantic analysis
location_t locus = left->get_locus ();
// parse RHS (as tok has already been consumed in parse_expression)
auto type = parse_type_no_bounds ();
if (!type)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: how do I get precedence put in here?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
location_t locus = left->get_locus ();
auto right = parse_expr (get_lbp_for_compound_assignment_expr (expr_type) - 1,
AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_PLUS_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_MINUS_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_MULT_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_DIV_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_MOD_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_AMP_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_PIPE_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_CARET_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
auto right
= parse_expr (LBP_L_SHIFT_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
auto right
= parse_expr (LBP_R_SHIFT_ASSIG - 1, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: ensure right-associativity for this - 'LBP - 1' may do this?
// TODO: check types. actually, do so during semantic analysis
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
// TODO: check inside async block in semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_DOT_DOT_EQ, AST::AttrVec (), restrictions);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: make non-associative
// TODO: check types. actually, do so during semantic analysis
// parse RHS (as tok has already been consumed in parse_expression)
auto right = parse_expr (LBP_DOT_DOT_EQ);
if (!right)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// FIXME: make non-associative
// TODO: check types. actually, do so during semantic analysis
// parse int literal (as token already skipped)
const_TokenPtr index_tok = expect_token (INT_LITERAL);
if (index_tok == nullptr)
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
std::string index = index_tok->get_str ();
// TODO: conceptually, should treat [] as brackets, so just parse all expr
auto index_expr = parse_expr ();
if (!index_expr)
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::CHILD_ERROR);
// skip ']' at end of array
if (!skip_token (RIGHT_SQUARE))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
// TODO: check types. actually, do so during semantic analysis
* not await, for instance) */
const_TokenPtr ident_tok = expect_token (IDENTIFIER);
if (ident_tok == nullptr)
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
Identifier ident{ident_tok};
"failed to parse path expr segment of method call expr");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
// skip left parentheses
if (!skip_token (LEFT_PAREN))
{
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
// parse method params (if they exist)
"failed to parse method param in method call");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
params.push_back (std::move (param.value ()));
// skip right paren
if (!skip_token (RIGHT_PAREN))
{
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
// TODO: check types. actually do so in semantic analysis pass.
"failed to parse function param in function call");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
params.push_back (std::move (param.value ()));
if (!skip_token (RIGHT_PAREN))
{
// skip somewhere?
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
// TODO: check types. actually, do so during semantic analysis
// lookup) again, make statement if final ';'
if (!skip_token (LEFT_CURLY))
{
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
// parse inner attributes
"failed to parse struct (or enum) expr field");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
// DEBUG:
"expression");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
// DEBUG:
if (!skip_token (RIGHT_CURLY))
{
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::MALFORMED);
}
// DEBUG:
"expected %<}%>, identifier, integer literal, or %<..%>",
t->get_token_description ()));
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
}
{
if (!skip_token (LEFT_PAREN))
{
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
AST::AttrVec inner_attrs = parse_inner_attributes ();
"struct (or enum) expression tuple");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
exprs.push_back (std::move (expr.value ()));
if (!skip_token (RIGHT_PAREN))
{
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
location_t path_locus = path.get_locus ();
Error error (t->get_locus (), "could not parse closure param");
add_error (std::move (error));
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
params.push_back (std::move (param));
if (!skip_token (PIPE))
{
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::MALFORMED);
}
break;
}
tok->get_token_description ()));
// skip somewhere?
- return tl::unexpected (Parse::Error::Expr::MALFORMED);
+ return tl::unexpected<Parse::Error::Expr> (Parse::Error::Expr::MALFORMED);
}
// again branch based on next token
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
// parse block expr, which is required
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
return std::make_unique<AST::ClosureExprInnerTyped> (
add_error (std::move (error));
// skip somewhere?
- return tl::unexpected (Parse::Error::Expr::CHILD_ERROR);
+ return tl::unexpected<Parse::Error::Expr> (
+ Parse::Error::Expr::CHILD_ERROR);
}
return std::make_unique<AST::ClosureExprInner> (std::move (expr.value ()),