On a second though, the actual error seems to be elsewhere, so still can use proper indexing
authoralfadur
Mon, 19 Nov 2018 06:57:36 +0300
changeset 14240 3a9e4f35aa68
parent 14239 27ae2d3d04b6
child 14241 0f8b647ea317
On a second though, the actual error seems to be elsewhere, so still can use proper indexing
tools/pas2c/Pas2C.hs
tools/pas2c/PascalParser.hs
--- a/tools/pas2c/Pas2C.hs	Mon Nov 19 04:21:44 2018 +0300
+++ b/tools/pas2c/Pas2C.hs	Mon Nov 19 06:57:36 2018 +0300
@@ -774,12 +774,6 @@
         where
             bt = BTEnum $ map (\(Identifier i _) -> map toLower i) ids
     type2C' (ArrayDecl Nothing t) = type2C (PointerTo t)
-    type2C' (ArrayDecl (Just r1) (ArrayDecl (Just r2) t)) = do
-        t' <- type2C t
-        lt <- gets lastType
-        r1' <- initExpr2C (InitRange r1)
-        r2' <- initExpr2C (InitRange r2)
-        return $ \i -> t' i <> brackets r2' <> brackets r1'
     type2C' (ArrayDecl (Just r) t) = do
         t' <- type2C t
         lt <- gets lastType
--- a/tools/pas2c/PascalParser.hs	Mon Nov 19 04:21:44 2018 +0300
+++ b/tools/pas2c/PascalParser.hs	Mon Nov 19 06:57:36 2018 +0300
@@ -167,7 +167,7 @@
         if null r then
             return $ ArrayDecl Nothing t
             else
-            return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ head r) t) (tail r)
+            return $ foldr (\a b -> ArrayDecl (Just a) b) (ArrayDecl (Just $ last r) t) (init r)
     recordDecl = do
         try $ do
             optional $ (try $ string' "packed") >> comments