diff --git a/poincare/src/parsing/parser.cpp b/poincare/src/parsing/parser.cpp index a32e23d7e..dae3420d5 100644 --- a/poincare/src/parsing/parser.cpp +++ b/poincare/src/parsing/parser.cpp @@ -60,7 +60,7 @@ Expression Parser::parseUntil(Token::Type stoppingType) { typedef void (Parser::*TokenParser)(Expression & leftHandSide, Token::Type stoppingType); static constexpr TokenParser tokenParsers[] = { &Parser::parseUnexpected, // Token::EndOfStream - &Parser::parseStoreOrUnitConvert, // Token::Store + &Parser::parseRightwardsArrow, // Token::RightwardsArrow &Parser::parseEqual, // Token::Equal &Parser::parseUnexpected, // Token::RightSystemParenthesis &Parser::parseUnexpected, // Token::RightBracket @@ -266,7 +266,7 @@ void Parser::parseEqual(Expression & leftHandSide, Token::Type stoppingType) { Expression rightHandSide; if (parseBinaryOperator(leftHandSide, rightHandSide, Token::Equal)) { /* We parse until finding a token of lesser precedence than Equal. The next - * token is thus either EndOfStream or Store. */ + * token is thus either EndOfStream or RightwardsArrow. */ leftHandSide = Equal::Builder(leftHandSide, rightHandSide); } if (!m_nextToken.is(Token::EndOfStream)) { @@ -275,12 +275,12 @@ void Parser::parseEqual(Expression & leftHandSide, Token::Type stoppingType) { } } -void Parser::parseStoreOrUnitConvert(Expression & leftHandSide, Token::Type stoppingType) { +void Parser::parseRightwardsArrow(Expression & leftHandSide, Token::Type stoppingType) { if (leftHandSide.isUninitialized()) { m_status = Status::Error; // Left-hand side missing. return; } - // At this point, m_currentToken is Token::Store. + // At this point, m_currentToken is Token::RightwardsArrow. bool parseId = m_nextToken.is(Token::Identifier) && !IsReservedName(m_nextToken.text(), m_nextToken.length()); if (parseId) { popToken(); @@ -307,7 +307,7 @@ void Parser::parseStoreOrUnitConvert(Expression & leftHandSide, Token::Type stop return; } if (!m_nextToken.is(Token::EndOfStream) || !rightHandSide.isUnitsOnly(m_context)) { - m_status = Status::Error; // Store expects a single symbol or function or a unit. + m_status = Status::Error; // UnitConvert expects "units only" on the right. return; } leftHandSide = UnitConvert::Builder(leftHandSide, rightHandSide); diff --git a/poincare/src/parsing/parser.h b/poincare/src/parsing/parser.h index 7bf6c156f..f0b41cf63 100644 --- a/poincare/src/parsing/parser.h +++ b/poincare/src/parsing/parser.h @@ -64,7 +64,7 @@ private: void parseCaret(Expression & leftHandSide, Token::Type stoppingType = (Token::Type)0); void parseCaretWithParenthesis(Expression & leftHandSide, Token::Type stoppingType = (Token::Type)0); void parseEqual(Expression & leftHandSide, Token::Type stoppingType = (Token::Type)0); - void parseStoreOrUnitConvert(Expression & leftHandSide, Token::Type stoppingType = (Token::Type)0); + void parseRightwardsArrow(Expression & leftHandSide, Token::Type stoppingType = (Token::Type)0); void parseLeftSuperscript(Expression & leftHandSide, Token::Type stoppingType = (Token::Type)0); // Parsing helpers diff --git a/poincare/src/parsing/token.h b/poincare/src/parsing/token.h index d815886a5..932730041 100644 --- a/poincare/src/parsing/token.h +++ b/poincare/src/parsing/token.h @@ -17,13 +17,13 @@ public: enum Type { // Ordered from lower to higher precedence to make Parser's job easier EndOfStream = 0, // Must be the first - Store, + RightwardsArrow, Equal, - /* Equal should have a higher precedence than Store, because + /* Equal should have a higher precedence than RightArrow, because * Tokenizer::parseEqual looks for a right hand side until it finds a - * token of lesser precedence than Equal, and this prevents expressions - * such as "3=4>a". Tokenizer::parseStore uses a special algorithm that - * prevents (3>4=a). */ + * token of lesser precedence than EqualSymbolAbstract, and this prevents + * expressions such as "3=4>a". Tokenizer::parseRightArrow uses a special + * algorithm that prevents (3>4=a). */ RightSystemParenthesis, RightBracket, RightParenthesis, diff --git a/poincare/src/parsing/tokenizer.cpp b/poincare/src/parsing/tokenizer.cpp index c37d62245..e51521fbf 100644 --- a/poincare/src/parsing/tokenizer.cpp +++ b/poincare/src/parsing/tokenizer.cpp @@ -233,7 +233,7 @@ Token Tokenizer::popToken() { return Token(Token::Empty); } if (c == UCodePointRightwardsArrow) { - return Token(Token::Store); + return Token(Token::RightwardsArrow); } if (c == 0) { return Token(Token::EndOfStream);