mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-21 17:12:50 -06:00
Add case for when pre is not followed by anything
This commit is contained in:
@@ -167,6 +167,7 @@ lin2string l = case l of
|
|||||||
LFSpace -> "" -- when encountered at beginning/end
|
LFSpace -> "" -- when encountered at beginning/end
|
||||||
LFToken tok -> tok
|
LFToken tok -> tok
|
||||||
LFTuple [l] -> lin2string l
|
LFTuple [l] -> lin2string l
|
||||||
|
LFPre pts df -> lin2string df -- when encountered at end
|
||||||
LFConcat (LFPre pts df) l2 -> lin2string $ LFConcat l1 l2
|
LFConcat (LFPre pts df) l2 -> lin2string $ LFConcat l1 l2
|
||||||
where
|
where
|
||||||
l2' = lin2string l2
|
l2' = lin2string l2
|
||||||
@@ -177,7 +178,7 @@ lin2string l = case l of
|
|||||||
LFConcat LFCapit l2 -> let l = lin2string l2 in T.toUpper (T.take 1 l) `T.append` T.drop 1 l
|
LFConcat LFCapit l2 -> let l = lin2string l2 in T.toUpper (T.take 1 l) `T.append` T.drop 1 l
|
||||||
LFConcat LFAllCapit l2 -> let tks = T.words (lin2string l2) in T.unwords $ T.toUpper (head tks) : tail tks
|
LFConcat LFAllCapit l2 -> let tks = T.words (lin2string l2) in T.unwords $ T.toUpper (head tks) : tail tks
|
||||||
LFConcat l1 l2 -> T.unwords $ filter (not.T.null) [lin2string l1, lin2string l2]
|
LFConcat l1 l2 -> T.unwords $ filter (not.T.null) [lin2string l1, lin2string l2]
|
||||||
x -> T.pack $ printf "[%s]" (show x)
|
x -> T.pack $ printf "<%s>" (show x)
|
||||||
|
|
||||||
-- | List indexing with more verbose error messages
|
-- | List indexing with more verbose error messages
|
||||||
(!!) :: (Show a) => [a] -> Int -> a
|
(!!) :: (Show a) => [a] -> Int -> a
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ abstract Pre = {
|
|||||||
ant, dog: N ;
|
ant, dog: N ;
|
||||||
a, the: Det ;
|
a, the: Det ;
|
||||||
mkS : Det -> N -> S;
|
mkS : Det -> N -> S;
|
||||||
|
detS : Det -> S;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,3 +10,8 @@ PreCnc: a dog
|
|||||||
Pre: mkS the dog
|
Pre: mkS the dog
|
||||||
PreCnc: the dog
|
PreCnc: the dog
|
||||||
|
|
||||||
|
Pre: detS a
|
||||||
|
PreCnc: a
|
||||||
|
|
||||||
|
Pre: detS the
|
||||||
|
PreCnc: the
|
||||||
|
|||||||
@@ -2,3 +2,5 @@ mkS a ant
|
|||||||
mkS the ant
|
mkS the ant
|
||||||
mkS a dog
|
mkS a dog
|
||||||
mkS the dog
|
mkS the dog
|
||||||
|
detS a
|
||||||
|
detS the
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ concrete PreCnc of Pre = {
|
|||||||
} } ;
|
} } ;
|
||||||
the = { s = "the" } ;
|
the = { s = "the" } ;
|
||||||
mkS det n = { s = det.s ++ n.s } ;
|
mkS det n = { s = det.s ++ n.s } ;
|
||||||
|
detS det = { s = det.s } ;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user