Exemple #1
0
//-----------------------------------------------------------------------------
// Function: IPXactValueParser::getFormatForExpression()
//-----------------------------------------------------------------------------
QString IPXactValueParser::getFormatForExpression(QString const& expression) const
{
    QRegExp boolExp(StringPromptAtt::VALID_BOOL_VALUE);
    if (boolExp.exactMatch(expression))
    {
        return "bool";
    }

    QRegExp bitStringExp(StringPromptAtt::VALID_BITSTRING_VALUE);
    if (bitStringExp.exactMatch(expression))
    {
        return "bitString";
    }

    QRegExp longExp(StringPromptAtt::VALID_LONG_VALUE);
    if (longExp.exactMatch(expression))
    {
        return "long";
    }
 
    QRegExp floatExp(StringPromptAtt::VALID_FLOAT_VALUE);
    if (floatExp.exactMatch(expression))
    {
        return "float";
    }

    return "string";
}
SNode SNode::multiplyBoolExpr() const {
  ENTERMETHOD();
  CHECKNODETYPE(*this,NT_BOOLEXPR);
  const SNodeArray &a = getChildArray();
  SNodeArray        newChildArray(a.getTree(),a.size());
  for(size_t i = 0; i < a.size(); i++) {
    newChildArray.add(a[i].multiplyParentheses());
  }
  SNode result = boolExp(getSymbol(), newChildArray);
  RETURNNODE( result );
}
//Produção Expression''
ExpressionNode* expressionDuasLinhas(ExpressionNode* cmpExprE){
       printf("Expression''\n"); 
       if (lookaheadPertenceFirst(Bool_Exp) == 1){                              
             return boolExp(cmpExprE);
       }else if (lookaheadPertenceFirst(Comp_Op) == 1){ //Comp_Op
             int compOpVar = compOp();
             ExpressionNode* compExprD = expression();
             if(compExprD == NULL) return NULL; else
             return new RelOpNode(compOpVar,cmpExprE,compExprD);
       }     
       return cmpExprE;
}