diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-01-31 13:44:58 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-01-31 13:57:15 +0100 |
| commit | fa57d86ed981373b66804972147bf59cab920e6b (patch) | |
| tree | b1385f491f5102b1503f770f11e848a8f5b8c69e /src/parse/mod.rs | |
| parent | 8f37189d6fb2e3c75e4e6a168e1ae17c568fdc4c (diff) | |
Fix another parser bug
Diffstat (limited to 'src/parse/mod.rs')
| -rw-r--r-- | src/parse/mod.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/parse/mod.rs b/src/parse/mod.rs index f666f4ad..38a08ab8 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -311,7 +311,7 @@ fn markup_expr(p: &mut Parser) { p.start_group(Group::Expr); let res = expr_prec(p, true, 0); if stmt && res.is_ok() && !p.eof() { - p.expected_at("semicolon or line break"); + p.expected("semicolon or line break"); } p.end_group(); } @@ -435,7 +435,7 @@ fn primary(p: &mut Parser, atomic: bool) -> ParseResult { // Nothing. _ => { - p.expected("expression"); + p.expected_found("expression"); Err(ParseError) } } @@ -538,7 +538,7 @@ fn collection(p: &mut Parser) -> (CollectionKind, usize) { items += 1; if let Some(marker) = missing_coma.take() { - marker.expected(p, "comma"); + p.expected_at(marker, "comma"); } if p.eof() { @@ -651,7 +651,7 @@ fn block(p: &mut Parser) { while !p.eof() { p.start_group(Group::Expr); if expr(p).is_ok() && !p.eof() { - p.expected_at("semicolon or line break"); + p.expected("semicolon or line break"); } p.end_group(); @@ -673,7 +673,7 @@ fn args(p: &mut Parser, direct: bool, brackets: bool) -> ParseResult { Some(NodeKind::LeftParen) => {} Some(NodeKind::LeftBracket) if brackets => {} _ => { - p.expected("argument list"); + p.expected_found("argument list"); return Err(ParseError); } } @@ -726,7 +726,7 @@ fn let_expr(p: &mut Parser) -> ParseResult { expr(p)?; } else if has_params { // Function definitions must have a body. - p.expected_at("body"); + p.expected("body"); } // Rewrite into a closure expression if it's a function definition. @@ -831,7 +831,7 @@ fn import_expr(p: &mut Parser) -> ParseResult { let marker = p.marker(); let items = collection(p).1; if items == 0 { - p.expected_at("import items"); + p.expected("import items"); } p.end_group(); @@ -890,7 +890,7 @@ fn ident(p: &mut Parser) -> ParseResult { Ok(()) } _ => { - p.expected("identifier"); + p.expected_found("identifier"); Err(ParseError) } } @@ -902,7 +902,7 @@ fn body(p: &mut Parser) -> ParseResult { Some(NodeKind::LeftBracket) => template(p), Some(NodeKind::LeftBrace) => block(p), _ => { - p.expected_at("body"); + p.expected("body"); return Err(ParseError); } } |
