tools/pas2c.hs
changeset 7057 c3eba84d1a98
parent 7056 2884c7be6691
child 7060 861d6897917f
equal deleted inserted replaced
7056:2884c7be6691 7057:c3eba84d1a98
   683             ref2C $ FunCall [expr1, expr2] (SimpleReference i)
   683             ref2C $ FunCall [expr1, expr2] (SimpleReference i)
   684         (_, BTRecord t1 _, BTInt) -> do
   684         (_, BTRecord t1 _, BTInt) -> do
   685             -- aw, "LongInt" here is hwengine-specific hack
   685             -- aw, "LongInt" here is hwengine-specific hack
   686             i <- op2CTyped op [SimpleType (Identifier t1 undefined), SimpleType (Identifier "LongInt" undefined)]
   686             i <- op2CTyped op [SimpleType (Identifier t1 undefined), SimpleType (Identifier "LongInt" undefined)]
   687             ref2C $ FunCall [expr1, expr2] (SimpleReference i)
   687             ref2C $ FunCall [expr1, expr2] (SimpleReference i)
       
   688         ("in", _, _) -> 
       
   689             case expr2 of
       
   690                  SetExpression set -> do
       
   691                      ids <- mapM (id2C IOLookup) set
       
   692                      return . parens . hcat . punctuate (text " || ") . map (\i -> parens $ e1 <+> text "==" <+> i) $ ids
       
   693                  _ -> error "'in' against not set expression"
   688         (o, _, _) | o `elem` boolOps -> do
   694         (o, _, _) | o `elem` boolOps -> do
   689                         modify(\s -> s{lastType = BTBool})
   695                         modify(\s -> s{lastType = BTBool})
   690                         return $ parens e1 <+> text o <+> parens e2
   696                         return $ parens e1 <+> text o <+> parens e2
   691                   | otherwise -> return $ parens e1 <+> text o <+> parens e2
   697                   | otherwise -> return $ parens e1 <+> text o <+> parens e2
   692     where
   698     where