tools/pas2c.hs
changeset 7075 6bd7e5ad3f2b
parent 7072 159616c24bb8
child 7134 beb16926ae5c
equal deleted inserted replaced
7074:3f23bd0f2af2 7075:6bd7e5ad3f2b
   743         _ -> return $ text (op2C op) <> e
   743         _ -> return $ text (op2C op) <> e
   744 expr2C Null = return $ text "NULL"
   744 expr2C Null = return $ text "NULL"
   745 expr2C (CharCode a) = do
   745 expr2C (CharCode a) = do
   746     modify(\s -> s{lastType = BTChar})
   746     modify(\s -> s{lastType = BTChar})
   747     return $ quotes $ text "\\x" <> text (showHex (read a) "")
   747     return $ quotes $ text "\\x" <> text (showHex (read a) "")
   748 expr2C (HexCharCode a) = return $ quotes $ text "\\x" <> text (map toLower a)
   748 expr2C (HexCharCode a) = if length a <= 2 then return $ quotes $ text "\\x" <> text (map toLower a) else expr2C $ HexNumber a
   749 expr2C (SetExpression ids) = mapM (id2C IOLookup) ids >>= return . parens . hcat . punctuate (text " | ")
   749 expr2C (SetExpression ids) = mapM (id2C IOLookup) ids >>= return . parens . hcat . punctuate (text " | ")
   750 
   750 
   751 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "low" _))) = do
   751 expr2C (BuiltInFunCall [e] (SimpleReference (Identifier "low" _))) = do
   752     e' <- liftM (map toLower . render) $ expr2C e
   752     e' <- liftM (map toLower . render) $ expr2C e
   753     lt <- gets lastType
   753     lt <- gets lastType