Skip to content

Commit 57a86fe

Browse files
committed
Resolve tests
* long (byte)strings with newlines in them can now be broken up onto multiple lines. * 'tests' README is updated * 'pretty' now resolves automatically, updated the tests to match this * rustc-tests now check that the parsed output does not change when resolved * a bunch of resolve bugs are fixed (including a nasty one around expressions) so that all tests pass
1 parent 61623a6 commit 57a86fe

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Language/Rust/Parser/Internal.y

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,25 @@ postfix_blockexpr(lhs) :: { Expr Span }
944944
_ -> parseError $3
945945
}
946946

947+
-- Postfix expressions that can come after an expression block, in a 'stmt'
948+
--
949+
-- * `{ 1 }[0]` isn't here because it is treated as `{ 1 }; [0]`
950+
-- * `{ 1 }(0)` isn't here because it is treated as `{ 1 }; (0)`
951+
--
952+
postfix_blockexpr(lhs) :: { Expr Span }
953+
: lhs '?' { Try [] $1 ($1 # $>) }
954+
| lhs '.' ident %prec FIELD { FieldAccess [] $1 (unspan $3) ($1 # $>) }
955+
| lhs '.' ident '(' sep_byT(expr,',') ')'
956+
{ MethodCall [] $1 (unspan $3) Nothing $5 ($1 # $>) }
957+
| lhs '.' ident '::' '<' sep_byT(ty,',') '>' '(' sep_byT(expr,',') ')'
958+
{ MethodCall [] $1 (unspan $3) (Just $6) $9 ($1 # $>) }
959+
| lhs '.' int {%
960+
case lit $3 of
961+
Int Dec i Unsuffixed _ -> pure (TupField [] $1 (fromIntegral i) ($1 # $3))
962+
_ -> parseError $3
963+
}
964+
965+
947966

948967
-- Then, we instantiate this general production into the following families of rules:
949968
--

0 commit comments

Comments
 (0)