@@ -21,7 +21,7 @@ module Nix.Parser
2121 , getUnaryOperator
2222 , getBinaryOperator
2323 , getSpecialOperator
24- , nixTopLevelForm
24+ , nixExpr
2525 , nixExprAlgebra
2626 , nixSet
2727 , nixBinders
@@ -140,7 +140,7 @@ reserved n =
140140 lexeme $ try $ chunk n *> lookAhead (void (satisfy reservedEnd) <|> eof)
141141
142142getExprAfterP :: Parser a -> Parser NExprLoc
143- getExprAfterP p = p *> nixTopLevelForm
143+ getExprAfterP p = p *> nixExpr
144144
145145getExprAfterSymbol :: Char -> Parser NExprLoc
146146getExprAfterSymbol p = getExprAfterP $ symbol p
@@ -195,7 +195,7 @@ brackets = on between symbol '[' ']'
195195-- dot = symbol "."
196196
197197antiquotedIsHungryForTrailingSpaces :: Bool -> Parser (Antiquoted v NExprLoc )
198- antiquotedIsHungryForTrailingSpaces hungry = Antiquoted <$> (antiStart *> nixTopLevelForm <* antiEnd)
198+ antiquotedIsHungryForTrailingSpaces hungry = Antiquoted <$> (antiStart *> nixExpr <* antiEnd)
199199 where
200200 antiStart :: Parser Text
201201 antiStart = label " ${" $ symbols " ${"
@@ -358,13 +358,13 @@ nixSym = annotateLocation $ mkSymF . coerce <$> identifier
358358
359359-- ** ( ) parens
360360
361- -- | 'nixTopLevelForm ' returns an expression annotated with a source position,
361+ -- | 'nixExpr ' returns an expression annotated with a source position,
362362-- however this position doesn't include the parsed parentheses, so remove the
363363-- "inner" location annotateion and annotate again, including the parentheses.
364364nixParens :: Parser NExprLoc
365365nixParens =
366366 annotateNamedLocation " parens" $
367- parens $ stripAnnF . unFix <$> nixTopLevelForm
367+ parens $ stripAnnF . unFix <$> nixExpr
368368
369369
370370-- ** [ ] list
@@ -714,7 +714,7 @@ nixLambda :: Parser NExprLoc
714714nixLambda =
715715 liftA2 annNAbs
716716 (annotateLocation1 $ try argExpr)
717- nixTopLevelForm
717+ nixExpr
718718
719719
720720-- ** let expression
@@ -855,8 +855,8 @@ nixExprAlgebra =
855855 snd <<$>>
856856 nixOperators nixSelector
857857
858- nixTopLevelForm :: Parser NExprLoc
859- nixTopLevelForm = keywords <|> nixLambda <|> nixExprAlgebra
858+ nixExpr :: Parser NExprLoc
859+ nixExpr = keywords <|> nixLambda <|> nixExprAlgebra
860860 where
861861 keywords = nixLet <|> nixIf <|> nixAssert <|> nixWith
862862
@@ -885,7 +885,7 @@ parseFromText parser input =
885885 $ (`evalState` initialPos stub) $ (`runParserT` stub) parser input
886886
887887fullExprParser :: Parser NExprLoc
888- fullExprParser = whiteSpace *> nixTopLevelForm <* eof
888+ fullExprParser = whiteSpace *> nixExpr <* eof
889889
890890parseNixFile' :: MonadFile m => (Parser NExprLoc -> Parser a ) -> Path -> m (Result a )
891891parseNixFile' f =
0 commit comments