mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-08-19 10:46:22 -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
|
||||
[t] -> return t
|
||||
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 =
|
||||
case (ts,mb_cv) of
|
||||
([] ,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
|
||||
instSigma scope c3 (Markup tag attrs (map fst res)) vtypeMarkup 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
|
||||
(c2,c3 ) = split c23
|
||||
(t,_) <- tcRho scope c1 t Nothing
|
||||
|
||||
@@ -63,6 +63,7 @@ cError = identS "error"
|
||||
|
||||
-- * Used in the delimited continuations
|
||||
cConcat = identS "concat"
|
||||
cConcat' = identS "concat'"
|
||||
cOne = identS "one"
|
||||
cDefault = identS "default"
|
||||
cList = identS "list"
|
||||
|
||||
Reference in New Issue
Block a user