--- trunk/src/brains/SimCreator.cpp 2005/12/02 15:38:03 770 +++ trunk/src/brains/SimCreator.cpp 2005/12/30 15:32:55 832 @@ -63,7 +63,17 @@ #include "mdParser/MDParser.hpp" #include "mdParser/MDTreeParser.hpp" #include "mdParser/SimplePreprocessor.hpp" +#include "antlr/ANTLRException.hpp" +#include "antlr/TokenStreamRecognitionException.hpp" +#include "antlr/TokenStreamIOException.hpp" +#include "antlr/TokenStreamException.hpp" +#include "antlr/RecognitionException.hpp" +#include "antlr/CharStreamException.hpp" +#include "antlr/MismatchedCharException.hpp" +#include "antlr/MismatchedTokenException.hpp" +#include "antlr/NoViableAltForCharException.hpp" +#include "antlr/NoViableAltException.hpp" #ifdef IS_MPI #include "math/ParallelRandNumGen.hpp" @@ -92,7 +102,7 @@ Globals* SimCreator::parseFile(const std::string mdFil streamSize = ppStream.str().size() +1; commStatus = MPI_Bcast(&streamSize, 1, MPI_LONG, masterNode, MPI_COMM_WORLD); - commStatus = MPI_Bcast(ppStream.str().c_str(), streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); + commStatus = MPI_Bcast(static_cast(const_cast(ppStream.str().c_str())), streamSize, MPI_CHAR, masterNode, MPI_COMM_WORLD); } else { @@ -137,6 +147,34 @@ Globals* SimCreator::parseFile(const std::string mdFil simParams = treeParser.walkTree(parser.getAST()); } + + catch(antlr::MismatchedCharException& e) { + cerr<< "parser exception: " << e.getMessage() << " " << e.getFilename() << ":" << e.getLine() << " " << e.getColumn() << endl; + } + catch(antlr::MismatchedTokenException &e) { + cerr<< "parser exception: " << e.getMessage() << " " << e.getFilename() << ":" << e.getLine() << " " << e.getColumn() << endl; + } + catch(antlr::NoViableAltForCharException &e) { + cerr<< "parser exception: " << e.getMessage() << " " << e.getFilename() << ":" << e.getLine() << " " << e.getColumn() << endl; + } + catch(antlr::NoViableAltException &e) { + cerr<< "parser exception: " << e.getMessage() << " " << e.getFilename() << ":" << e.getLine() << " " << e.getColumn() << endl; + } + catch(antlr::TokenStreamRecognitionException& e) { + cerr<< "parser exception: " << e.getMessage() << " " << e.getFilename() << ":" << e.getLine() << " " << e.getColumn() << endl; + } + catch(antlr::TokenStreamIOException& e) { + cerr<< "parser exception: " << e.getMessage() << endl; + } + catch(antlr::TokenStreamException& e) { + cerr<< "parser exception: " << e.getMessage() << endl; + } + catch (antlr::RecognitionException& e) { + cerr<< "parser exception: " << e.getMessage() << " " << e.getFilename() << ":" << e.getLine() << " " << e.getColumn() << endl; + } + catch (antlr::CharStreamException& e) { + cerr << "parser exception: " << e.getMessage() << endl; + } catch (exception& e) { cerr << "parser exception: " << e.what() << endl; } @@ -186,7 +224,7 @@ Globals* SimCreator::parseFile(const std::string mdFil } ff->parse(forcefieldFileName); - + ff->setFortranForceOptions(); //create SimInfo SimInfo * info = new SimInfo(ff, simParams);