tools/PascalParser.hs
changeset 6357 52cb4807a78c
parent 6355 734fed7aefd3
child 6386 7d7703b26bda
--- a/tools/PascalParser.hs	Sun Nov 13 13:46:26 2011 +0300
+++ b/tools/PascalParser.hs	Sun Nov 13 20:24:55 2011 +0300
@@ -61,12 +61,14 @@
     | StringLiteral String
     | CharCode String
     | NumberLiteral String
+    | FloatLiteral String
     | HexNumber String
     | Reference Reference
     | Null
     deriving Show
 data Reference = ArrayElement [Expression] Reference
     | FunCall [Expression] Reference
+    | BuiltInFunCall [Expression] Reference
     | SimpleReference Identifier
     | Dereference Reference
     | RecordField Reference Reference
@@ -84,6 +86,7 @@
     | InitChar String
     | InitNull
     deriving Show
+
     
 pascalLanguageDef
     = emptyDef
@@ -100,7 +103,8 @@
             , "type", "var", "const", "out", "array", "packed"
             , "procedure", "function", "with", "for", "to"
             , "downto", "div", "mod", "record", "set", "nil"
-            , "string", "shortstring"
+            , "string", "shortstring", "succ", "pred", "low"
+            , "high"
             ]
     , reservedOpNames= [] 
     , caseSensitive  = False   
@@ -383,6 +387,8 @@
     where
     term = comments >> choice [
         parens pas $ expression 
+        , try $ integer pas >>= \i -> notFollowedBy (char '.') >> (return . NumberLiteral . show) i
+        , try $ float pas >>= return . FloatLiteral . show
         , try $ integer pas >>= return . NumberLiteral . show
         , stringLiteral pas >>= return . StringLiteral
         , char '#' >> many digit >>= return . CharCode