From 8cdb0bf21316d698c139b2f3a7a6a7f975666fd6 Mon Sep 17 00:00:00 2001 From: Timothy Clem Date: Fri, 23 Jun 2017 13:49:18 -0600 Subject: [PATCH] Keywords --- src/Language/Ruby/Syntax.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Language/Ruby/Syntax.hs b/src/Language/Ruby/Syntax.hs index 8b44b92c6..df6b68d08 100644 --- a/src/Language/Ruby/Syntax.hs +++ b/src/Language/Ruby/Syntax.hs @@ -91,6 +91,7 @@ statement = -- handleError $ <|> unary <|> binary <|> literal + <|> keywords <|> mk Return Statement.Return <|> mk Yield Statement.Yield <|> mk Break Statement.Break @@ -144,6 +145,14 @@ literal = where pairs = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> statement <*> statement) +keywords :: Assignment +keywords = + mk KeywordFILE + <|> mk KeywordLINE + <|> mk KeywordENCODING + -- TODO: Give keywords their own Expression? + where mk s = makeTerm <$> symbol s <*> (Literal.TextElement <$> source) + beginBlock :: Assignment beginBlock = makeTerm <$> symbol BeginBlock <*> children (Statement.ScopeEntry <$> many topLevelStatement)