Skip to content

Commit

Permalink
merge variants when the | operator is used
Browse files Browse the repository at this point in the history
  • Loading branch information
krangelov committed Apr 9, 2024
1 parent f637abe commit 8230842
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/compiler/api/GF/Grammar/Parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,12 @@ ListLocDef

Exp :: { Term }
Exp
: Exp1 '|' Exp { FV [$1,$3] }
: Exp1 '|' Exp { case ($1,$3) of
(FV xs,FV ys) -> FV (xs++ys )
(FV xs,y ) -> FV (xs++[y])
(x, FV ys) -> FV (x:ys)
(x, y ) -> FV [x,y]
}
| '\\' ListBind '->' Exp { mkAbs $2 $4 }
| '\\\\' ListBind '=>' Exp { mkCTable $2 $4 }
| Decl '->' Exp { mkProdSimple $1 $3 }
Expand Down

0 comments on commit 8230842

Please sign in to comment.