summaryrefslogtreecommitdiff
path: root/parser.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-02-03 16:30:40 +0100
committertomsmeding <tom.smeding@gmail.com>2017-02-03 16:30:40 +0100
commite72a2b8e778fff230848769643a125ae995fbe58 (patch)
tree23c2aa9b0640b5c2cf57f7e035d5cb6ae33b8e19 /parser.hs
parent8eb3171845497a1d6025a3f59c09048d1975cd12 (diff)
Add array indexing (not writing yet, though...)HEADmaster
Diffstat (limited to 'parser.hs')
-rw-r--r--parser.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/parser.hs b/parser.hs
index 942c63c..40da1ca 100644
--- a/parser.hs
+++ b/parser.hs
@@ -111,7 +111,13 @@ pExCast = do
return $ ExCast t e
pExLit :: Parser Expression
-pExLit = (exLit_ <$> pLiteral) <|> pParenExpr
+pExLit = do
+ litex <- (exLit_ <$> pLiteral) <|> pParenExpr
+ option litex $ do
+ symbol "["
+ arg <- pExpression
+ symbol "]"
+ return $ exBinOp_ Index litex arg
pParenExpr :: Parser Expression
pParenExpr = do