i want to fucking die

This commit is contained in:
crumbtoo
2024-02-20 11:10:33 -07:00
parent 820bd7cdbc
commit 66c3d878c2
6 changed files with 248 additions and 90 deletions

View File

@@ -18,7 +18,8 @@ module Rlp.Parse.Types
, RlpToken(..), AlexInput(..), Position(..), spanFromPos, LexerAction
, Located(..), PsName
-- ** Lenses
, _TokenLitInt, aiPrevChar, aiSource, aiBytes, aiPos, posLine, posColumn
, _TokenLitInt, _TokenVarName, _TokenConName, _TokenVarSym
, aiPrevChar, aiSource, aiBytes, aiPos, posLine, posColumn
-- * Error handling
, MsgEnvelope(..), RlpcError(..), RlpParseError(..)
@@ -93,10 +94,10 @@ data RlpToken
-- literals
= TokenLitInt Int
-- identifiers
| TokenVarName Name
| TokenConName Name
| TokenVarSym Name
| TokenConSym Name
| TokenVarName Text
| TokenConName Text
| TokenVarSym Text
| TokenConSym Text
-- reserved words
| TokenData
| TokenCase
@@ -132,6 +133,26 @@ _TokenLitInt = prism TokenLitInt $ \case
TokenLitInt n -> Right n
x -> Left x
_TokenVarName :: Prism' RlpToken Text
_TokenVarName = prism TokenVarName $ \case
TokenVarName n -> Right n
x -> Left x
_TokenVarSym :: Prism' RlpToken Text
_TokenVarSym = prism TokenVarSym $ \case
TokenVarSym n -> Right n
x -> Left x
_TokenConName :: Prism' RlpToken Text
_TokenConName = prism TokenConName $ \case
TokenConName n -> Right n
x -> Left x
_TokenConSym :: Prism' RlpToken Text
_TokenConSym = prism TokenConSym $ \case
TokenConSym n -> Right n
x -> Left x
newtype P a = P {
runP :: ParseState
-> (ParseState, [MsgEnvelope RlpParseError], Maybe a)
@@ -261,6 +282,7 @@ initAlexInput s = AlexInput
--------------------------------------------------------------------------------
-- deriving instance Lift (Program RlpcPs)
-- deriving instance Lift (Decl RlpcPs)
-- deriving instance Lift (Pat RlpcPs)