Beispiel #1
0
std::string PrintTokens( const TokenSet& setTokens )
{
	std::string strTokens( " " );
	for ( TokenSet::const_iterator i = setTokens.begin() ; i != setTokens.end() ; i++ )
		strTokens += PrintToken( *i, true ) + " ";
	return strTokens;
}
Beispiel #2
0
TokenSet Union( const TokenSet& setTokens1, const TokenSet& setTokens2 )
{
	TokenSet setResult( setTokens1 );
	for ( TokenSet::const_iterator i = setTokens2.begin() ; i != setTokens2.end() ; ++i )
		setResult.insert( *i );
	return setResult;
}
Beispiel #3
0
bool Contains( const TokenSet& setTokens1, const TokenSet& setTokens2 )
{
	if ( setTokens2.empty() )
		return setTokens1.empty();
	for ( TokenSet::const_iterator i = setTokens2.begin() ; i != setTokens2.end() ; ++i )
		if ( ! Contains( setTokens1, *i ) )
			return false;
	return true;
}
Beispiel #4
0
int RouteNode::matchRoute(TokenSet tokens,Json::Value& pathValues){
    return matchRoute(tokens.begin(),tokens.end(),pathValues);
}
Beispiel #5
0
void RouteNode::addRoute(TokenSet tokens,int matchId){
    addRoute(tokens.begin(),tokens.end(),matchId);
}
Beispiel #6
0
bool Contains( const TokenSet& setTokens, int iToken )
{
	if ( setTokens.empty() )
		return false;
	switch ( iToken ) {
		case MULTIPLE :	case DIVIDE :	case DIVIDEINT : case PERCENT : case MODULO :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_MULTIPLICATIVE );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case NOT :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_UNARY );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case MINUS :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_UNARY );
				if ( i != setTokens.end() )
					return true;
				i = setTokens.find( CLASS_ADDITIVE );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case PLUS :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_ADDITIVE );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case LESS : case LESSEQUAL : case LESSGREATER : case EQUAL : case DOUBLEEQUAL : case NONEQUAL : case GREATER : case GREATEREQUAL :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_RELATIONAL );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case XOR :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_LOGICAL );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case AND : case SC_AND :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_LOGICAL_AND );
				if ( i != setTokens.end() )
					return true;
				i = setTokens.find( CLASS_LOGICAL );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case OR : case SC_OR :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_LOGICAL_OR );
				if ( i != setTokens.end() )
					return true;
				i = setTokens.find( CLASS_LOGICAL );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case IMPLIES : case SC_IMPLIES :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_LOGICAL_IMPLIES );
				if ( i != setTokens.end() )
					return true;
				i = setTokens.find( CLASS_LOGICAL );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case TRUEE: case FALSEE :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_BOOLEAN );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case DOT : case ARROWW :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_CALLKIND );
				if ( i != setTokens.end() )
					return true;
				break;
			}
		case PRE : case POST : case DEFATTRIBUTE : case DEFMETHOD :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_PREPOST );
				if ( i != setTokens.end() )
					return true;
			}
		case INV :
			{
				TokenSet::const_iterator i = setTokens.find( CLASS_STEREOTYPES );
				if ( i != setTokens.end() )
					return true;
				break;
			}
	}
	TokenSet::const_iterator i = setTokens.find( iToken );
	return i != setTokens.end();
}