Example #1
0
/**
 * This function prints help info about a function if it sees a function call.
 * The function is called from the bison code, which is responsible for
 * deleting the syntax tree (the function call).
 */
int RevLanguage::Parser::help(const SyntaxFunctionCall* root) const {
    
    std::ostringstream msg;
    
#	if defined DEBUG_PARSER
    // Print syntax tree
    std::cerr << std::endl;
    std::cerr << "Syntax tree root before help:\n";
    root->printValue(std::cerr);
    std::cerr << std::endl;
#	endif
    
    RlString symbol = root->getFunctionName();
    
    return help( symbol.getValue() );
}
Example #2
0
double OptionRule::isArgumentValid( Argument &arg, bool once) const
{
    
    RevPtr<RevVariable> theVar = arg.getVariable();
    if ( theVar == NULL )
    {
        return -1;
    }
    
    if ( evalType == BY_VALUE || theVar->isWorkspaceVariable() || ( theVar->getRevObject().isModelObject() && theVar->getRevObject().getDagNode()->getDagNodeType() == RevBayesCore::DagNode::CONSTANT) )
    {
        once = true;
    }
    
    RlString *revObj = dynamic_cast<RlString *>( &theVar->getRevObject() );
    if ( revObj != NULL )
    {
        
        const std::string &argValue = revObj->getValue();
        for ( std::vector<std::string>::const_iterator it = options.begin(); it != options.end(); ++it)
        {
            
            if ( argValue == *it )
            {
                return 0.0;
            }
        }
        return -1;
    }
    else
    {
        return -1;
    }

    
}