diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2013-11-12 09:54:57 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2013-11-12 09:54:57 +0000 |
| commit | 0095119ec09b394332a23ab7cc16c0009c3f162a (patch) | |
| tree | c2c19ef36c3c04ae608ae93a9131ee1e71957c98 /src/compiler | |
| parent | b111b476a75577a5b21d1d498975cbb2eeed9324 (diff) | |
added Predef.SOFT_BIND. This special token allows zero or more spaces between ordinary tokens. It is also used in the English RGL to attach the commas to the previous word.
Diffstat (limited to 'src/compiler')
| -rw-r--r-- | src/compiler/GF/Compile/Compute/AppPredefined.hs | 2 | ||||
| -rw-r--r-- | src/compiler/GF/Compile/Compute/Predef.hs | 4 | ||||
| -rw-r--r-- | src/compiler/GF/Compile/Compute/Value.hs | 3 | ||||
| -rw-r--r-- | src/compiler/GF/Compile/GeneratePMCFG.hs | 2 | ||||
| -rw-r--r-- | src/compiler/GF/Compile/PGFtoJS.hs | 1 | ||||
| -rw-r--r-- | src/compiler/GF/Grammar/Predef.hs | 1 |
6 files changed, 11 insertions, 2 deletions
diff --git a/src/compiler/GF/Compile/Compute/AppPredefined.hs b/src/compiler/GF/Compile/Compute/AppPredefined.hs index a597726c9..0d23f8cb6 100644 --- a/src/compiler/GF/Compile/Compute/AppPredefined.hs +++ b/src/compiler/GF/Compile/Compute/AppPredefined.hs @@ -86,6 +86,8 @@ primitives = Map.fromList [] typeStr []))) Nothing) , (cBIND , ResOper (Just (noLoc (mkProd -- Str [] typeStr []))) Nothing) + , (cSOFT_BIND, ResOper (Just (noLoc (mkProd -- Str + [] typeStr []))) Nothing) ] where fun from to = oper (mkFunType from to) diff --git a/src/compiler/GF/Compile/Compute/Predef.hs b/src/compiler/GF/Compile/Compute/Predef.hs index 8c793502a..8c5e5c5f7 100644 --- a/src/compiler/GF/Compile/Compute/Predef.hs +++ b/src/compiler/GF/Compile/Compute/Predef.hs @@ -78,7 +78,8 @@ predefList = (cError,Error), -- Canonical values: (cPBool,PBool),(cPFalse,PFalse),(cPTrue,PTrue),(cInt,Int), - (cInts,Ints),(cNonExist,NonExist),(cBIND,BIND)] + (cInts,Ints),(cNonExist,NonExist) + ,(cBIND,BIND),(cSOFT_BIND,SOFT_BIND)] --- add more functions!!! delta f vs = @@ -107,6 +108,7 @@ delta f vs = PTrue -> canonical NonExist-> canonical BIND -> canonical + SOFT_BIND->canonical where canonical = delay delay = return (VApp f vs) -- wrong number of arguments diff --git a/src/compiler/GF/Compile/Compute/Value.hs b/src/compiler/GF/Compile/Compute/Value.hs index 21a3eb20e..8f47ad184 100644 --- a/src/compiler/GF/Compile/Compute/Value.hs +++ b/src/compiler/GF/Compile/Compute/Value.hs @@ -51,5 +51,6 @@ data Predefined = Drop | Take | Tk | Dp | EqStr | Occur | Occurs | ToUpper {- | Show | Read | ToStr | MapStr | EqVal -} | Error -- Canonical values below: - | PBool | PFalse | PTrue | Int | Ints | NonExist | BIND + | PBool | PFalse | PTrue | Int | Ints | NonExist + | BIND | SOFT_BIND deriving (Show,Eq,Ord,Ix,Bounded,Enum) diff --git a/src/compiler/GF/Compile/GeneratePMCFG.hs b/src/compiler/GF/Compile/GeneratePMCFG.hs index 99df9af3e..457853150 100644 --- a/src/compiler/GF/Compile/GeneratePMCFG.hs +++ b/src/compiler/GF/Compile/GeneratePMCFG.hs @@ -414,6 +414,8 @@ convertTerm opts sel ctype (Q (m,f)) f == cNonExist = return (CStr [SymNE]) | m == cPredef && f == cBIND = return (CStr [SymBIND]) + | m == cPredef && + f == cSOFT_BIND = return (CStr [SymSOFT_BIND]) convertTerm opts sel@(CProj l _) ctype (ExtR t1 t2@(R rs2)) | l `elem` map fst rs2 = convertTerm opts sel ctype t2 diff --git a/src/compiler/GF/Compile/PGFtoJS.hs b/src/compiler/GF/Compile/PGFtoJS.hs index 1730d62c4..707739025 100644 --- a/src/compiler/GF/Compile/PGFtoJS.hs +++ b/src/compiler/GF/Compile/PGFtoJS.hs @@ -89,6 +89,7 @@ sym2js (SymKS t) = new "SymKS" [JS.EStr t] sym2js (SymKP ts alts) = new "SymKP" [JS.EArray (map sym2js ts), JS.EArray (map alt2js alts)] sym2js SymNE = new "SymNE" [] sym2js SymBIND = new "SymKS" [JS.EStr "&+"] +sym2js SymSOFT_BIND = new "SymKS" [JS.EStr "&+"] alt2js (ps,ts) = new "Alt" [JS.EArray (map sym2js ps), JS.EArray (map JS.EStr ts)] diff --git a/src/compiler/GF/Grammar/Predef.hs b/src/compiler/GF/Grammar/Predef.hs index b814dd110..8ffd17b74 100644 --- a/src/compiler/GF/Grammar/Predef.hs +++ b/src/compiler/GF/Grammar/Predef.hs @@ -31,6 +31,7 @@ cOverload = identS "overload" cUndefinedType = identS "UndefinedType" cNonExist = identS "nonExist" cBIND = identS "BIND" +cSOFT_BIND = identS "SOFT_BIND" isPredefCat :: Ident -> Bool isPredefCat c = elem c [cInt,cString,cFloat] |
