--- a/tools/PascalUnitSyntaxTree.hs Sun Feb 05 15:55:15 2012 +0100
+++ b/tools/PascalUnitSyntaxTree.hs Sun Feb 05 23:24:43 2012 +0400
@@ -1,7 +1,7 @@
module PascalUnitSyntaxTree where
---import Data.Traversable
import Data.Maybe
+import Data.Char
data PascalUnit =
Program Identifier Implementation Phrase
@@ -30,6 +30,7 @@
| String Integer
| Set TypeDecl
| FunctionType TypeDecl [TypeVarDeclaration]
+ | DeriveType InitExpression
| UnknownType
deriving Show
data Range = Range Identifier
@@ -108,17 +109,19 @@
deriving Show
+{--
type2BaseType :: TypeDecl -> BaseType
-type2BaseType (SimpleType (Identifier s _)) = f s
+type2BaseType st@(SimpleType (Identifier s _)) = f (map toLower s)
where
f "longint" = BTInt
f "integer" = BTInt
f "word" = BTInt
f "pointer" = BTPointerTo BTVoid
- f _ = BTUnknown
+ f _ = error $ show st
type2BaseType (Sequence ids) = BTEnum $ map (\(Identifier i _) -> i) ids
type2BaseType (RecordType tv mtvs) = BTRecord $ concatMap f (concat $ tv : fromMaybe [] mtvs)
where
f (VarDeclaration _ (ids, td) _) = map (\(Identifier i _) -> (i, type2BaseType td)) ids
-type2BaseType _ = BTUnknown
-
\ No newline at end of file
+type2BaseType (PointerTo t) = BTPointerTo $ type2BaseType t
+type2BaseType a = error $ show a
+--}