Skip to content

Commit db99de8

Browse files
committed
Parser: (getE->e)xprAfter* (this is how other functions are named)
1 parent 0f6cc56 commit db99de8

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/Nix/Parser.hs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import Prettyprinter ( Doc
8080
, pretty
8181
)
8282
-- `parser-combinators` ships performance enhanced & MonadPlus-aware combinators.
83-
-- For example `smome` and `many` impoted here.
83+
-- For example `some` and `many` impoted here.
8484
import Text.Megaparsec hiding ( (<|>)
8585
, State
8686
)
@@ -139,14 +139,14 @@ reserved :: Text -> Parser ()
139139
reserved n =
140140
lexeme $ try $ chunk n *> lookAhead (void (satisfy reservedEnd) <|> eof)
141141

142-
getExprAfterP :: Parser a -> Parser NExprLoc
143-
getExprAfterP p = p *> nixExpr
142+
exprAfterP :: Parser a -> Parser NExprLoc
143+
exprAfterP p = p *> nixExpr
144144

145-
getExprAfterSymbol :: Char -> Parser NExprLoc
146-
getExprAfterSymbol p = getExprAfterP $ symbol p
145+
exprAfterSymbol :: Char -> Parser NExprLoc
146+
exprAfterSymbol p = exprAfterP $ symbol p
147147

148-
getExprAfterReservedWord :: Text -> Parser NExprLoc
149-
getExprAfterReservedWord word = getExprAfterP $ reserved word
148+
exprAfterReservedWord :: Text -> Parser NExprLoc
149+
exprAfterReservedWord word = exprAfterP $ reserved word
150150

151151
-- | A literal copy of @megaparsec@ one but with addition of the @\r@ for Windows EOL case (@\r\n@).
152152
-- Overall, parser should simply @\r\n -> \n@.
@@ -396,7 +396,7 @@ nixBinders = (inherit <|> namedVar) `endBy` symbol ';' where
396396
label "variable binding" $
397397
liftA3 NamedVar
398398
(annotated <$> nixSelector)
399-
(getExprAfterSymbol '=')
399+
(exprAfterSymbol '=')
400400
(pure p)
401401
scope = label "inherit scope" nixParens
402402

@@ -703,7 +703,7 @@ argExpr =
703703
pair <-
704704
liftA2 (,)
705705
identifier
706-
(optional $ getExprAfterSymbol '?')
706+
(optional $ exprAfterSymbol '?')
707707

708708
let args = acc <> [pair]
709709

@@ -727,7 +727,7 @@ nixLet =
727727
letBinders =
728728
liftA2 NLet
729729
nixBinders
730-
(getExprAfterReservedWord "in")
730+
(exprAfterReservedWord "in")
731731
-- Let expressions `let {..., body = ...}' are just desugared
732732
-- into `(rec {..., body = ...}).body'.
733733
letBody = (\x -> NSelect Nothing x (StaticKey "body" :| mempty)) <$> aset
@@ -740,17 +740,17 @@ nixIf =
740740
annotateNamedLocation "if" $
741741
liftA3 NIf
742742
(reserved "if" *> nixExprAlgebra)
743-
(getExprAfterReservedWord "then" )
744-
(getExprAfterReservedWord "else" )
743+
(exprAfterReservedWord "then" )
744+
(exprAfterReservedWord "else" )
745745

746746
-- ** with
747747

748748
nixWith :: Parser NExprLoc
749749
nixWith =
750750
annotateNamedLocation "with" $
751751
liftA2 NWith
752-
(getExprAfterReservedWord "with")
753-
(getExprAfterSymbol ';' )
752+
(exprAfterReservedWord "with")
753+
(exprAfterSymbol ';' )
754754

755755

756756
-- ** assert
@@ -759,8 +759,8 @@ nixAssert :: Parser NExprLoc
759759
nixAssert =
760760
annotateNamedLocation "assert" $
761761
liftA2 NAssert
762-
(getExprAfterReservedWord "assert")
763-
(getExprAfterSymbol ';' )
762+
(exprAfterReservedWord "assert")
763+
(exprAfterSymbol ';' )
764764

765765
-- ** . - reference (selector) into attr
766766

0 commit comments

Comments
 (0)