summaryrefslogtreecommitdiff
path: root/src/SPL/Lex.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SPL/Lex.hs')
-rw-r--r--src/SPL/Lex.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/SPL/Lex.hs b/src/SPL/Lex.hs
index 23a697d..1843cdd 100644
--- a/src/SPL/Lex.hs
+++ b/src/SPL/Lex.hs
@@ -22,7 +22,7 @@ data Token
| TBrackClose
| TBraceOpen
| TBraceClose
- | TDoubleColon
+ | TColonColon
| TEquals
| TSemicolon
| TDot
@@ -55,7 +55,16 @@ data Token
| TSingleComment String
| TBlockComment String
- deriving (Show)
+ deriving (Show, Eq)
+
+isCommentToken :: Token -> Bool
+isCommentToken (TSingleComment _) = True
+isCommentToken (TBlockComment _) = True
+isCommentToken _ = False
+
+isIdentToken :: Token -> Bool
+isIdentToken (TIdent _) = True
+isIdentToken _ = False
lex :: (Monad m, Alternative m) => String -> m [Token]
lex [] = pure []
@@ -110,6 +119,7 @@ lex s = (comment s <|> item s <|> int s <|> char s <|> bool s <|> ident s) >>=
item ('!':'=':s) = pure (TExclamEq, s)
item ('&':'&':s) = pure (TAmpAmp, s)
item ('|':'|':s) = pure (TPipePipe, s)
+ item (':':':':s) = pure (TColonColon, s)
item ('(':s) = pure (TParenOpen, s)
item (')':s) = pure (TParenClose, s)
item ('[':s) = pure (TBrackOpen, s)