JdeRobot / PyOnArduino

4 stars 2 forks source link

Fix #17 - Unbalanced parentheses fix in case of if statements #18

Closed rinz13r closed 5 years ago

rinz13r commented 5 years ago

As demonstrated in issue #17, the parentheses were not balanced. I've added a fix for balancing the parentheses out. We should probably start using visit rather than generic_visit, which calls the visitor on all children, in such cases. Finally, we should eliminate the use of globals (vars.is_if), to conditionally append to the generated code.

Other changes: Added __init__.py for modules, and corrected a directory name.

rinz13r commented 5 years ago

I certainly agree, that it doesn't pass the test cases because of the way the current tests are evaluated. I would like to point out that elif (...) : in Python is translated to else {if (...) {}} in C++. It should make no difference to the C++ compiler.