+
+ lexComment :: Parser Char LexItem
+ lexComment = list (fromString "//") >>| lexUntilNL
+ >>= \chars->pure LexNL
+
+ lexBlockComment :: Parser Char LexItem
+ lexBlockComment = list (fromString "/*")
+ >>| (top until (list (fromString "*/")))
+ >>= \chars->pure $ widthHeight chars 0 0
+ where
+ widthHeight :: [Char] Int Int -> LexItem
+ widthHeight [] l c = LexSpace l c
+ widthHeight ['\n':xs] l _ = widthHeight xs (l+1) 0
+ widthHeight [x:xs] l c = widthHeight xs l (c+1)
+
+ lexNumber :: Parser Char LexItem
+ lexNumber = toString <$> some (satisfy isDigit)
+ >>= \si->pure $ LexToken (textSize si) (NumberToken $ toInt si)
+
+ lexIdentifier :: Parser Char LexItem
+ lexIdentifier = toString <$> some (satisfy isIdentChar)
+ >>= \si->pure $ LexToken (textSize si) (IdentToken si)
+