tools/pas2c.hs
changeset 6979 cd28fe36170a
parent 6967 1224c6fb36c3
child 6980 07a710e22846
--- a/tools/pas2c.hs	Tue May 01 19:28:30 2012 +0400
+++ b/tools/pas2c.hs	Tue May 01 19:29:47 2012 +0400
@@ -370,8 +370,13 @@
     
 tvar2C _ (VarDeclaration isConst (ids, t) mInitExpr) = do
     t' <- liftM (((if isConst then text "const" else empty) <+>) . ) $ type2C t
+    lt <- gets lastType
     ie <- initExpr mInitExpr
-    liftM (map(\i -> t' i <+> ie)) $ mapM (id2CTyped t) ids
+    case (isConst, lt, ids, mInitExpr) of
+         (True, BTInt, [i], Just _) -> do
+             i' <- id2CTyped t i
+             return [text "enum" <> braces (i' <+> ie)]
+         _ -> liftM (map(\i -> t' i <+> ie)) $ mapM (id2CTyped t) ids
     where
     initExpr Nothing = return $ empty
     initExpr (Just e) = liftM (text "=" <+>) (initExpr2C e)