From 4aeb7b1483f18c86c4c938edc3fd332d2ccaad42 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 19 Apr 2017 13:49:36 -0400 Subject: [PATCH] Represent the absence of optional syntax with the Empty constructor. --- src/Language/Ruby/Syntax.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs index 62fdaa1a6..ed7f65d08 100644 --- a/src/Language/Ruby/Syntax.hs +++ b/src/Language/Ruby/Syntax.hs @@ -29,6 +29,7 @@ type Syntax' = , Statement.If , Statement.Return , Statement.Yield + , Syntax.Empty , Syntax.Identifier , [] ] @@ -84,4 +85,4 @@ literal = term () Literal.true <$ symbol Language.Ruby.Syntax.True <* content <|> term () . Literal.Integer <$ symbol Language.Ruby.Syntax.Integer <*> content optional :: Assignment Grammar (Term Syntax ()) -> Assignment Grammar (Term Syntax ()) -optional a = a <|> pure (() `term` []) +optional a = a <|> pure (() `term` Syntax.Empty)