summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-09-19 14:10:04 +0000
committeraarne <aarne@cs.chalmers.se>2007-09-19 14:10:04 +0000
commitaff4aa20c19ccef4ccdbb664d2e989eba36f4446 (patch)
tree38bff4201ed5080d2659a4ce3409c1b8221fc771 /src
parent7825a1a1c54d6922c709bed7de3f23f049e0046e (diff)
repaired JS generation after GFCC changes
Diffstat (limited to 'src')
-rw-r--r--src/GF/Canon/CanonToJS.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/GF/Canon/CanonToJS.hs b/src/GF/Canon/CanonToJS.hs
index beefefa04..6280b870e 100644
--- a/src/GF/Canon/CanonToJS.hs
+++ b/src/GF/Canon/CanonToJS.hs
@@ -53,17 +53,19 @@ term2js l t = f t
C.R xs -> new "Arr" (map f xs)
C.P x y -> JS.ECall (JS.EMember (f x) (JS.Ident "sel")) [f y]
C.S xs -> new "Seq" (map f xs)
- C.K (C.KS s) -> new "Str" [JS.EStr s]
- C.K (C.KP ss vs) -> new "Seq" (map JS.EStr ss) -- FIXME
+ C.K t -> tokn2js t
C.V i -> JS.EIndex (JS.EVar children) (JS.EInt i)
C.C i -> new "Int" [JS.EInt i]
C.F (C.CId f) -> JS.ECall (JS.EMember (JS.EVar l) (JS.Ident "rule")) [JS.EStr f, JS.EVar children]
C.FV xs -> new "Variants" (map f xs)
- C.W str (C.R r) ->
- new "Suffix" (JS.EStr str : [JS.EStr s | C.K (C.KS s) <- r])
+ C.W str x -> new "Suffix" [JS.EStr str, f x]
C.RP x y -> new "Rp" [f x, f y]
C.TM -> new "Meta" []
+tokn2js :: C.Tokn -> JS.Expr
+tokn2js (C.KS s) = new "Str" [JS.EStr s]
+tokn2js (C.KP ss vs) = new "Seq" (map JS.EStr ss) -- FIXME
+
argIdent :: Integer -> JS.Ident
argIdent n = JS.Ident ("x" ++ show n)