From c6f9c615b4a311d43e63ffbaa9da595c1557c669 Mon Sep 17 00:00:00 2001 From: crumbtoo Date: Wed, 7 Feb 2024 21:38:01 -0700 Subject: [PATCH] fix top-level layout --- src/Rlp/Lex.x | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Rlp/Lex.x b/src/Rlp/Lex.x index 4222694..3c07c24 100644 --- a/src/Rlp/Lex.x +++ b/src/Rlp/Lex.x @@ -125,6 +125,12 @@ $white_no_nl+ ; () { doBol } } + +{ + \n ; + "{" { explicitLBrace `thenDo` popLexState } +} + { \n { beginPush bol } @@ -153,6 +159,7 @@ lexReservedName = \case "infix" -> TokenInfix "infixl" -> TokenInfixL "infixr" -> TokenInfixR + s -> error (show s) lexReservedOp :: Text -> RlpToken lexReservedOp = \case @@ -160,6 +167,7 @@ lexReservedOp = \case "::" -> TokenHasType "|" -> TokenPipe "->" -> TokenArrow + s -> error (show s) -- | @andBegin@, with the subtle difference that the start code is set -- /after/ the action @@ -325,7 +333,7 @@ doBol :: LexerAction (Located RlpToken) doBol inp l = do off <- cmpLayout i <- indentLevel - traceM $ "i: " <> show i + -- traceM $ "i: " <> show i -- important that we pop the lex state lest we find our lexer diverging popLexState case off of