definition:
|
getCodeDoc :: [SrcLine] -> Span -> Doc
getCodeDoc (l:ls) sp = case sp of
(Span (Position l1 c1) (Position l2 c2))
| fst l < l1
-> getCodeDoc ls sp
| fst l > l2
-> empty
| fst l == l1 && fst l == l2
-> getLineNumDoc (l)
<+> getLineDoc 1 (\n -> n >= c1 && n <= c2) (snd l)
<$$> createUnderLineNumDoc l
<> createUnderLineDoc' 1 (\n -> n >= c1 && n <= c2) (snd l)
<$$> getCodeDoc ls sp
| fst l == l1
-> getLineNumDoc (l)
<+> getLineDoc 1 ((<=) c1) (snd l)
<$$> createUnderLineNumDoc l
<> createUnderLineDoc 1 ((<=) c1) False (snd l)
<$$> getCodeDoc ls sp
| fst l == l2
-> getLineNumDoc (l)
<+> getLineDoc 1 ((>=) c2) (snd l)
<$$> createUnderLineNumDoc l
<> createUnderLineDoc 1 ((>=) c2) False (snd l)
<$$> getCodeDoc ls sp
| otherwise
-> getLineNumDoc (l)
<+> red (text (snd l))
<$$> createUnderLineNumDoc l
<> createUnderLineDoc 1 (\_ -> True) False (snd l)
<$$> getCodeDoc ls sp
_ -> error "getCodeDoc: Invalid Span"
getCodeDoc [] _ = empty
|
demand:
|
argument 1
|
deterministic:
|
deterministic operation
|
documentation:
|
-- Returns corresponding code in `Doc`.
|
failfree:
|
<FAILING>
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{({:},{Span}) |-> _ || ({[]},_) |-> {Doc}}
|
name:
|
getCodeDoc
|
precedence:
|
no precedence defined
|
result-values:
|
_
|
signature:
|
[(Prelude.Int, String)] -> Curry.Span.Span -> Text.PrettyImpl.Doc
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|