File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -194,12 +194,25 @@ brackets = on between symbol '[' ']'
194194-- colon = symbol ":"
195195-- dot = symbol "."
196196
197- antiquoteWithEnd :: Parser b -> Parser a -> Parser (Antiquoted v a )
198- antiquoteWithEnd t expr = Antiquoted <$> (antiStart *> expr <* t )
197+ antiquotedIsHungryForTrailingSpaces :: Bool -> Parser (Antiquoted v NExprLoc )
198+ antiquotedIsHungryForTrailingSpaces hungry = Antiquoted <$> (antiStart *> nixToplevelForm <* antiEnd )
199199 where
200200 antiStart :: Parser Text
201201 antiStart = label " ${" $ symbols " ${"
202202
203+ antiEnd :: Parser Char
204+ antiEnd = label " }" $
205+ bool
206+ id
207+ lexeme
208+ hungry
209+ (char ' }' )
210+
211+ antiquotedLexeme :: Parser (Antiquoted v NExprLoc )
212+ antiquotedLexeme = antiquotedIsHungryForTrailingSpaces True
213+
214+ antiquoted :: Parser (Antiquoted v NExprLoc )
215+ antiquoted = antiquotedIsHungryForTrailingSpaces False
203216
204217---------------------------------------------------------------------------------
205218
@@ -259,7 +272,7 @@ nixUri = lexeme $ annotateLocation $ try $ do
259272nixAntiquoted :: Parser a -> Parser (Antiquoted a NExprLoc )
260273nixAntiquoted p =
261274 label " anti-quotation" $
262- antiquoteWithEnd (symbol ' } ' ) nixToplevelForm
275+ antiquotedLexeme
263276 <|> Plain <$> p
264277
265278nixString' :: Parser (NString NExprLoc )
@@ -306,7 +319,7 @@ nixString' = lexeme $ label "string" $ doubleQuoted <|> indented
306319 (c /= ' \n ' )
307320
308321 stringChar end escStart esc =
309- antiquoteWithEnd (char ' } ' ) nixToplevelForm
322+ antiquoted
310323 <|> Plain . one <$> char ' $'
311324 <|> esc
312325 <|> Plain . toText <$> some plainChar
You can’t perform that action at this time.
0 commit comments