@@ -844,7 +844,7 @@ impl<'src> ParserImpl<'src> {
844844 where
845845 P : Fn ( & mut Self ) -> & mut Self ,
846846 {
847- if matches ! ( self . state, State :: OutOfFuel ) {
847+ if matches ! ( self . state, State :: Failure | State :: OutOfFuel ) {
848848 return self ;
849849 }
850850
@@ -1111,7 +1111,7 @@ impl ParserImpl<'_> {
11111111 . expect ( t ! ( L_BRACE ) )
11121112 . if_next ( t ! ( META_KW ) , |p| p. meta_blk ( ) )
11131113 . if_next ( t ! ( STRINGS_KW ) , |p| p. patterns_blk ( ) )
1114- . then ( |p| p . condition_blk ( ) )
1114+ . condition_blk ( )
11151115 . expect ( t ! ( R_BRACE ) )
11161116 . end ( )
11171117 . recover ( t ! ( GLOBAL_KW
@@ -1289,7 +1289,7 @@ impl ParserImpl<'_> {
12891289 self . begin ( HEX_PATTERN )
12901290 . expect ( t ! ( L_BRACE ) )
12911291 . enter_hex_pattern_mode ( )
1292- . then ( |p| p . hex_sub_pattern ( ) )
1292+ . hex_sub_pattern ( )
12931293 . expect ( t ! ( R_BRACE ) )
12941294 . end ( )
12951295 }
@@ -1324,8 +1324,8 @@ impl ParserImpl<'_> {
13241324 fn hex_alternative ( & mut self ) -> & mut Self {
13251325 self . begin ( HEX_ALTERNATIVE )
13261326 . expect ( t ! ( L_PAREN ) )
1327- . then ( |p| p . hex_sub_pattern ( ) )
1328- . zero_or_more ( |p| p. expect ( t ! ( PIPE ) ) . then ( |p| p . hex_sub_pattern ( ) ) )
1327+ . hex_sub_pattern ( )
1328+ . zero_or_more ( |p| p. expect ( t ! ( PIPE ) ) . hex_sub_pattern ( ) )
13291329 . expect ( t ! ( R_PAREN ) )
13301330 . end ( )
13311331 }
@@ -1374,8 +1374,7 @@ impl ParserImpl<'_> {
13741374 self . begin ( BOOLEAN_EXPR )
13751375 . boolean_term ( )
13761376 . zero_or_more ( |p| {
1377- p. expect_d ( t ! ( AND_KW | OR_KW ) , Some ( "operator" ) )
1378- . then ( |p| p. boolean_term ( ) )
1377+ p. expect_d ( t ! ( AND_KW | OR_KW ) , Some ( "operator" ) ) . boolean_term ( )
13791378 } )
13801379 . end ( )
13811380 }
@@ -1408,10 +1407,7 @@ impl ParserImpl<'_> {
14081407 )
14091408 } )
14101409 . alt ( |p| p. expect_d ( t ! ( TRUE_KW | FALSE_KW ) , DESC ) )
1411- . alt ( |p| {
1412- p. expect_d ( t ! ( NOT_KW | DEFINED_KW ) , DESC )
1413- . then ( |p| p. boolean_term ( ) )
1414- } )
1410+ . alt ( |p| p. expect_d ( t ! ( NOT_KW | DEFINED_KW ) , DESC ) . boolean_term ( ) )
14151411 . alt ( |p| p. for_expr ( ) )
14161412 . alt ( |p| p. of_expr ( ) )
14171413 . alt ( |p| p. with_expr ( ) )
@@ -1434,12 +1430,12 @@ impl ParserImpl<'_> {
14341430 | MATCHES_KW ) ,
14351431 DESC ,
14361432 )
1437- . then ( |p| p . expr ( ) )
1433+ . expr ( )
14381434 } )
14391435 } )
14401436 . alt ( |p| {
14411437 p. expect_d ( t ! ( L_PAREN ) , DESC )
1442- . then ( |p| p . boolean_expr ( ) )
1438+ . boolean_expr ( )
14431439 . expect ( t ! ( R_PAREN ) )
14441440 } )
14451441 . end_alt ( )
@@ -1471,7 +1467,7 @@ impl ParserImpl<'_> {
14711467 | BITWISE_XOR ) ,
14721468 Some ( "operator" ) ,
14731469 )
1474- . then ( |p| p . term ( ) )
1470+ . term ( )
14751471 } )
14761472 . end ( )
14771473 } )
@@ -1487,9 +1483,8 @@ impl ParserImpl<'_> {
14871483 . expect ( t ! ( IDENT ) )
14881484 . expect ( t ! ( L_PAREN ) )
14891485 . opt ( |p| {
1490- p. boolean_expr ( ) . zero_or_more ( |p| {
1491- p. expect ( t ! ( COMMA ) ) . then ( |p| p. boolean_expr ( ) )
1492- } )
1486+ p. boolean_expr ( )
1487+ . zero_or_more ( |p| p. expect ( t ! ( COMMA ) ) . boolean_expr ( ) )
14931488 } )
14941489 . expect ( t ! ( R_PAREN ) )
14951490 . end ( )
@@ -1503,10 +1498,10 @@ impl ParserImpl<'_> {
15031498 fn range ( & mut self ) -> & mut Self {
15041499 self . begin ( RANGE )
15051500 . expect ( t ! ( L_PAREN ) )
1506- . then ( |p| p . expr ( ) )
1501+ . expr ( )
15071502 . expect ( t ! ( DOT ) )
15081503 . expect ( t ! ( DOT ) )
1509- . then ( |p| p . expr ( ) )
1504+ . expr ( )
15101505 . expect ( t ! ( R_PAREN ) )
15111506 . end ( )
15121507 }
@@ -1557,12 +1552,10 @@ impl ParserImpl<'_> {
15571552 p. expr ( ) . expect ( t ! ( R_BRACKET ) )
15581553 } )
15591554 } )
1560- . alt ( |p| p. expect_d ( t ! ( MINUS ) , DESC ) . then ( |p| p . term ( ) ) )
1561- . alt ( |p| p. expect_d ( t ! ( BITWISE_NOT ) , DESC ) . then ( |p| p . term ( ) ) )
1555+ . alt ( |p| p. expect_d ( t ! ( MINUS ) , DESC ) . term ( ) )
1556+ . alt ( |p| p. expect_d ( t ! ( BITWISE_NOT ) , DESC ) . term ( ) )
15621557 . alt ( |p| {
1563- p. expect_d ( t ! ( L_PAREN ) , DESC )
1564- . then ( |p| p. expr ( ) )
1565- . expect ( t ! ( R_PAREN ) )
1558+ p. expect_d ( t ! ( L_PAREN ) , DESC ) . expr ( ) . expect ( t ! ( R_PAREN ) )
15661559 } )
15671560 . alt ( |p| {
15681561 p. primary_expr ( ) . zero_or_more ( |p| {
@@ -1609,7 +1602,7 @@ impl ParserImpl<'_> {
16091602 fn for_expr ( & mut self ) -> & mut Self {
16101603 self . begin ( FOR_EXPR )
16111604 . expect_d ( t ! ( FOR_KW ) , Some ( "expression" ) )
1612- . then ( |p| p . quantifier ( ) )
1605+ . quantifier ( )
16131606 . begin_alt ( )
16141607 . alt ( |p| {
16151608 p. expect ( t ! ( OF_KW ) )
@@ -1622,12 +1615,12 @@ impl ParserImpl<'_> {
16221615 p. expect ( t ! ( IDENT ) )
16231616 . zero_or_more ( |p| p. expect ( t ! ( COMMA ) ) . expect ( t ! ( IDENT ) ) )
16241617 . expect ( t ! ( IN_KW ) )
1625- . then ( |p| p . iterable ( ) )
1618+ . iterable ( )
16261619 } )
16271620 . end_alt ( )
16281621 . expect ( t ! ( COLON ) )
16291622 . expect ( t ! ( L_PAREN ) )
1630- . then ( |p| p . boolean_expr ( ) )
1623+ . boolean_expr ( )
16311624 . expect ( t ! ( R_PAREN ) )
16321625 . end ( )
16331626 }
@@ -1642,7 +1635,7 @@ impl ParserImpl<'_> {
16421635 /// ``
16431636 fn of_expr ( & mut self ) -> & mut Self {
16441637 self . begin ( OF_EXPR )
1645- . then ( |p| p . quantifier ( ) )
1638+ . quantifier ( )
16461639 . expect ( t ! ( OF_KW ) )
16471640 . begin_alt ( )
16481641 . alt ( |p| {
@@ -1672,10 +1665,10 @@ impl ParserImpl<'_> {
16721665 fn with_expr ( & mut self ) -> & mut Self {
16731666 self . begin ( WITH_EXPR )
16741667 . expect_d ( t ! ( WITH_KW ) , Some ( "expression" ) )
1675- . then ( |p| p . with_declarations ( ) )
1668+ . with_declarations ( )
16761669 . expect ( t ! ( COLON ) )
16771670 . expect ( t ! ( L_PAREN ) )
1678- . then ( |p| p . boolean_expr ( ) )
1671+ . boolean_expr ( )
16791672 . expect ( t ! ( R_PAREN ) )
16801673 . end ( )
16811674 }
@@ -1687,10 +1680,8 @@ impl ParserImpl<'_> {
16871680 ///
16881681 fn with_declarations ( & mut self ) -> & mut Self {
16891682 self . begin ( WITH_DECLS )
1690- . then ( |p| p. with_declaration ( ) )
1691- . zero_or_more ( |p| {
1692- p. expect ( t ! ( COMMA ) ) . then ( |p| p. with_declaration ( ) )
1693- } )
1683+ . with_declaration ( )
1684+ . zero_or_more ( |p| p. expect ( t ! ( COMMA ) ) . with_declaration ( ) )
16941685 . end ( )
16951686 }
16961687
@@ -1700,11 +1691,7 @@ impl ParserImpl<'_> {
17001691 /// WITH_DECL := IDENT `=` EXPR
17011692 /// ```
17021693 fn with_declaration ( & mut self ) -> & mut Self {
1703- self . begin ( WITH_DECL )
1704- . expect ( t ! ( IDENT ) )
1705- . expect ( t ! ( EQUAL ) )
1706- . then ( |p| p. expr ( ) )
1707- . end ( )
1694+ self . begin ( WITH_DECL ) . expect ( t ! ( IDENT ) ) . expect ( t ! ( EQUAL ) ) . expr ( ) . end ( )
17081695 }
17091696
17101697 /// Parses quantifier.
@@ -1761,8 +1748,8 @@ impl ParserImpl<'_> {
17611748 fn boolean_expr_tuple ( & mut self ) -> & mut Self {
17621749 self . begin ( BOOLEAN_EXPR_TUPLE )
17631750 . expect ( t ! ( L_PAREN ) )
1764- . then ( |p| p . boolean_expr ( ) )
1765- . zero_or_more ( |p| p. expect ( t ! ( COMMA ) ) . then ( |p| p . boolean_expr ( ) ) )
1751+ . boolean_expr ( )
1752+ . zero_or_more ( |p| p. expect ( t ! ( COMMA ) ) . boolean_expr ( ) )
17661753 . expect ( t ! ( R_PAREN ) )
17671754 . end ( )
17681755 }
@@ -1775,8 +1762,8 @@ impl ParserImpl<'_> {
17751762 fn expr_tuple ( & mut self ) -> & mut Self {
17761763 self . begin ( EXPR_TUPLE )
17771764 . expect ( t ! ( L_PAREN ) )
1778- . then ( |p| p . expr ( ) )
1779- . zero_or_more ( |p| p. expect ( t ! ( COMMA ) ) . then ( |p| p . expr ( ) ) )
1765+ . expr ( )
1766+ . zero_or_more ( |p| p. expect ( t ! ( COMMA ) ) . expr ( ) )
17801767 . expect ( t ! ( R_PAREN ) )
17811768 . end ( )
17821769 }
0 commit comments