Support operator 'in', replace it with equality checks against each element of set
--- a/tools/pas2c.hs Fri May 11 22:17:39 2012 +0400
+++ b/tools/pas2c.hs Fri May 11 22:35:09 2012 +0400
@@ -685,6 +685,12 @@
-- aw, "LongInt" here is hwengine-specific hack
i <- op2CTyped op [SimpleType (Identifier t1 undefined), SimpleType (Identifier "LongInt" undefined)]
ref2C $ FunCall [expr1, expr2] (SimpleReference i)
+ ("in", _, _) ->
+ case expr2 of
+ SetExpression set -> do
+ ids <- mapM (id2C IOLookup) set
+ return . parens . hcat . punctuate (text " || ") . map (\i -> parens $ e1 <+> text "==" <+> i) $ ids
+ _ -> error "'in' against not set expression"
(o, _, _) | o `elem` boolOps -> do
modify(\s -> s{lastType = BTBool})
return $ parens e1 <+> text o <+> parens e2