1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
void Parser::initializeRules(){
rules.clear();
rules.push_back( Rule( EXPR, EMPTY, VALUE )); // 0
rules.push_back( Rule( EXPR, EMPTY, LPAREN, EXPR, RPAREN )); // 1
rules.push_back( Rule( EXPR, EMPTY, PLUS, EXPR )); // 2
rules.push_back( Rule( EXPR, EMPTY, MINUS, EXPR )); // 3
rules.push_back( Rule( EMPTY, POW, EXPR, POW, EXPR )); // 4
rules.push_back( Rule( EXPR, EMPTY, EXPR, POW, EXPR )); // 5
rules.push_back( Rule( EXPR, EMPTY, EXPR, MUL, EXPR )); // 6
rules.push_back( Rule( EXPR, EMPTY, EXPR, DIV, EXPR )); // 7
rules.push_back( Rule( EMPTY, MUL, EXPR, PLUS, EXPR )); // 8
rules.push_back( Rule( EMPTY, DIV, EXPR, PLUS, EXPR )); // 9
rules.push_back( Rule( EXPR, EMPTY, EXPR, PLUS, EXPR )); // 10
rules.push_back( Rule( EMPTY, MUL, EXPR, MINUS, EXPR )); // 11
rules.push_back( Rule( EMPTY, DIV, EXPR, MINUS, EXPR )); // 12
rules.push_back( Rule( EXPR, EMPTY, EXPR, MINUS, EXPR )); // 13
}
| |