ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/src/selection/SelectionCompiler.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/src/selection/SelectionCompiler.cpp (file contents):
Revision 1967 by tim, Thu Feb 3 23:14:05 2005 UTC vs.
Revision 1972 by tim, Fri Feb 4 22:39:26 2005 UTC

# Line 82 | Line 82 | bool SelectionCompiler::internalCompile(){
82      for ( ; true; ichToken += cchToken) {
83          if (lookingAtLeadingWhitespace())
84              continue;
85 <        if (lookingAtComment())
86 <            continue;
85 >        //if (lookingAtComment())
86 >        //    continue;
87          bool endOfLine = lookingAtEndOfLine();
88          if (endOfLine || lookingAtEndOfStatement()) {
89              if (tokCommand != Token::nada) {
# Line 131 | Line 131 | bool SelectionCompiler::internalCompile(){
131          }
132        
133          if (lookingAtLookupToken()) {
134 <            std::string ident = script.substr(ichToken, ichToken + cchToken);
135 <
134 >            std::string ident = script.substr(ichToken, cchToken);
135              Token token;            
136              Token* pToken = TokenMap::getInstance()->getToken(ident);
137              if (pToken != NULL) {
# Line 419 | Line 418 | bool SelectionCompiler::lookingAtLookupToken() {
418                  return false;
419              }
420          case '?': // include question marks in identifier for atom expressions
421 <            while (ichT < cchScript && (std::isalpha(ch = script[ichT]) ||std::isdigit(ch) ||
422 <                ch == '_' || ch == '?') ||(ch == '^' && ichT > ichToken && std::isdigit(script[ichT - 1]))) {
423 <                // hack for insertion codes embedded in an atom expression :-(
425 <                // select c3^a
421 >            while (ichT < cchScript && !std::isspace(ch = script[ichT]) && (std::isalpha(ch) ||std::isdigit(ch) ||
422 >                ch == '_' || ch == '?') ) {
423 >
424                  ++ichT;
425              }
426          break;
# Line 597 | Line 595 | bool SelectionCompiler::clauseComparator() {
595      }
596  
597      Token tokenValue = tokenNext();
598 <    if (tokenValue.tok != Token::integer) {
599 <        return integerExpected();
598 >    if (tokenValue.tok != Token::integer && tokenValue.tok != Token::decimal) {
599 >        return numberExpected();
600      }
601 <    int val = tokenValue.intValue;
602 <    // note that a comparator instruction is a complicated instruction
603 <    // int intValue is the tok of the property you are comparing
604 <    // the value against which you are comparing is stored as an Integer
605 <    // in the object value
601 >    
602 >    float val;
603 >    if (tokenValue.value.type() == typeid(int)) {
604 >        val = boost::any_cast<int>(tokenValue.value);
605 >    } else if (tokenValue.value.type() == typeid(float)) {
606 >        val = boost::any_cast<float>(tokenValue.value);
607 >    } else {
608 >        return false;
609 >    }
610 >
611      return addTokenToPostfix(Token(tokenComparator.tok,
612                         tokenAtomProperty.tok, boost::any(val)));
613   }
# Line 654 | Line 657 | bool SelectionCompiler::clauseChemObjName() {
657      tok = tokPeek();
658      //allow two dot at most
659      if (tok == Token::dot) {
660 +        tokenNext();
661 +        chemObjName += ".";
662          if (!clauseName(chemObjName)) {
663              return false;
664          }
665          tok = tokPeek();
666          if (tok == Token::dot) {
667 +            tokenNext();
668 +            chemObjName += ".";
669 +
670              if (!clauseName(chemObjName)) {
671                  return false;
672              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines