tools/PascalParser.hs
changeset 7067 f98ec3aecf4e
parent 7066 12cc2bd84b0b
child 7069 bcf9d8e64e92
--- a/tools/PascalParser.hs	Sat May 12 22:13:56 2012 +0400
+++ b/tools/PascalParser.hs	Sat May 12 22:44:39 2012 +0400
@@ -10,6 +10,7 @@
 import Text.Parsec.String
 import Control.Monad
 import Data.Maybe
+import Data.Char
 
 import PascalBasics
 import PascalUnitSyntaxTree
@@ -355,7 +356,8 @@
         , try $ natural pas >>= \i -> notFollowedBy (char '.') >> (return . NumberLiteral . show) i
         , float pas >>= return . FloatLiteral . show
         , natural pas >>= return . NumberLiteral . show
-        , stringLiteral pas >>= return . StringLiteral
+        , try (string "_S" >> stringLiteral pas) >>= return . StringLiteral
+        , stringLiteral pas >>= return . strOrChar
         , try (string "#$") >> many hexDigit >>= \c -> comments >> return (HexCharCode c)
         , char '#' >> many digit >>= \c -> comments >> return (CharCode c)
         , char '$' >> many hexDigit >>=  \h -> comments >> return (HexNumber h)
@@ -390,6 +392,8 @@
            , Infix (try $ string "xor" >> return (BinOp "xor")) AssocLeft
           ]
         ]
+    strOrChar [a] = CharCode . show . ord $ a
+    strOrChar a = StringLiteral a    
     
 phrasesBlock = do
     try $ string "begin"
@@ -613,4 +617,3 @@
     string "var"
     v <- varsDecl True
     return $ System (t ++ v)
-  
\ No newline at end of file