tools/PascalParser.hs
changeset 6891 ab9843957664
parent 6875 6528171ce36d
child 6895 31def088a870
equal deleted inserted replaced
6890:6fc12f30c55c 6891:ab9843957664
    12 import Data.Maybe
    12 import Data.Maybe
    13 
    13 
    14 import PascalBasics
    14 import PascalBasics
    15 import PascalUnitSyntaxTree
    15 import PascalUnitSyntaxTree
    16     
    16     
    17 knownTypes = ["shortstring", "char", "byte"]
    17 knownTypes = ["shortstring", "ansistring", "char", "byte"]
    18 
    18 
    19 pascalUnit = do
    19 pascalUnit = do
    20     comments
    20     comments
    21     u <- choice [program, unit, systemUnit]
    21     u <- choice [program, unit, systemUnit]
    22     comments
    22     comments
   117         
   117         
   118 typeDecl = choice [
   118 typeDecl = choice [
   119     char '^' >> typeDecl >>= return . PointerTo
   119     char '^' >> typeDecl >>= return . PointerTo
   120     , try (string "shortstring") >> return (String 255)
   120     , try (string "shortstring") >> return (String 255)
   121     , try (string "string") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255
   121     , try (string "string") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255
       
   122     , try (string "ansistring") >> optionMaybe (brackets pas $ integer pas) >>= return . String . fromMaybe 255
   122     , arrayDecl
   123     , arrayDecl
   123     , recordDecl
   124     , recordDecl
   124     , setDecl
   125     , setDecl
   125     , functionType
   126     , functionType
   126     , sequenceDecl >>= return . Sequence
   127     , sequenceDecl >>= return . Sequence