@@ -553,8 +553,8 @@ fn typ_send(input: &mut Input) -> Result<Type> {
553553 t ( TokenKind :: LParen ) ,
554554 ( list1 ( typ) , t ( TokenKind :: RParen ) , typ) ,
555555 )
556- . map ( |( open, ( args, _ , then) ) | {
557- let span = open. span . join ( then . span ( ) ) ;
556+ . map ( |( open, ( args, close , then) ) | {
557+ let span = open. span . join ( close . span ( ) ) ;
558558 args. into_iter ( ) . rfold ( then, |then, arg| {
559559 Type :: Pair ( span. clone ( ) , Box :: new ( arg) , Box :: new ( then) )
560560 } )
@@ -567,8 +567,8 @@ fn typ_receive(input: &mut Input) -> Result<Type> {
567567 t ( TokenKind :: LBrack ) ,
568568 ( list1 ( typ) , t ( TokenKind :: RBrack ) , typ) ,
569569 )
570- . map ( |( open, ( args, _ , then) ) | {
571- let span = open. span . join ( then . span ( ) ) ;
570+ . map ( |( open, ( args, close , then) ) | {
571+ let span = open. span . join ( close . span ( ) ) ;
572572 args. into_iter ( ) . rfold ( then, |then, arg| {
573573 Type :: Function ( span. clone ( ) , Box :: new ( arg) , Box :: new ( then) )
574574 } )
@@ -655,8 +655,8 @@ fn typ_send_type<'s>(input: &mut Input) -> Result<Type> {
655655 typ,
656656 ) ,
657657 )
658- . map ( |( ( open, _) , ( names, _ , then) ) | {
659- let span = open. span . join ( then . span ( ) ) ;
658+ . map ( |( ( open, _) , ( names, close , then) ) | {
659+ let span = open. span . join ( close . span ( ) ) ;
660660 names. into_iter ( ) . rfold ( then, |then, name| {
661661 Type :: Exists ( span. clone ( ) , name, Box :: new ( then) )
662662 } )
@@ -673,8 +673,8 @@ fn typ_recv_type(input: &mut Input) -> Result<Type> {
673673 typ,
674674 ) ,
675675 )
676- . map ( |( ( open, _) , ( names, _ , then) ) | {
677- let span = open. span . join ( then . span ( ) ) ;
676+ . map ( |( ( open, _) , ( names, close , then) ) | {
677+ let span = open. span . join ( close . span ( ) ) ;
678678 names. into_iter ( ) . rfold ( then, |then, name| {
679679 Type :: Forall ( span. clone ( ) , name, Box :: new ( then) )
680680 } )
@@ -716,8 +716,8 @@ fn typ_branch_receive(input: &mut Input) -> Result<Type> {
716716 t ( TokenKind :: LParen ) ,
717717 ( list1 ( typ) , t ( TokenKind :: RParen ) , typ_branch) ,
718718 )
719- . map ( |( open, ( args, _ , then) ) | {
720- let span = open. span . join ( then . span ( ) ) ;
719+ . map ( |( open, ( args, close , then) ) | {
720+ let span = open. span . join ( close . span ( ) ) ;
721721 args. into_iter ( ) . rfold ( then, |then, arg| {
722722 Type :: Function ( span. clone ( ) , Box :: new ( arg) , Box :: new ( then) )
723723 } )
@@ -730,8 +730,8 @@ fn typ_branch_recv_type(input: &mut Input) -> Result<Type> {
730730 tn ! ( "(type" : TokenKind :: LParen , TokenKind :: Type ) ,
731731 cut_err ( ( list1 ( local_name) , t ( TokenKind :: RParen ) , typ_branch) ) ,
732732 )
733- . map ( |( ( open, _) , ( names, _ , then) ) | {
734- let span = open. span . join ( then . span ( ) ) ;
733+ . map ( |( ( open, _) , ( names, close , then) ) | {
734+ let span = open. span . join ( close . span ( ) ) ;
735735 names. into_iter ( ) . rfold ( then, |then, name| {
736736 Type :: Forall ( span. clone ( ) , name, Box :: new ( then) )
737737 } )
@@ -778,7 +778,7 @@ fn pattern_receive(input: &mut Input) -> Result<Pattern> {
778778 t ( TokenKind :: LParen ) ,
779779 ( list1 ( pattern) , t ( TokenKind :: RParen ) , pattern) ,
780780 )
781- . map ( |( open, ( patterns, _ , rest) ) | {
781+ . map ( |( open, ( patterns, _close , rest) ) | {
782782 let span = open. span . join ( rest. span ( ) ) ;
783783 patterns. into_iter ( ) . rfold ( rest, |rest, arg| {
784784 Pattern :: Receive ( span. clone ( ) , Box :: new ( arg) , Box :: new ( rest) )
@@ -804,7 +804,7 @@ fn pattern_default(input: &mut Input) -> Result<Pattern> {
804804 ( t ( TokenKind :: Default ) , t ( TokenKind :: LParen ) ) ,
805805 ( expression, t ( TokenKind :: RParen ) , pattern) ,
806806 )
807- . map ( |( ( pre, _) , ( expr, _ , rest) ) | {
807+ . map ( |( ( pre, _) , ( expr, _close , rest) ) | {
808808 Pattern :: Default ( pre. span . join ( rest. span ( ) ) , Box :: new ( expr) , Box :: new ( rest) )
809809 } )
810810 . parse_next ( input)
@@ -815,7 +815,7 @@ fn pattern_receive_type(input: &mut Input) -> Result<Pattern> {
815815 tn ! ( "(type" : TokenKind :: LParen , TokenKind :: Type ) ,
816816 ( list1 ( local_name) , t ( TokenKind :: RParen ) , pattern) ,
817817 )
818- . map ( |( ( open, _) , ( names, _ , rest) ) | {
818+ . map ( |( ( open, _) , ( names, _close , rest) ) | {
819819 let span = open. span . join ( rest. span ( ) ) ;
820820 names. into_iter ( ) . rfold ( rest, |rest, name| {
821821 Pattern :: ReceiveType ( span. clone ( ) , name, Box :: new ( rest) )
@@ -950,12 +950,14 @@ fn expr_let(input: &mut Input) -> Result<Expression> {
950950 expression,
951951 ) ,
952952 )
953- . map ( |( pre, ( pattern, _, expression, _, body) ) | Expression :: Let {
954- span : pre. span . join ( body. span ( ) ) ,
955- pattern,
956- expression : Box :: new ( expression) ,
957- then : Box :: new ( body) ,
958- } )
953+ . map (
954+ |( pre, ( pattern, _, expression, _in_tok, body) ) | Expression :: Let {
955+ span : pre. span . join ( body. span ( ) ) ,
956+ pattern,
957+ expression : Box :: new ( expression) ,
958+ then : Box :: new ( body) ,
959+ } ,
960+ )
959961 . parse_next ( input)
960962}
961963
@@ -972,7 +974,7 @@ fn expr_catch(input: &mut Input) -> Result<Expression> {
972974 ) ,
973975 )
974976 . map (
975- |( pre, ( label, pattern, _, block, _ , then) ) | Expression :: Catch {
977+ |( pre, ( label, pattern, _, block, _in_tok , then) ) | Expression :: Catch {
976978 span : pre. span . join ( then. span ( ) ) ,
977979 label,
978980 pattern,
@@ -1005,14 +1007,16 @@ fn expr_do(input: &mut Input) -> Result<Expression> {
10051007 expression,
10061008 ) ,
10071009 )
1008- . map ( |( pre, ( open, process, _, expression) ) | Expression :: Do {
1009- span : pre. span . join ( expression. span ( ) ) ,
1010- process : match process {
1011- Some ( process) => Box :: new ( process) ,
1012- None => Box :: new ( Process :: Noop ( open. span . only_end ( ) ) ) ,
1010+ . map (
1011+ |( pre, ( open, process, ( _close, _in_tok) , expression) ) | Expression :: Do {
1012+ span : pre. span . join ( expression. span ( ) ) ,
1013+ process : match process {
1014+ Some ( process) => Box :: new ( process) ,
1015+ None => Box :: new ( Process :: Noop ( open. span . only_end ( ) ) ) ,
1016+ } ,
1017+ then : Box :: new ( expression) ,
10131018 } ,
1014- then : Box :: new ( expression) ,
1015- } )
1019+ )
10161020 . parse_next ( input)
10171021}
10181022
@@ -1083,7 +1087,7 @@ fn cons_send(input: &mut Input) -> Result<Construct> {
10831087 t ( TokenKind :: LParen ) ,
10841088 ( list1 ( expression) , t ( TokenKind :: RParen ) , construction) ,
10851089 )
1086- . map ( |( open, ( args, _ , then) ) | {
1090+ . map ( |( open, ( args, _close , then) ) | {
10871091 let span = open. span . join ( then. span ( ) ) ;
10881092 args. into_iter ( ) . rfold ( then, |then, arg| {
10891093 Construct :: Send ( span. clone ( ) , Box :: new ( arg) , Box :: new ( then) )
@@ -1097,7 +1101,7 @@ fn cons_receive(input: &mut Input) -> Result<Construct> {
10971101 t ( TokenKind :: LBrack ) ,
10981102 ( list1 ( pattern) , t ( TokenKind :: RBrack ) , construction) ,
10991103 )
1100- . map ( |( open, ( patterns, _ , then) ) | {
1104+ . map ( |( open, ( patterns, _close , then) ) | {
11011105 let span = open. span . join ( then. span ( ) ) ;
11021106 patterns. into_iter ( ) . rfold ( then, |then, pattern| {
11031107 Construct :: Receive ( span. clone ( ) , pattern, Box :: new ( then) )
@@ -1117,12 +1121,8 @@ fn cons_signal(input: &mut Input) -> Result<Construct> {
11171121
11181122fn cons_case ( input : & mut Input ) -> Result < Construct > {
11191123 commit_after ( t ( TokenKind :: Case ) , branches_body ( cons_branch) )
1120- . map ( |( pre, ( branches_span, branches, else_branch) ) | {
1121- Construct :: Case (
1122- pre. span . join ( branches_span) ,
1123- ConstructBranches ( branches) ,
1124- else_branch,
1125- )
1124+ . map ( |( pre, ( _branches_span, branches, else_branch) ) | {
1125+ Construct :: Case ( pre. span ( ) , ConstructBranches ( branches) , else_branch)
11261126 } )
11271127 . parse_next ( input)
11281128}
@@ -1174,7 +1174,7 @@ fn cons_send_type(input: &mut Input) -> Result<Construct> {
11741174 tn ! ( "(type" : TokenKind :: LParen , TokenKind :: Type ) ,
11751175 ( list1 ( typ) , t ( TokenKind :: RParen ) , construction) ,
11761176 )
1177- . map ( |( ( open, _) , ( types, _ , then) ) | {
1177+ . map ( |( ( open, _) , ( types, _close , then) ) | {
11781178 let span = open. span . join ( then. span ( ) ) ;
11791179 types. into_iter ( ) . rfold ( then, |then, typ| {
11801180 Construct :: SendType ( span. clone ( ) , typ, Box :: new ( then) )
@@ -1188,7 +1188,7 @@ fn cons_recv_type(input: &mut Input) -> Result<Construct> {
11881188 tn ! ( "[type" : TokenKind :: LBrack , TokenKind :: Type ) ,
11891189 ( list1 ( local_name) , t ( TokenKind :: RBrack ) , construction) ,
11901190 )
1191- . map ( |( ( open, _) , ( names, _ , then) ) | {
1191+ . map ( |( ( open, _) , ( names, _close , then) ) | {
11921192 let span = open. span . join ( then. span ( ) ) ;
11931193 names. into_iter ( ) . rfold ( then, |then, name| {
11941194 Construct :: ReceiveType ( span. clone ( ) , name, Box :: new ( then) )
@@ -1214,7 +1214,7 @@ fn cons_branch_receive(input: &mut Input) -> Result<ConstructBranch> {
12141214 t ( TokenKind :: LParen ) ,
12151215 ( list1 ( pattern) , t ( TokenKind :: RParen ) , cons_branch) ,
12161216 )
1217- . map ( |( open, ( patterns, _ , rest) ) | {
1217+ . map ( |( open, ( patterns, _close , rest) ) | {
12181218 let span = open. span . join ( rest. span ( ) ) ;
12191219 patterns. into_iter ( ) . rfold ( rest, |rest, pattern| {
12201220 ConstructBranch :: Receive ( span. clone ( ) , pattern, Box :: new ( rest) )
@@ -1228,7 +1228,7 @@ fn cons_branch_recv_type(input: &mut Input) -> Result<ConstructBranch> {
12281228 tn ! ( "(type" : TokenKind :: LParen , TokenKind :: Type ) ,
12291229 ( list1 ( local_name) , t ( TokenKind :: RParen ) , cons_branch) ,
12301230 )
1231- . map ( |( ( open, _) , ( names, _ , rest) ) | {
1231+ . map ( |( ( open, _) , ( names, _close , rest) ) | {
12321232 let span = open. span . join ( rest. span ( ) ) ;
12331233 names. into_iter ( ) . rfold ( rest, |rest, name| {
12341234 ConstructBranch :: ReceiveType ( span. clone ( ) , name, Box :: new ( rest) )
@@ -1307,12 +1307,8 @@ fn apply_case(input: &mut Input) -> Result<Apply> {
13071307 ( t ( TokenKind :: Dot ) , t ( TokenKind :: Case ) ) ,
13081308 branches_body ( apply_branch) ,
13091309 )
1310- . map ( |( ( pre, _) , ( branches_span, branches, else_branch) ) | {
1311- Apply :: Case (
1312- pre. span . join ( branches_span) ,
1313- ApplyBranches ( branches) ,
1314- else_branch,
1315- )
1310+ . map ( |( ( pre, _) , ( _branches_span, branches, else_branch) ) | {
1311+ Apply :: Case ( pre. span ( ) , ApplyBranches ( branches) , else_branch)
13161312 } )
13171313 . parse_next ( input)
13181314}
@@ -1392,7 +1388,7 @@ fn apply_try(input: &mut Input) -> Result<Apply> {
13921388 Some ( apply) => apply,
13931389 None => Apply :: Noop ( pre. span . only_end ( ) ) ,
13941390 } ;
1395- Apply :: Try ( pre. span . join ( pre . span . clone ( ) ) , label, Box :: new ( then) )
1391+ Apply :: Try ( pre. span . join ( then . span ( ) ) , label, Box :: new ( then) )
13961392 } )
13971393 . parse_next ( input)
13981394}
@@ -1468,7 +1464,7 @@ fn apply_branch_receive(input: &mut Input) -> Result<ApplyBranch> {
14681464 t ( TokenKind :: LParen ) ,
14691465 ( list1 ( pattern) , t ( TokenKind :: RParen ) , apply_branch) ,
14701466 )
1471- . map ( |( open, ( patterns, _ , rest) ) | {
1467+ . map ( |( open, ( patterns, _close , rest) ) | {
14721468 let span = open. span . join ( rest. span ( ) ) ;
14731469 patterns. into_iter ( ) . rfold ( rest, |rest, pattern| {
14741470 ApplyBranch :: Receive ( span. clone ( ) , pattern, Box :: new ( rest) )
@@ -1490,7 +1486,7 @@ fn apply_branch_recv_type(input: &mut Input) -> Result<ApplyBranch> {
14901486 tn ! ( "(type" : TokenKind :: LParen , TokenKind :: Type ) ,
14911487 ( list1 ( local_name) , t ( TokenKind :: RParen ) , apply_branch) ,
14921488 )
1493- . map ( |( ( open, _) , ( names, _ , rest) ) | {
1489+ . map ( |( ( open, _) , ( names, _close , rest) ) | {
14941490 let span = open. span . join ( rest. span ( ) ) ;
14951491 names. into_iter ( ) . rfold ( rest, |rest, name| {
14961492 ApplyBranch :: ReceiveType ( span. clone ( ) , name, Box :: new ( rest) )
@@ -1512,7 +1508,7 @@ fn apply_branch_default(input: &mut Input) -> Result<ApplyBranch> {
15121508 ( t ( TokenKind :: Default ) , t ( TokenKind :: LParen ) ) ,
15131509 ( expression, t ( TokenKind :: RParen ) , apply_branch) ,
15141510 )
1515- . map ( |( ( kw, _) , ( expr, _ , rest) ) | {
1511+ . map ( |( ( kw, _) , ( expr, _close , rest) ) | {
15161512 ApplyBranch :: Default ( kw. span . join ( rest. span ( ) ) , Box :: new ( expr) , Box :: new ( rest) )
15171513 } )
15181514 . parse_next ( input)
@@ -1721,9 +1717,9 @@ fn cmd_case(input: &mut Input) -> Result<Command> {
17211717 ( branches_body ( cmd_branch) , opt ( pass_process) ) ,
17221718 )
17231719 . map (
1724- |( ( pre, _) , ( ( branches_span , branches, else_branch) , pass_process) ) | {
1720+ |( ( pre, _) , ( ( _branches_span , branches, else_branch) , pass_process) ) | {
17251721 Command :: Case (
1726- pre. span . join ( branches_span ) ,
1722+ pre. span ( ) ,
17271723 CommandBranches ( branches) ,
17281724 else_branch,
17291725 pass_process. map ( Box :: new) ,
@@ -1953,7 +1949,7 @@ fn cmd_branch_receive(input: &mut Input) -> Result<CommandBranch> {
19531949 t ( TokenKind :: LParen ) ,
19541950 ( list1 ( pattern) , t ( TokenKind :: RParen ) , cmd_branch) ,
19551951 )
1956- . map ( |( open, ( patterns, _ , rest) ) | {
1952+ . map ( |( open, ( patterns, _close , rest) ) | {
19571953 let span = open. span . join ( rest. span ( ) ) ;
19581954 patterns. into_iter ( ) . rfold ( rest, |rest, pattern| {
19591955 CommandBranch :: Receive ( span. clone ( ) , pattern, Box :: new ( rest) )
@@ -1989,7 +1985,7 @@ fn cmd_branch_recv_type(input: &mut Input) -> Result<CommandBranch> {
19891985 tn ! ( "(type" : TokenKind :: LParen , TokenKind :: Type ) ,
19901986 ( list1 ( local_name) , t ( TokenKind :: RParen ) , cmd_branch) ,
19911987 )
1992- . map ( |( ( open, _) , ( names, _ , rest) ) | {
1988+ . map ( |( ( open, _) , ( names, _close , rest) ) | {
19931989 let span = open. span . join ( rest. span ( ) ) ;
19941990 names. into_iter ( ) . rfold ( rest, |rest, name| {
19951991 CommandBranch :: ReceiveType ( span. clone ( ) , name, Box :: new ( rest) )
@@ -2011,7 +2007,7 @@ fn cmd_branch_default(input: &mut Input) -> Result<CommandBranch> {
20112007 ( t ( TokenKind :: Default ) , t ( TokenKind :: LParen ) ) ,
20122008 ( expression, t ( TokenKind :: RParen ) , cmd_branch) ,
20132009 )
2014- . map ( |( ( kw, _) , ( expr, _ , rest) ) | {
2010+ . map ( |( ( kw, _) , ( expr, _close , rest) ) | {
20152011 CommandBranch :: Default ( kw. span . join ( rest. span ( ) ) , Box :: new ( expr) , Box :: new ( rest) )
20162012 } )
20172013 . parse_next ( input)
0 commit comments