This commit is contained in:
crumbtoo
2024-01-22 12:20:05 -07:00
parent 692d22afb9
commit e3b18c8915
5 changed files with 64 additions and 10 deletions

View File

@@ -54,6 +54,7 @@ $asciisym = [\!\#\$\%\&\*\+\.\/\<\=\>\?\@\\\^\|\-\~\:]
@reservedname =
case|data|do|import|in|let|letrec|module|of|where
|infixr|infixl|infix
@reservedop =
"=" | \\ | "->" | "|"
@@ -125,6 +126,9 @@ lexReservedName = \case
"of" -> TokenOf
"let" -> TokenLet
"in" -> TokenIn
"infix" -> TokenInfix
"infixl" -> TokenInfixL
"infixr" -> TokenInfixR
lexReservedOp :: Text -> RlpToken
lexReservedOp = \case
@@ -223,7 +227,7 @@ initAlexInput s = AlexInput
, _aiPos = (1,1)
}
runP' :: P a -> Text -> (ParseState, [RlpParseError], Maybe a)
runP' :: P a -> Text -> (ParseState, [MsgEnvelope RlpParseError], Maybe a)
runP' p s = runP p st where
st = initParseState s
@@ -241,7 +245,7 @@ lexToken = do
AlexToken inp' l act -> do
psInput .= inp'
act inp l
AlexError inp' -> addFatal RlpParErrLexical
AlexError inp' -> addFatalHere 1 RlpParErrLexical
lexCont :: (Located RlpToken -> P a) -> P a
lexCont = (lexToken >>=)