--- trunk/src/selection/SelectionCompiler.cpp 2010/05/10 17:28:26 1442 +++ trunk/src/selection/SelectionCompiler.cpp 2015/03/05 16:30:23 2069 @@ -35,8 +35,9 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #include "selection/SelectionCompiler.hpp" @@ -51,12 +52,12 @@ namespace OpenMD { lineNumbers.clear(); lineIndices.clear(); aatokenCompiled.clear(); - + if (internalCompile()) { return true; } - - int icharEnd; + + std::size_t icharEnd; if ((icharEnd = script.find('\r', ichCurrentCommand)) == std::string::npos && (icharEnd = script.find('\n', ichCurrentCommand)) == std::string::npos) { icharEnd = script.size(); @@ -118,12 +119,14 @@ namespace OpenMD { // ltoken.push_back(Token(Token::string, str)); // continue; //} - if (lookingAtDecimal((tokCommand & Token::negnums) != 0)) { + //if (lookingAtDecimal((tokCommand & Token::negnums) != 0)) { + if (lookingAtDecimal((tokCommand) != 0)) { float value = lexi_cast(script.substr(ichToken, cchToken)); ltoken.push_back(Token(Token::decimal, boost::any(value))); continue; } - if (lookingAtInteger((tokCommand & Token::negnums) != 0)) { + //if (lookingAtInteger((tokCommand & Token::negnums) != 0)) { + if (lookingAtInteger((tokCommand) != 0)) { int val = lexi_cast(script.substr(ichToken, cchToken)); ltoken.push_back(Token(Token::integer, boost::any(val))); @@ -176,7 +179,7 @@ namespace OpenMD { continue; } - if (ltoken.size() == 0) { + if (ltoken.empty()) { return commandExpected(); } @@ -371,7 +374,7 @@ namespace OpenMD { return false; } cchToken = ichT - ichToken; - return true; + return isInteger(script.substr(ichToken, cchToken).c_str()); } bool SelectionCompiler::lookingAtLookupToken() { @@ -440,7 +443,7 @@ namespace OpenMD { bool SelectionCompiler::compileExpression() { /** todo */ - int i = 1; + unsigned int i = 1; int tokCommand = atokenCommand[0].tok; if (tokCommand == Token::define) { i = 2; @@ -572,6 +575,7 @@ namespace OpenMD { // fall into the code and below and just add the token case Token::all: case Token::none: + case Token::hull: return addTokenToPostfix(tokenNext()); case Token::leftparen: tokenNext(); @@ -664,7 +668,7 @@ namespace OpenMD { bool SelectionCompiler::isNameValid(const std::string& name) { int nbracket = 0; int ndot = 0; - for (int i =0 ; i < name.size(); ++i) { + for (unsigned int i = 0 ; i < name.size(); ++i) { switch(name[i]) { case '[' : @@ -688,7 +692,6 @@ namespace OpenMD { if (token.tok == Token::integer) { int index = boost::any_cast(token.value); int tok = tokPeek(); - std::cout << "Token::to is " << Token::to << ", tok = " << tok << std::endl; if (tok == Token::to) { tokenNext(); tok = tokPeek();