tools/pas2c/PascalParser.hs
changeset 10131 4b4a043111f4
parent 10129 cd2a64a1f4aa
child 10245 3ccc054c3c3e
equal deleted inserted replaced
10130:a9d509848390 10131:4b4a043111f4
   627         , stringLiteral pas >>= return . InitString
   627         , stringLiteral pas >>= return . InitString
   628         , char' '#' >> many digit >>= \c -> comments >> return (InitChar c)
   628         , char' '#' >> many digit >>= \c -> comments >> return (InitChar c)
   629         , char' '$' >> many hexDigit >>= \h -> comments >> return (InitHexNumber h)
   629         , char' '$' >> many hexDigit >>= \h -> comments >> return (InitHexNumber h)
   630         , char' '@' >> initExpression >>= \c -> comments >> return (InitAddress c)
   630         , char' '@' >> initExpression >>= \c -> comments >> return (InitAddress c)
   631         , try $ string' "nil" >> return InitNull
   631         , try $ string' "nil" >> return InitNull
   632         , itypeCast
   632         , try itypeCast
   633         , iD >>= return . InitReference
   633         , iD >>= return . InitReference
   634         ]
   634         ]
   635 
   635 
   636     notRecord (InitRecord _) = False
   636     notRecord (InitRecord _) = False
   637     notRecord _ = True
   637     notRecord _ = True
   679           ]--}
   679           ]--}
   680         --, [Prefix (try (string' "not") >> return (InitPrefixOp "not"))]
   680         --, [Prefix (try (string' "not") >> return (InitPrefixOp "not"))]
   681         ]
   681         ]
   682 
   682 
   683     itypeCast = do
   683     itypeCast = do
   684         t <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) knownTypes
   684         --t <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) knownTypes
       
   685         t <- iD
   685         i <- parens pas initExpression
   686         i <- parens pas initExpression
   686         comments
   687         comments
   687         return $ InitTypeCast (Identifier t BTUnknown) i
   688         return $ InitTypeCast t i
   688 
   689 
   689 builtInFunction :: Parsec String u a -> Parsec String u (String, [a])
   690 builtInFunction :: Parsec String u a -> Parsec String u (String, [a])
   690 builtInFunction e = do
   691 builtInFunction e = do
   691     name <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) builtin
   692     name <- choice $ map (\s -> try $ caseInsensitiveString s >>= \i -> notFollowedBy alphaNum >> return i) builtin
   692     spaces
   693     spaces