mirror of
https://github.com/idris-lang/Idris2.git
synced 2025-01-03 20:42:13 +03:00
Merge pull request #198 from edwinb/path-fix
Allow parsing multiple separators in Path
This commit is contained in:
commit
5fd0f77f4e
@ -395,9 +395,9 @@ parseBody = do text <- match PTText
|
||||
private
|
||||
parsePath : Grammar PathToken False Path
|
||||
parsePath = do vol <- optional parseVolumn
|
||||
root <- optional bodySeparator
|
||||
body <- sepBy bodySeparator parseBody
|
||||
trailSep <- optional bodySeparator
|
||||
root <- optional (some bodySeparator)
|
||||
body <- sepBy (some bodySeparator) parseBody
|
||||
trailSep <- optional (some bodySeparator)
|
||||
pure $ MkPath vol (isJust root) body (isJust trailSep)
|
||||
|
||||
||| Attempt to parse a String into Path.
|
||||
|
@ -231,7 +231,7 @@ buildDeps fname
|
||||
clearCtxt; addPrimitives
|
||||
put MD initMetadata
|
||||
mainttc <- getTTCFileName fname ".ttc"
|
||||
log 10 $ "Reloading " ++ show mainttc
|
||||
log 10 $ "Reloading " ++ show mainttc ++ " from " ++ fname
|
||||
readAsMain mainttc
|
||||
|
||||
-- Load the associated metadata for interactive editing
|
||||
|
@ -212,9 +212,9 @@ parseBody = do text <- match PTText
|
||||
|
||||
parsePath : Grammar PathToken False Path
|
||||
parsePath = do vol <- optional parseVolume
|
||||
root <- optional bodySeparator
|
||||
body <- sepBy bodySeparator parseBody
|
||||
trailSep <- optional bodySeparator
|
||||
root <- optional (some bodySeparator)
|
||||
body <- sepBy (some bodySeparator) parseBody
|
||||
trailSep <- optional (some bodySeparator)
|
||||
let body = filter (\case Normal s => ltrim s /= ""
|
||||
_ => True) body
|
||||
pure $ MkPath vol (isJust root) body (isJust trailSep)
|
||||
|
Loading…
Reference in New Issue
Block a user