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 1978 by tim, Fri Feb 4 22:39:26 2005 UTC vs.
Revision 1979 by tim, Mon Feb 7 19:13:18 2005 UTC

# Line 118 | Line 118 | bool SelectionCompiler::internalCompile(){
118              //    continue;
119              //}
120              if (lookingAtDecimal((tokCommand & Token::negnums) != 0)) {
121 <                float value = lexi_cast<float>(script.substr(ichToken, ichToken + cchToken));          
122 <                ltoken.push_back(Token(Token::decimal, value));/**@todo*/
121 >                float value = lexi_cast<float>(script.substr(ichToken, cchToken));        
122 >                std::cout << "encount an decimal: " << value << std::endl;
123 >                ltoken.push_back(Token(Token::decimal, boost::any(value)));
124                  continue;
125              }
126              if (lookingAtInteger((tokCommand & Token::negnums) != 0)) {
127 <                std::string intString = script.substr(ichToken, ichToken + cchToken);
128 <                int val = lexi_cast<int>(intString);
129 <                ltoken.push_back(Token(Token::integer, val, intString));/**@todo*/
127 >
128 >                int val = lexi_cast<int>(script.substr(ichToken, cchToken));
129 >                std::cout << "encount an integer: " << val << std::endl;
130 >                ltoken.push_back(Token(Token::integer,   boost::any(val)));
131                  continue;
132              }
133          }
# Line 242 | Line 244 | bool SelectionCompiler::internalCompile(){
244        previousCharBackslash = ch == '\\' ? !previousCharBackslash : false;
245      }
246      cchToken = ichT - ichToken;
247 +
248 +
249 +    std::cout << "lookingAtString: encount " << script.substr(ichToken, cchToken) << std::endl;
250      return true;
251    }
252  
# Line 425 | Line 430 | bool SelectionCompiler::lookingAtLookupToken() {
430              }
431          break;
432      }
433 +
434      cchToken = ichT - ichToken;
435 +
436 +    std::cout << "lookingAtLookupToken: encount " << script.substr(ichToken, cchToken) << std::endl;
437      return true;
438   }
439  
# Line 562 | Line 570 | bool SelectionCompiler::clausePrimitive() {
570          case Token::asterisk:
571          case Token::identifier:
572              return clauseChemObjName();
573 <      
573 >
574 >        case Token::integer :
575 >            return clauseIndex();
576          default:
577              if ((tok & Token::atomproperty) == Token::atomproperty) {
578                  return clauseComparator();
# Line 608 | Line 618 | bool SelectionCompiler::clauseComparator() {
618          return false;
619      }
620  
621 +    boost::any floatVal;
622 +    floatVal = val;
623      return addTokenToPostfix(Token(tokenComparator.tok,
624 <                       tokenAtomProperty.tok, boost::any(val)));
624 >                       tokenAtomProperty.tok, floatVal));
625   }
626  
627   bool SelectionCompiler::clauseWithin() {
# Line 622 | Line 634 | bool SelectionCompiler::clauseWithin() {
634      Token tokenDistance = tokenNext();       // distance
635      switch(tokenDistance.tok) {
636          case Token::integer:
625            distance = float(tokenDistance.intValue);
626            break;
637          case Token::decimal:
638              distance = tokenDistance.value;
639              break;
# Line 709 | Line 719 | bool SelectionCompiler:: clauseName(std::string& name)
719  
720   }
721  
722 + bool SelectionCompiler::clauseIndex(){
723 +    Token token = tokenNext();
724 +    if (token.tok == Token::integer) {
725 +        int index = boost::any_cast<int>(token.value);
726 +        int tok = tokPeek();
727 +        std::cout << "Token::to is " << Token::to << ", tok = " << tok << std::endl;
728 +        if (tok == Token::to) {
729 +            tokenNext();
730 +            tok = tokPeek();
731 +            if (tok != Token::integer) {
732 +                return numberExpected();
733 +            }
734 +            
735 +            boost::any intVal = tokenNext().value;
736 +            int first = index;
737 +            if (intVal.type() != typeid(int)){
738 +                return false;
739 +            }
740 +            int second = boost::any_cast<int>(intVal);
741  
742 +            return addTokenToPostfix(Token(Token::index, boost::any(std::make_pair(first, second))));
743 +            
744 +        }else {
745 +            return addTokenToPostfix(Token(Token::index, boost::any(index)));
746 +        }
747 +    } else {
748 +        return numberExpected();
749 +    }
750   }
751 +
752 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines