mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-09-16 07:16:02 -06:00
control structure concat'
This commit is contained in:
@@ -942,6 +942,15 @@ value2termM flat xs (VReset ctl mb_cv v mb_qid) = do
|
|||||||
case ts of
|
case ts of
|
||||||
[t] -> return t
|
[t] -> return t
|
||||||
ts -> return (Markup identW [] ts)
|
ts -> return (Markup identW [] ts)
|
||||||
|
| ctl == cConcat' = do
|
||||||
|
ts <- case mb_cv of
|
||||||
|
Just (VInt n) -> return (genericTake n ts)
|
||||||
|
Nothing -> return ts
|
||||||
|
_ -> evalError (pp "[concat: .. | ..] requires an integer constant")
|
||||||
|
case ts of
|
||||||
|
[] -> mzero
|
||||||
|
[t] -> return t
|
||||||
|
ts -> return (Markup identW [] ts)
|
||||||
| ctl == cOne =
|
| ctl == cOne =
|
||||||
case (ts,mb_cv) of
|
case (ts,mb_cv) of
|
||||||
([] ,Nothing) -> mzero
|
([] ,Nothing) -> mzero
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ tcRho scope c (Markup tag attrs children) mb_ty = do
|
|||||||
res <- mapCM (\c child -> tcRho scope c child Nothing) c2 children
|
res <- mapCM (\c child -> tcRho scope c child Nothing) c2 children
|
||||||
instSigma scope c3 (Markup tag attrs (map fst res)) vtypeMarkup mb_ty
|
instSigma scope c3 (Markup tag attrs (map fst res)) vtypeMarkup mb_ty
|
||||||
tcRho scope c (Reset ctl mb_ct t qid) mb_ty
|
tcRho scope c (Reset ctl mb_ct t qid) mb_ty
|
||||||
| ctl == cConcat = do
|
| ctl == cConcat || ctl == cConcat' = do
|
||||||
let (c1,c23) = split c
|
let (c1,c23) = split c
|
||||||
(c2,c3 ) = split c23
|
(c2,c3 ) = split c23
|
||||||
(t,_) <- tcRho scope c1 t Nothing
|
(t,_) <- tcRho scope c1 t Nothing
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ cError = identS "error"
|
|||||||
|
|
||||||
-- * Used in the delimited continuations
|
-- * Used in the delimited continuations
|
||||||
cConcat = identS "concat"
|
cConcat = identS "concat"
|
||||||
|
cConcat' = identS "concat'"
|
||||||
cOne = identS "one"
|
cOne = identS "one"
|
||||||
cDefault = identS "default"
|
cDefault = identS "default"
|
||||||
cList = identS "list"
|
cList = identS "list"
|
||||||
|
|||||||
Reference in New Issue
Block a user