refactor: Rename Tokens
This commit is contained in:
parent
9123e0b882
commit
34bad5af43
1 changed files with 6 additions and 6 deletions
12
app/Lexer.hs
12
app/Lexer.hs
|
|
@ -1,9 +1,9 @@
|
|||
module Lexer where
|
||||
|
||||
data Token = Plus
|
||||
| Minus
|
||||
| Multiply
|
||||
| Divide
|
||||
| Hyphen
|
||||
| Asterisk
|
||||
| ForwardSlash
|
||||
| Integer Int
|
||||
| LBrace
|
||||
| RBrace
|
||||
|
|
@ -17,9 +17,9 @@ lex' "" tokens _ = tokens
|
|||
lex' (' ':xs) tokens orgLength = lex' xs tokens orgLength
|
||||
lex' (x:xs) tokens orgLength = case x of
|
||||
'+' -> lex' xs (Plus:tokens) orgLength
|
||||
'-' -> lex' xs (Minus:tokens) orgLength
|
||||
'*' -> lex' xs (Multiply:tokens) orgLength
|
||||
'/' -> lex' xs (Divide:tokens) orgLength
|
||||
'-' -> lex' xs (Hyphen:tokens) orgLength
|
||||
'*' -> lex' xs (Asterisk:tokens) orgLength
|
||||
'/' -> lex' xs (ForwardSlash:tokens) orgLength
|
||||
'(' -> lex' xs (LBrace:tokens) orgLength
|
||||
')' -> lex' xs (RBrace:tokens) orgLength
|
||||
_ -> lexNumbers (x:xs) tokens orgLength
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue