fixed parse error

This commit is contained in:
Dmitry Zuikov 2023-02-09 15:06:36 +03:00
parent ba178789e7
commit 10ecda6a31
1 changed files with 3 additions and 5 deletions

View File

@ -161,14 +161,12 @@ parseSyntax :: forall c . MegaConstraints c
parseSyntax = parse (merely (syntax sc)) "input" parseSyntax = parse (merely (syntax sc)) "input"
top :: forall c . MegaConstraints c => Parser [Syntax c] top :: forall c . MegaConstraints c => Parser [Syntax c]
top = many $ do top = do
t <- topStmt
sc sc
pure t many topStmt
topTerm :: forall c . MegaConstraints c => Parser (Syntax c) topTerm :: forall c . MegaConstraints c => Parser (Syntax c)
topTerm = do topTerm = do
L.lexeme sc $ do
co <- MegaContext . Just <$> getOffset co <- MegaContext . Just <$> getOffset
s0 <- symbol scTop s0 <- symbol scTop
ss <- many (syntax scTop) ss <- many (syntax scTop)
@ -177,7 +175,7 @@ topTerm = do
pure $ List co (s0:ss) pure $ List co (s0:ss)
topStmt :: forall c . MegaConstraints c => Parser (Syntax c) topStmt :: forall c . MegaConstraints c => Parser (Syntax c)
topStmt = topTerm <|> syntax scTop topStmt = topTerm <|> syntax sc
parseTop :: forall c . MegaConstraints c parseTop :: forall c . MegaConstraints c
=> String -> Either ParseFail [Syntax c] => String -> Either ParseFail [Syntax c]