style(lexer): pluralize moduleNames parser

This commit is contained in:
Primrose 2025-09-24 20:51:05 +08:00
parent 20b5ffac36
commit e9280d63f8
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -181,8 +181,8 @@ anchors =
] ]
moduleName :: Parser Text moduleNames :: Parser Text
moduleName = intercalate "." . fmap Text.pack <$> upperId `sepBy1` char '.' moduleNames = intercalate "." . fmap Text.pack <$> upperId `sepBy1` char '.'
upperId :: Parser String upperId :: Parser String
upperId = (:) <$> satisfy isUpper <*> many1 identifierChar upperId = (:) <$> satisfy isUpper <*> many1 identifierChar
@ -197,7 +197,7 @@ modules :: Lexer
modules = between (char '"') (char '"') inner modules = between (char '"') (char '"') inner
where where
inner = do inner = do
module_ <- located $ Module <$> moduleName module_ <- located $ Module <$> moduleNames
mAnchor <- optionMaybe (located $ anchorHash *> (Anchor <$> anchorText)) mAnchor <- optionMaybe (located $ anchorHash *> (Anchor <$> anchorText))
pure $ case mAnchor of pure $ case mAnchor of
Just anchor -> [module_, anchor] Just anchor -> [module_, anchor]