diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 11:45:31 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 11:45:31 +1100 |
commit | a7c69ec12aec23036bfdb6447e7c38b001a40f3d (patch) | |
tree | 03d7fc971195d623ff35e9f01773ae95bbe9a688 /impl/main.cpp | |
parent | bb9a899b7c45b830c6b70e2811130a41ebb31ee5 (diff) |
Fix up to build with clang (and fix another bug)
- Remove exceptions
- Remove dynamic casts
The bug was relating to MaxStrategy not cleaning up the influence sets
after propagating changes. I just added a call to .clear() and it seems
fine.
Diffstat (limited to 'impl/main.cpp')
-rw-r--r-- | impl/main.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/impl/main.cpp b/impl/main.cpp index b1d6984..6fbbda9 100644 --- a/impl/main.cpp +++ b/impl/main.cpp @@ -65,7 +65,8 @@ Expression<T>& treeToExpression(pANTLR3_BASE_TREE node, EquationSystem<T>& syste } else if (name == "GUARD") { op = new Guard<T>(); } else { - throw "Parse error: Unknown operator"; + std::cout << "throw exception" << *(char*)NULL; + //throw "Parse error: Unknown operator"; } return system.expression(op, args); } @@ -75,8 +76,10 @@ template<typename T> void treeToSystem(pANTLR3_BASE_TREE node, EquationSystem<T>& system) { ANTLR3_UINT32 num = node->getChildCount(node); - if (num % 2 == 1) - throw "Big problem here."; + if (num % 2 == 1) { + std::cout << "throw exception" << *(char*)NULL; + //throw "Big problem here."; + } pANTLR3_BASE_TREE varNode; pANTLR3_BASE_TREE exprNode; @@ -122,12 +125,12 @@ int main (int argc, char* argv[]) { } } - auto input = antlr3FileStreamNew((pANTLR3_UINT8)argv[1], ANTLR3_ENC_8BIT); - auto lex = EquationSystemLexerNew(input); - auto tokens = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lex)); - auto parser = EquationSystemParserNew(tokens); + pANTLR3_INPUT_STREAM input = antlr3FileStreamNew((pANTLR3_UINT8)argv[1], ANTLR3_ENC_8BIT); + pEquationSystemLexer lex = EquationSystemLexerNew(input); + pANTLR3_COMMON_TOKEN_STREAM tokens = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lex)); + pEquationSystemParser parser = EquationSystemParserNew(tokens); - auto ret = parser -> equation_system(parser); + EquationSystemParser_equation_system_return ret = parser -> equation_system(parser); EquationSystem<ZBar> system; treeToSystem<ZBar>(ret.tree, system); |