|
definition: |
readCommentsFile :: String -> IO [(Span, Comment)]
readCommentsFile filename = do
filecontents <- readCommentsFileRaw filename
if noComments filecontents
then return []
else return (readUnqualifiedTerm ["Curry.Span", "Curry.Position", "Curry.Comment"]
filecontents)
where
-- Checks if the `.cycom` file contains no comments (empty list).
-- This is true if the file contains nothing but whitespaces,
-- newlines, and brackets (string-representation of expression :: `[(Span, Comment)]`).
--
-- This check is necessary, unfortunately, because the parser fails for empty lists other
-- than "[]".
noComments = all (`elem` "[ ]\n")
|
|
demand: |
no demanded arguments |
|
deterministic: |
deterministic operation |
|
documentation: |
| Reads the comments from a specified file |
|
failfree: |
<FAILING> |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_) |-> _}
|
|
name: |
readCommentsFile |
|
precedence: |
no precedence defined |
|
result-values: |
_ |
|
signature: |
String -> Prelude.IO [(Curry.Span.Span, Comment)] |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |