diff options
-rw-r--r-- | parser.cpp | 12 |
1 files changed, 0 insertions, 12 deletions
@@ -69,12 +69,7 @@ void Parser::parsePrimeExpr() { if(tokenizer.getCurrentToken().type == sum || tokenizer.getCurrentToken().type == substraction) { current = tokenizer.getCurrentToken().type; - - try { tokenizer.nextToken(); - } catch(const LexerException &e) { - panic(); - } if(checkToken()) panic(); @@ -96,7 +91,6 @@ void Parser::parsePrimeTerm() { if(tokenizer.getCurrentToken().type == multiplication || tokenizer.getCurrentToken().type == division) { current = tokenizer.getCurrentToken().type; - tokenizer.nextToken(); if(checkToken()) @@ -115,7 +109,6 @@ void Parser::parsePower() { void Parser::parsePrimePower() { if(tokenizer.getCurrentToken().type == power) { - tokenizer.nextToken(); if(tokenizer.getCurrentToken().type != number) @@ -134,7 +127,6 @@ void Parser::parseFactor() { switch(tokenizer.getCurrentToken().type) { case substraction: - tokenizer.nextToken(); parseExpr(); @@ -172,14 +164,12 @@ void Parser::parseFactor() { panic(); tokenizer.nextToken(); - parseExpr(); if(tokenizer.getCurrentToken().type != right_parens) panic(); tokenizer.nextToken(); - tree_stack.push_back(new Function(popStack(), name)); break; @@ -192,13 +182,11 @@ void Parser::parseFactor() { panic(); // Se introdujeron dos variables en la expresión. tree_stack.push_back(new Variable(tokenizer.getCurrentToken().value[0])); - tokenizer.nextToken(); break; case number: tree_stack.push_back(new Literal(stoi(tokenizer.getCurrentToken().value))); - tokenizer.nextToken(); break; |