summaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authoraarne <aarne@chalmers.se>2010-04-04 20:46:36 +0000
committeraarne <aarne@chalmers.se>2010-04-04 20:46:36 +0000
commit7a14507189f6af11a841aea0c9b39491417315f2 (patch)
tree252a5445f45375653ffac3d20ef0eddefaf17352 /src/runtime
parent95d4adac99421bddf3a2a3a84739902a1e2ce105 (diff)
in the shell, permit 3-letter lang codes as concrete syntax names
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/haskell/PGF/Macros.hs9
-rw-r--r--src/runtime/haskell/PGF/Parse.hs2
2 files changed, 9 insertions, 2 deletions
diff --git a/src/runtime/haskell/PGF/Macros.hs b/src/runtime/haskell/PGF/Macros.hs
index d7f242c45..147894cc8 100644
--- a/src/runtime/haskell/PGF/Macros.hs
+++ b/src/runtime/haskell/PGF/Macros.hs
@@ -52,6 +52,13 @@ lookConcr :: PGF -> CId -> Concr
lookConcr pgf cnc =
lookMap (error $ "Missing concrete syntax: " ++ showCId cnc) cnc $ concretes pgf
+-- use if name fails, use abstract + name; so e.g. "Eng" becomes "DemoEng"
+lookConcrComplete :: PGF -> CId -> Concr
+lookConcrComplete pgf cnc =
+ case Map.lookup cnc (concretes pgf) of
+ Just c -> c
+ _ -> lookConcr pgf (mkCId (showCId (absname pgf) ++ showCId cnc))
+
lookConcrFlag :: PGF -> CId -> CId -> Maybe Literal
lookConcrFlag pgf lang f = Map.lookup f $ cflags $ lookConcr pgf lang
@@ -196,4 +203,4 @@ updateProductionIndices pgf = pgf{ concretes = fmap updateConcrete (concretes pg
getFunctions (PApply funid args) = let CncFun fun _ = cncfuns pinfo Array.! funid in [fun]
getFunctions (PCoerce fid) = case IntMap.lookup fid productions of
Nothing -> []
- Just prods -> [fun | prod <- Set.toList prods, fun <- getFunctions prod] \ No newline at end of file
+ Just prods -> [fun | prod <- Set.toList prods, fun <- getFunctions prod]
diff --git a/src/runtime/haskell/PGF/Parse.hs b/src/runtime/haskell/PGF/Parse.hs
index 61035bd92..1efedd7c2 100644
--- a/src/runtime/haskell/PGF/Parse.hs
+++ b/src/runtime/haskell/PGF/Parse.hs
@@ -65,7 +65,7 @@ initState pgf lang (DTyp _ start _) =
return (Active 0 0 funid seqid args (AK cat lbl))
Nothing -> mzero
- cnc = lookConcr pgf lang
+ cnc = lookConcrComplete pgf lang
in PState pgf
cnc