diff options
Diffstat (limited to 'lib/Language/Elna/Frontend/Parser.hs')
| -rw-r--r-- | lib/Language/Elna/Frontend/Parser.hs | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/Language/Elna/Frontend/Parser.hs b/lib/Language/Elna/Frontend/Parser.hs index 4093f25..75f359e 100644 --- a/lib/Language/Elna/Frontend/Parser.hs +++ b/lib/Language/Elna/Frontend/Parser.hs @@ -34,27 +34,24 @@ import Text.Megaparsec import qualified Text.Megaparsec.Char.Lexer as Lexer import Text.Megaparsec.Char ( alphaNumChar --- , char + , char , letterChar , space1 --- , string + , string ) import Control.Applicative (Alternative(..)) import Data.Maybe (isJust) --- import Data.Functor (($>)) type Parser = Parsec Void Text literalP :: Parser Literal literalP - = {- HexadecimalLiteral <$> (string "0x" *> lexeme Lexer.hexadecimal) - <|> -} IntegerLiteral <$> Lexer.signed space integerP - {- <|> CharacterLiteral <$> lexeme charP - <|> BooleanLiteral <$> (symbol "true" $> True) - <|> BooleanLiteral <$> (symbol "false" $> False) + = HexadecimalLiteral <$> (string "0x" *> lexeme Lexer.hexadecimal) + <|> IntegerLiteral <$> Lexer.signed space integerP + <|> CharacterLiteral <$> lexeme charP where charP = fromIntegral . fromEnum - <$> between (char '\'') (char '\'') Lexer.charLiteral -} + <$> between (char '\'') (char '\'') Lexer.charLiteral {- typeDefinitionP :: Parser Declaration typeDefinitionP = TypeDefinition @@ -73,7 +70,7 @@ termP = choice operatorTable :: [[Operator Parser Expression]] operatorTable = [ unaryOperator - -- , factorOperator + , factorOperator , termOperator ] where @@ -81,10 +78,10 @@ operatorTable = [ prefix "-" NegationExpression , prefix "+" id ] - {- factorOperator = + factorOperator = [ binary "*" ProductExpression - , binary "/" DivisionExpression - ] -} + -- , binary "/" DivisionExpression + ] termOperator = [ binary "+" SumExpression , binary "-" SubtractionExpression |
