mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[poincare/parser] 0→0→c should not be parsable
This commit is contained in:
@@ -306,8 +306,8 @@ void Parser::parseRightwardsArrow(Expression & leftHandSide, Token::Type stoppin
|
||||
if (m_status != Status::Progress) {
|
||||
return;
|
||||
}
|
||||
if (!m_nextToken.is(Token::EndOfStream) || rightHandSide.isUninitialized()) {
|
||||
m_status = Status::Error; // Store and UnitConvert expect a unit on the right.
|
||||
if (!m_nextToken.is(Token::EndOfStream) || rightHandSide.isUninitialized() || rightHandSide.type() == ExpressionNode::Type::Store || rightHandSide.type() == ExpressionNode::Type::UnitConvert) {
|
||||
m_status = Status::Error; // UnitConvert expect a unit on the right.
|
||||
return;
|
||||
}
|
||||
leftHandSide = UnitConvert::Builder(leftHandSide, rightHandSide);
|
||||
|
||||
@@ -419,6 +419,7 @@ QUIZ_CASE(poincare_parsing_parse_store) {
|
||||
Expression m0[] = {Symbol::Builder('x')};
|
||||
assert_parsed_expression_is("[[x]]→f(x)", Store::Builder(BuildMatrix(1,1,m0), Function::Builder("f", 1, Symbol::Builder('x'))));
|
||||
assert_text_not_parsable("a→b→c");
|
||||
assert_text_not_parsable("0→0→c");
|
||||
assert_text_not_parsable("1→");
|
||||
assert_text_not_parsable("→2");
|
||||
assert_text_not_parsable("(1→a)");
|
||||
|
||||
Reference in New Issue
Block a user