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
# Additional build intputs of the default shell
# shellExtBuildInputs = {pkgs}: with pkgs; [
# haskellPackages.haskell-language-server
# ];
shellExtBuildInputs = {pkgs}: with pkgs; [
haskellPackages.haskell-language-server
];
# Wether to build hoogle in the default shell
# shellWithHoogle = true;

View File

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