@ -229,7 +229,7 @@ module.exports = grammar({
field ( "parameters" , $ . function _parameters ) ,
field ( "parameters" , $ . function _parameters ) ,
optional ( seq ( "->" , field ( "return_type" , $ . _type ) ) ) ,
optional ( seq ( "->" , field ( "return_type" , $ . _type ) ) ) ,
"{" ,
"{" ,
optional ( field ( "body" , alias ( $ . _ expression _seq , $ . function _body ) ) ) ,
optional ( field ( "body" , alias ( $ . _ statement _seq , $ . function _body ) ) ) ,
"}"
"}"
) ,
) ,
function _parameters : ( $ ) =>
function _parameters : ( $ ) =>
@ -271,7 +271,7 @@ module.exports = grammar({
// This makes sense for the parser, but (IMO) would be more confusing for
// This makes sense for the parser, but (IMO) would be more confusing for
// users and tooling which don't think about `try`s as having a "then". Thus,
// users and tooling which don't think about `try`s as having a "then". Thus,
// `try`s are essentially treated the same as any other expression.
// `try`s are essentially treated the same as any other expression.
_ expression _seq : ( $ ) => repeat1 ( choice ( $ . _ expression , $ . try ) ) ,
_ statement _seq : ( $ ) => repeat1 ( choice ( $ . _ statement , $ . try ) ) ,
try : ( $ ) =>
try : ( $ ) =>
seq (
seq (
"try" ,
"try" ,
@ -280,6 +280,7 @@ module.exports = grammar({
"=" ,
"=" ,
field ( "value" , $ . _expression )
field ( "value" , $ . _expression )
) ,
) ,
_statement : ( $ ) => choice ( $ . _expression , $ . let , $ . use ) ,
_expression : ( $ ) => choice ( $ . _expression _unit , $ . binary _expression ) ,
_expression : ( $ ) => choice ( $ . _expression _unit , $ . binary _expression ) ,
binary _expression : ( $ ) =>
binary _expression : ( $ ) =>
choice (
choice (
@ -333,8 +334,6 @@ module.exports = grammar({
$ . expression _group ,
$ . expression _group ,
$ . case ,
$ . case ,
$ . let _assert ,
$ . let _assert ,
$ . let ,
$ . use ,
$ . assert ,
$ . assert ,
$ . negation ,
$ . negation ,
$ . record _update ,
$ . record _update ,
@ -374,7 +373,7 @@ module.exports = grammar({
) ,
) ,
optional ( seq ( "->" , field ( "return_type" , $ . _type ) ) ) ,
optional ( seq ( "->" , field ( "return_type" , $ . _type ) ) ) ,
"{" ,
"{" ,
field ( "body" , alias ( $ . _ expression _seq , $ . function _body ) ) ,
field ( "body" , alias ( $ . _ statement _seq , $ . function _body ) ) ,
"}"
"}"
) ,
) ,
anonymous _function _parameters : ( $ ) =>
anonymous _function _parameters : ( $ ) =>
@ -393,7 +392,7 @@ module.exports = grammar({
choice ( $ . _discard _param , $ . _name _param ) ,
choice ( $ . _discard _param , $ . _name _param ) ,
optional ( $ . _type _annotation )
optional ( $ . _type _annotation )
) ,
) ,
expression _group : ( $ ) => seq ( "{" , $ . _ expression _seq , "}" ) ,
expression _group : ( $ ) => seq ( "{" , $ . _ statement _seq , "}" ) ,
case : ( $ ) =>
case : ( $ ) =>
seq (
seq (
"case" ,
"case" ,