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)