コード例 #1
0
//-----------------------------------------------------------------------------
//	Makes a factor :: { <expression> } | <identifier>.
//-----------------------------------------------------------------------------
static void MakeFactor( ExprTree& tree )
{
	if ( mCurToken == '(' )
	{
		// Get the next token
		GetNextToken();

		// Make an expression, setting Tree to point to it
		MakeExpression( tree );
	}
	else if ( IsIdentifier( mCurToken ) )
	{
		// Make a literal node, set Tree to point to it, set left/right children to NULL. 
		MakeExprNode( tree, mCurToken, LITERAL, NULL, NULL );
	}
	else if ( IsNotOp( mCurToken ) )
	{
		// do nothing
		return;
	}
	else
	{
		// This must be a bad token
		VPC_SyntaxError( "Bad expression token: %c", mCurToken );
	}

	// Get the next token
	GetNextToken();
}
コード例 #2
0
// <bool_expression> ::= [<not_op>] <bool_factor>
void NotFactor(CPU *cpu, Files file){
    bool negate = false;
    if(IsNotOp(file)){
        Match('!', file);
        negate = true;
    }
    Factor(cpu, file);
//    cpu->Negate();
}
コード例 #3
0
//-----------------------------------------------------------------------------
//	Makes a term :: <factor> { <not> }.
//-----------------------------------------------------------------------------
static void MakeTerm( ExprTree& tree )
{
	// Make a factor, setting Tree to point to it
	MakeFactor( tree );

	// while the next token is !
	while( IsNotOp( mCurToken ) )
	{
		// Make an operator node, setting left child to Tree and right to NULL. (Tree points to new node)
		MakeExprNode( tree, mCurToken, NOT, tree, NULL );

		// Get the next token.
		GetNextToken();

		// Make a factor, setting the right child of Tree to point to it.
		MakeFactor(tree->right);
	}
}