From 9251a72e7876b61ede972136570e2b81c6a8d767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 26 Jan 2025 22:31:20 +0100 Subject: Do not accept plain variable as the last keywordless parameter --- src/Parser/Expr.hs | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/Parser/Expr.hs') diff --git a/src/Parser/Expr.hs b/src/Parser/Expr.hs index 5ff3f15..d8d96eb 100644 --- a/src/Parser/Expr.hs +++ b/src/Parser/Expr.hs @@ -415,22 +415,10 @@ functionArguments check param lit promote = do [ T.pack "multiple unnamed parameters" ] parseArgs False - ,do off <- stateOffset <$> getParserState - x <- identifier - choice - [do off' <- stateOffset <$> getParserState - y <- pparam <|> (promote off' =<< identifier) - checkAndInsert off' (Just (ArgumentKeyword x)) y $ parseArgs allowUnnamed - - ,if allowUnnamed - then do - y <- promote off x - checkAndInsert off Nothing y $ return M.empty - else do - registerParseError $ FancyError off $ S.singleton $ ErrorFail $ T.unpack $ T.concat - [ T.pack "multiple unnamed parameters" ] - return M.empty - ] + ,do x <- identifier + off <- stateOffset <$> getParserState + y <- pparam <|> (promote off =<< identifier) + checkAndInsert off (Just (ArgumentKeyword x)) y $ parseArgs allowUnnamed ,do return M.empty ] -- cgit v1.2.3