From 8f829331f6a4ef90687fa9519e02a4d2e4ff0805 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 23 Mar 2004 12:06:12 +0000 Subject: [PATCH] String pattern handling --- src/GF/Compile/CheckGrammar.hs | 2 ++ src/GF/Grammar/AppPredefined.hs | 5 +++-- src/GF/Grammar/PatternMatch.hs | 1 + src/GF/Source/GrammarToSource.hs | 1 + src/Today.hs | 2 +- 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/GF/Compile/CheckGrammar.hs b/src/GF/Compile/CheckGrammar.hs index 46d75c744..6e8abc02d 100644 --- a/src/GF/Compile/CheckGrammar.hs +++ b/src/GF/Compile/CheckGrammar.hs @@ -416,6 +416,8 @@ inferLType gr trm = case trm of PP _ _ ps -> True --- all isConstPatt ps PR ps -> all (isConstPatt . snd) ps PT _ p -> isConstPatt p + PString _ -> True + PInt _ -> True _ -> False inferPatt p = case p of diff --git a/src/GF/Grammar/AppPredefined.hs b/src/GF/Grammar/AppPredefined.hs index 14f35a1d4..179272032 100644 --- a/src/GF/Grammar/AppPredefined.hs +++ b/src/GF/Grammar/AppPredefined.hs @@ -6,8 +6,9 @@ import Ident import PrGrammar (prt) ---- import PGrammar (pTrm) --- predefined function definitions. AR 12/3/2003. --- Type checker looks at signatures in predefined.gf +-- predefined function type signatures and definitions. AR 12/3/2003. + +---- typPredefined :: Term -> Err Type appPredefined :: Term -> Term appPredefined t = case t of diff --git a/src/GF/Grammar/PatternMatch.hs b/src/GF/Grammar/PatternMatch.hs index 2ca8b21de..ecc34709b 100644 --- a/src/GF/Grammar/PatternMatch.hs +++ b/src/GF/Grammar/PatternMatch.hs @@ -77,6 +77,7 @@ isInConstantForm trm = case trm of Abs _ _ -> True App c a -> isInConstantForm c && isInConstantForm a R r -> all (isInConstantForm . snd . snd) r + K _ -> True Alias _ _ t -> isInConstantForm t _ -> False ---- isInArgVarForm trm diff --git a/src/GF/Source/GrammarToSource.hs b/src/GF/Source/GrammarToSource.hs index 3c785b322..641dc7b5d 100644 --- a/src/GF/Source/GrammarToSource.hs +++ b/src/GF/Source/GrammarToSource.hs @@ -163,6 +163,7 @@ trp p = case p of PP p c [] -> P.PQ (tri p) (tri c) PP p c a -> P.PQC (tri p) (tri c) (map trp a) PR r -> P.PR [P.PA [trLabelIdent l] (trp p) | (l,p) <- r] + PString s -> P.PStr s ---- PT t p -> prt p ---- prParenth (prt p +++ ":" +++ prt t) diff --git a/src/Today.hs b/src/Today.hs index b9a4cd59a..5c2ce8fb0 100644 --- a/src/Today.hs +++ b/src/Today.hs @@ -1 +1 @@ -module Today where today = "Mon Mar 1 10:50:38 CET 2004" +module Today where today = "Tue Mar 23 10:59:42 CET 2004"