refactor lexer #2
1 changed files with 3 additions and 3 deletions
|
|
@ -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]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue