http://d.puremagic.com/issues/show_bug.cgi?id=3577


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugd...@yahoo.com.au


--- Comment #1 from Don <clugd...@yahoo.com.au> 2009-12-05 11:31:16 PST ---
PATCH: To give it higher precedence than *, but lower than unary operators, so
that both of the examples return 17, just create a parsePowExp() function in
parse.c.

----
Expression *Parser::parseMulExp()
{   Expression *e;
    Expression *e2;
    Loc loc = this->loc;

    e = parsePowExp();
    while (1)
    {
    switch (token.value)
    {
        case TOKmul: nextToken(); e2 = parsePowExp(); e = new MulExp(loc,e,e2);
continue;
        case TOKdiv: nextToken(); e2 = parsePowExp(); e = new DivExp(loc,e,e2);
continue;
        case TOKmod: nextToken(); e2 = parsePowExp(); e = new ModExp(loc,e,e2);
continue;
        default:
        break;
    }
    break;
    }
    return e;
}

Expression *Parser::parsePowExp()
{   Expression *e;
    Expression *e2;
    Loc loc = this->loc;

    e = parseUnaryExp();
    while (1)
    {
    switch (token.value)
    {
        case TOKpow: nextToken(); e2 = parseUnaryExp(); e = new
PowExp(loc,e,e2); continue;
        default:
        break;
    }
    break;
    }
    return e;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to