summaryrefslogtreecommitdiff
path: root/src/SPL/Lex.hs
diff options
context:
space:
mode:
authorCamil Staps2018-02-07 15:27:17 +0100
committerCamil Staps2018-02-07 15:27:17 +0100
commite40d000153eabb3e957ecb485ad7a12dacf6115c (patch)
tree1138834456812d06dee665d0d391b2ff044e24f8 /src/SPL/Lex.hs
parentMerge branch 'master' of gitlab.science.ru.nl:cstaps/compiler-construction (diff)
Statement parsing
Diffstat (limited to 'src/SPL/Lex.hs')
-rw-r--r--src/SPL/Lex.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/SPL/Lex.hs b/src/SPL/Lex.hs
index 21b8a82..b8f09e3 100644
--- a/src/SPL/Lex.hs
+++ b/src/SPL/Lex.hs
@@ -30,6 +30,7 @@ data Token
| TArrow
| TIf
+ | TElse
| TWhile
| TReturn
| TVar
@@ -107,6 +108,7 @@ lex s = (comment s <|> item s <|> int s <|> char s <|> bool s <|> ident s) >>=
item :: (Alternative m) => String -> m (Token, String)
item ('i':'f':s) = noIdentifier TIf s
+ item ('e':'l':'s':'e':s) = noIdentifier TElse s
item ('w':'h':'i':'l':'e':s) = noIdentifier TWhile s
item ('r':'e':'t':'u':'r':'n':s) = noIdentifier TReturn s
item ('v':'a':'r':s) = noIdentifier TVar s