definition:
|
classifyLine :: String -> SourceLine
classifyLine line
| take 3 line == "---" && all isSpace (drop 3 line) = Comment "" --"<br/>"
| take 4 line == "--- " && head (drop 4 line) /= '-' = Comment (drop 4 line)
| take 7 line == "module " = ModDef
| take 7 line == "import " = ModDef
| otherwise = let id1 = getFirstId line
in if null id1
then OtherLine
else if id1 == "data" || id1 == "type" || id1 == "newtype"
then DataDef (getDatatypeName line)
else if "'default" `isSuffixOf` id1
then OtherLine -- ignore default rules
else FuncDef id1
where
getDatatypeName = takeWhile isIdChar . dropWhile (==' ') . dropWhile isIdChar
|
demand:
|
no demanded arguments
|
deterministic:
|
deterministic operation
|
documentation:
|
-- classify a line of the source program:
-- here we replace blank line comments by a "breakline" tag
|
failfree:
|
<FAILING>
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{(_) |-> {Comment,DataDef,FuncDef,ModDef,OtherLine}}
|
name:
|
classifyLine
|
precedence:
|
no precedence defined
|
result-values:
|
{Comment,DataDef,FuncDef,ModDef,OtherLine}
|
signature:
|
String -> SourceLine
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|