Drop useless comments
This commit is contained in:
parent
c16c48b22c
commit
c5f1ccc4dc
@ -6,7 +6,6 @@ import Text.Megaparsec.Char
|
||||
import Data.Void
|
||||
import qualified Data.Set as Set
|
||||
|
||||
-- Lexer type and tokens
|
||||
type Lexer = Parsec Void String
|
||||
data LToken
|
||||
= LKeywordT
|
||||
@ -21,7 +20,6 @@ data LToken
|
||||
| LNewline
|
||||
deriving (Show, Eq, Ord)
|
||||
|
||||
-- Lexical rules
|
||||
keywordT :: Lexer LToken
|
||||
keywordT = string "t" *> notFollowedBy alphaNumChar *> pure LKeywordT
|
||||
|
||||
@ -65,11 +63,9 @@ closeBracket = char ']' *> pure LCloseBracket
|
||||
lnewline :: Lexer LToken
|
||||
lnewline = char '\n' *> pure LNewline
|
||||
|
||||
-- Whitespace consumer
|
||||
sc :: Lexer ()
|
||||
sc = skipMany (char ' ' <|> char '\t')
|
||||
|
||||
-- Lexer definition
|
||||
saplingLexer :: Lexer [LToken]
|
||||
saplingLexer = many (sc *> choice
|
||||
[ try identifier
|
||||
@ -84,7 +80,6 @@ saplingLexer = many (sc *> choice
|
||||
, lnewline
|
||||
] <* sc) <* eof
|
||||
|
||||
-- Lexing function with enhanced error handling
|
||||
lexSapling :: String -> [LToken]
|
||||
lexSapling input = case runParser saplingLexer "" input of
|
||||
Left err -> error $ "Lexical error:\n" ++ errorBundlePretty err
|
||||
|
Loading…
x
Reference in New Issue
Block a user