forked from GitHub/gf-core
Add test case for selection using records (fails)
This commit is contained in:
@@ -103,7 +103,7 @@ mkCanon2lpgf opts gr am = do
|
||||
return $ L.LFTuple ts
|
||||
|
||||
C.VariantValue [] -> return L.LFEmpty
|
||||
C.VariantValue (vr:_) -> val2lin vr -- TODO variants not supported, just pick first
|
||||
C.VariantValue (vr:_) -> val2lin vr -- NOTE variants not supported, just pick first
|
||||
|
||||
C.VarValue (C.VarValueId (C.Unqual v)) -> do
|
||||
ix <- eitherElemIndex (C.VarId v) varIds
|
||||
|
||||
6
testsuite/lpgf/Tables.gf
Normal file
6
testsuite/lpgf/Tables.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
abstract Tables = {
|
||||
cat S ; F ;
|
||||
fun
|
||||
FtoS : F -> S ;
|
||||
f1, f2, f3, f4, f5, f6 : F ;
|
||||
}
|
||||
17
testsuite/lpgf/Tables.treebank
Normal file
17
testsuite/lpgf/Tables.treebank
Normal file
@@ -0,0 +1,17 @@
|
||||
Tables: FtoS f1
|
||||
TablesCnc: R1 _
|
||||
|
||||
Tables: FtoS f2
|
||||
TablesCnc: R1 _
|
||||
|
||||
Tables: FtoS f3
|
||||
TablesCnc: R1 _
|
||||
|
||||
Tables: FtoS f4
|
||||
TablesCnc: _ _
|
||||
|
||||
Tables: FtoS f5
|
||||
TablesCnc: _ Q2
|
||||
|
||||
Tables: FtoS f6
|
||||
TablesCnc: R2 Q3
|
||||
26
testsuite/lpgf/TablesCnc.gf
Normal file
26
testsuite/lpgf/TablesCnc.gf
Normal file
@@ -0,0 +1,26 @@
|
||||
concrete TablesCnc of Tables = {
|
||||
param
|
||||
R = R1 | R2 ;
|
||||
Q = Q3 | Q2 | Q1 ;
|
||||
oper
|
||||
ParamRec: Type = { r: R; q: Q } ;
|
||||
lincat
|
||||
S = Str ;
|
||||
F = { pr : ParamRec } ;
|
||||
lin
|
||||
f1 = { pr = { r = R1; q = Q1 } } ;
|
||||
f2 = { pr = { r = R1; q = Q2 } } ;
|
||||
f3 = { pr = { r = R1; q = Q3 } } ;
|
||||
f4 = { pr = { r = R2; q = Q1 } } ;
|
||||
f5 = { pr = { r = R2; q = Q2 } } ;
|
||||
f6 = { pr = { r = R2; q = Q3 } } ;
|
||||
|
||||
FtoS f = tbl ! f.pr ;
|
||||
oper
|
||||
tbl = table {
|
||||
{ r = R1 ; q = _ } => "R1 _" ;
|
||||
{ r = _ ; q = Q2 } => "_ Q2" ;
|
||||
{ r = R2 ; q = Q3 } => "R2 Q3" ;
|
||||
_ => "_ _"
|
||||
} ;
|
||||
}
|
||||
@@ -18,6 +18,7 @@ main = do
|
||||
doGrammar "Params"
|
||||
doGrammar "Walking"
|
||||
doGrammar "Foods"
|
||||
doGrammar "Tables"
|
||||
|
||||
doGrammar :: String -> IO ()
|
||||
doGrammar gname = do
|
||||
|
||||
Reference in New Issue
Block a user