This commit is contained in:
Dmitry Zuikov 2023-02-07 13:40:41 +03:00
parent 1f973384cb
commit 38616c4aa1
2 changed files with 13 additions and 9 deletions

View File

@ -44,9 +44,9 @@ outputs = { self, nixpkgs, haskell-flake-utils, ... }@inputs:
# shell = ./shell.nix # shell = ./shell.nix
# Additional build intputs of the default shell # Additional build intputs of the default shell
# shellExtBuildInputs = {pkgs}: with pkgs; [ shellExtBuildInputs = {pkgs}: with pkgs; [
# haskellPackages.haskell-language-server haskellPackages.haskell-language-server
# ]; ];
# Wether to build hoogle in the default shell # Wether to build hoogle in the default shell
# shellWithHoogle = true; # shellWithHoogle = true;

View File

@ -161,20 +161,24 @@ 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 = sc >> many (topStmt <|> syntax scTop) top = many $ do
t <- topStmt
topStmt :: forall c . MegaConstraints c => Parser (Syntax c) sc
topStmt = do pure t
scTop
topTerm :: forall c . MegaConstraints c => Parser (Syntax c)
topTerm = do
sc
co <- MegaContext . Just <$> getOffset co <- MegaContext . Just <$> getOffset
s0 <- symbol scTop s0 <- symbol scTop
ss <- many (syntax scTop) ss <- many (syntax scTop)
void eol <|> eof void eol <|> eof
pure $ List co (s0:ss) pure $ List co (s0:ss)
topStmt :: forall c . MegaConstraints c => Parser (Syntax c)
topStmt = topTerm <|> syntax scTop
parseTop :: forall c . MegaConstraints c parseTop :: forall c . MegaConstraints c
=> String -> Either ParseFail [Syntax c] => String -> Either ParseFail [Syntax c]