diff --git a/apps/calculation/calculation.cpp b/apps/calculation/calculation.cpp index 450efe7d7..74725fc87 100644 --- a/apps/calculation/calculation.cpp +++ b/apps/calculation/calculation.cpp @@ -36,7 +36,7 @@ void Calculation::setContent(const char * c, Context * context, Expression ansEx reset(); { Symbol ansSymbol = Symbol::Ans(); - Expression input = Expression::parse(c).replaceSymbolWithExpression(ansSymbol, ansExpression); + Expression input = Expression::Parse(c).replaceSymbolWithExpression(ansSymbol, ansExpression); /* We do not store directly the text enter by the user because we do not want * to keep Ans symbol in the calculation store. */ PoincareHelpers::Serialize(input, m_inputText, sizeof(m_inputText)); @@ -82,7 +82,7 @@ const char * Calculation::approximateOutputText() { } Expression Calculation::input() { - return Expression::parse(m_inputText); + return Expression::Parse(m_inputText); } Layout Calculation::createInputLayout() { @@ -114,7 +114,7 @@ Expression Calculation::exactOutput() { * thereby avoid turning cos(Pi/4) into sqrt(2)/2 and displaying * 'sqrt(2)/2 = 0.999906' (which is totally wrong) instead of * 'cos(pi/4) = 0.999906' (which is true in degree). */ - Expression exactOutput = Expression::parse(m_exactOutputText); + Expression exactOutput = Expression::Parse(m_exactOutputText); if (exactOutput.isUninitialized()) { return Undefined(); } @@ -128,7 +128,7 @@ Layout Calculation::createExactOutputLayout() { Expression Calculation::approximateOutput(Context * context) { /* To ensure that the expression 'm_output' is a matrix or a complex, we * call 'evaluate'. */ - Expression exp = Expression::parse(m_approximateOutputText); + Expression exp = Expression::Parse(m_approximateOutputText); return PoincareHelpers::Approximate(exp, *context); } diff --git a/apps/sequence/sequence.cpp b/apps/sequence/sequence.cpp index 359ccb34a..d7bedbfef 100644 --- a/apps/sequence/sequence.cpp +++ b/apps/sequence/sequence.cpp @@ -110,7 +110,7 @@ Poincare::Expression Sequence::secondInitialConditionExpression(Context * contex Poincare::Layout Sequence::firstInitialConditionLayout() { if (m_firstInitialConditionLayout.isUninitialized()) { - Expression nonSimplifedExpression = Expression::parse(m_firstInitialConditionText); + Expression nonSimplifedExpression = Expression::Parse(m_firstInitialConditionText); if (!nonSimplifedExpression.isUninitialized()) { m_firstInitialConditionLayout = PoincareHelpers::CreateLayout(nonSimplifedExpression); } @@ -120,7 +120,7 @@ Poincare::Layout Sequence::firstInitialConditionLayout() { Poincare::Layout Sequence::secondInitialConditionLayout() { if (m_secondInitialConditionLayout.isUninitialized()) { - Expression nonSimplifedExpression = Expression::parse(m_secondInitialConditionText); + Expression nonSimplifedExpression = Expression::Parse(m_secondInitialConditionText); if (!nonSimplifedExpression.isUninitialized()) { m_secondInitialConditionLayout = PoincareHelpers::CreateLayout(nonSimplifedExpression); } diff --git a/apps/shared/expression_model.cpp b/apps/shared/expression_model.cpp index d572d59cb..f05577cf3 100644 --- a/apps/shared/expression_model.cpp +++ b/apps/shared/expression_model.cpp @@ -21,14 +21,14 @@ const char * ExpressionModel::text() const { Poincare::Expression ExpressionModel::expression(Poincare::Context * context) const { if (m_expression.isUninitialized()) { - m_expression = Expression::parse(m_text); + m_expression = Expression::Parse(m_text); } return m_expression; } Layout ExpressionModel::layout() { if (m_layout.isUninitialized()) { - Expression nonSimplifiedExpression = Expression::parse(m_text); + Expression nonSimplifiedExpression = Expression::Parse(m_text); m_layout = PoincareHelpers::CreateLayout(nonSimplifiedExpression); } return m_layout; diff --git a/apps/shared/storage_expression_model.cpp b/apps/shared/storage_expression_model.cpp index 41875194e..39849c688 100644 --- a/apps/shared/storage_expression_model.cpp +++ b/apps/shared/storage_expression_model.cpp @@ -80,7 +80,7 @@ Ion::Storage::Record::ErrorStatus StorageExpressionModel::setContent(const char // if c = "", we want to reinit the Expression if (c && *c != 0) { // Compute the expression to store, without replacing symbols - expressionToStore = Expression::parse(c); + expressionToStore = Expression::Parse(c); if (!expressionToStore.isUninitialized()) { Symbol xUnknown = Symbol(Symbol::SpecialSymbols::UnknownX); expressionToStore = expressionToStore.replaceSymbolWithExpression(Symbol("x", 1), xUnknown); diff --git a/apps/shared/store_controller.cpp b/apps/shared/store_controller.cpp index 8add25370..57e01033b 100644 --- a/apps/shared/store_controller.cpp +++ b/apps/shared/store_controller.cpp @@ -84,7 +84,7 @@ bool StoreController::textFieldShouldFinishEditing(TextField * textField, Ion::E bool StoreController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) { if (textField == m_contentView.formulaInputView()->textField()) { // Handle formula input - Expression expression = Expression::parse(textField->text()); + Expression expression = Expression::Parse(textField->text()); if (expression.isUninitialized()) { app()->displayWarning(I18n::Message::SyntaxError); return false; diff --git a/apps/shared/text_field_delegate_app.cpp b/apps/shared/text_field_delegate_app.cpp index 24a1ca3bc..b9062c352 100644 --- a/apps/shared/text_field_delegate_app.cpp +++ b/apps/shared/text_field_delegate_app.cpp @@ -36,7 +36,7 @@ bool TextFieldDelegateApp::textFieldDidReceiveEvent(TextField * textField, Ion:: bool TextFieldDelegateApp::isAcceptableText(const char * text) { - Expression exp = Expression::parse(text); + Expression exp = Expression::Parse(text); return isAcceptableExpression(exp); } @@ -92,7 +92,7 @@ bool TextFieldDelegateApp::ExpressionCanBeSerialized(const Expression expression return false; } if (replaceAns) { - exp = Expression::parse(buffer); + exp = Expression::Parse(buffer); if (exp.isUninitialized()) { // The ans replacement made the expression unparsable return false; diff --git a/apps/solver/equation_models_parameter_controller.cpp b/apps/solver/equation_models_parameter_controller.cpp index d53d42746..0a73cfb1d 100644 --- a/apps/solver/equation_models_parameter_controller.cpp +++ b/apps/solver/equation_models_parameter_controller.cpp @@ -22,7 +22,7 @@ EquationModelsParameterController::EquationModelsParameterController(Responder * m_selectableTableView.setMargins(0); m_selectableTableView.setShowsIndicators(false); for (int i = 0; i < k_numberOfExpressionCells; i++) { - Poincare::Expression e = Expression::parse(k_models[i+1]); + Poincare::Expression e = Expression::Parse(k_models[i+1]); m_layouts[i] = e.createLayout(Poincare::Preferences::PrintFloatMode::Decimal, Constant::ShortNumberOfSignificantDigits); m_modelCells[i].setLayout(m_layouts[i]); } diff --git a/escher/src/layout_field.cpp b/escher/src/layout_field.cpp index 96bdf78c7..008dd08f6 100644 --- a/escher/src/layout_field.cpp +++ b/escher/src/layout_field.cpp @@ -117,7 +117,7 @@ bool LayoutField::handleEventWithText(const char * text, bool indentation, bool } else if ((strcmp(text, "[") == 0) || (strcmp(text, "]") == 0)) { m_contentView.cursor()->addEmptyMatrixLayout(); } else { - Expression resultExpression = Expression::parse(text); + Expression resultExpression = Expression::Parse(text); if (resultExpression.isUninitialized()) { KDSize previousLayoutSize = minimalSizeForOptimalDisplay(); m_contentView.cursor()->insertText(text); diff --git a/poincare/include/poincare/expression.h b/poincare/include/poincare/expression.h index a629ef35b..57cdc0081 100644 --- a/poincare/include/poincare/expression.h +++ b/poincare/include/poincare/expression.h @@ -95,7 +95,7 @@ public: /* Constructor & Destructor */ Expression() : TreeHandle() {} Expression clone() const; - static Expression parse(char const * string); + static Expression Parse(char const * string); static Expression ExpressionFromAddress(const void * address, size_t size); /* Circuit breaker */ diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index c5dd2a54a..bc778b8c9 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -17,7 +17,7 @@ namespace Poincare { Expression Expression::clone() const { TreeHandle c = TreeHandle::clone(); return static_cast(c); } -Expression Expression::parse(char const * string) { +Expression Expression::Parse(char const * string) { if (string[0] == 0) { return Expression(); } @@ -307,7 +307,7 @@ int Expression::serialize(char * buffer, int bufferSize, Preferences::PrintFloat /* Simplification */ Expression Expression::ParseAndSimplify(const char * text, Context & context, Preferences::AngleUnit angleUnit, bool replaceSymbols) { - Expression exp = parse(text); + Expression exp = Parse(text); if (exp.isUninitialized()) { return Undefined(); } @@ -315,7 +315,7 @@ Expression Expression::ParseAndSimplify(const char * text, Context & context, Pr /* simplify might have been interrupted, in which case the resulting * expression is uninitialized, so we need to check that. */ if (exp.isUninitialized()) { - return parse(text); + return Parse(text); } return exp; } diff --git a/poincare/src/layout.cpp b/poincare/src/layout.cpp index 0019cb576..9af1faaff 100644 --- a/poincare/src/layout.cpp +++ b/poincare/src/layout.cpp @@ -28,7 +28,7 @@ int Layout::serializeParsedExpression(char * buffer, int bufferSize) const { return 0; } serializeForParsing(buffer, bufferSize); - Poincare::Expression e = Poincare::Expression::parse(buffer); + Poincare::Expression e = Poincare::Expression::Parse(buffer); if (e.isUninitialized()) { buffer[0] = 0; return 0; diff --git a/poincare/src/trigonometry.cpp b/poincare/src/trigonometry.cpp index 00ae1c984..ee6ea4430 100644 --- a/poincare/src/trigonometry.cpp +++ b/poincare/src/trigonometry.cpp @@ -302,14 +302,14 @@ Expression Trigonometry::table(const Expression e, ExpressionNode::Type type, Co return Expression(); } for (int i = 0; i < k_numberOfEntries; i++) { - Expression input = Expression::parse(cheatTable[i][inputIndex]); + Expression input = Expression::Parse(cheatTable[i][inputIndex]); if (input.isUninitialized()) { continue; } input = input.deepReduce(context, angleUnit); bool rightInput = input.isIdenticalTo(e); if (rightInput) { - Expression output = Expression::parse(cheatTable[i][outputIndex]); + Expression output = Expression::Parse(cheatTable[i][outputIndex]); if (output.isUninitialized()) { return Expression(); } diff --git a/poincare/test/addition.cpp b/poincare/test/addition.cpp index 3ff0b7db6..1e88c65ca 100644 --- a/poincare/test/addition.cpp +++ b/poincare/test/addition.cpp @@ -16,7 +16,7 @@ static inline void assert_approximation_equals(const Expression i, float f) { } static inline void assert_parsed_expression_is_equal_to(const char * exp, Expression e) { - Expression result = Expression::parse(exp); + Expression result = Expression::Parse(exp); quiz_assert(!result.isUninitialized()); quiz_assert(result.isIdenticalTo(e)); } diff --git a/poincare/test/helper.cpp b/poincare/test/helper.cpp index 45d237681..1bb36c941 100644 --- a/poincare/test/helper.cpp +++ b/poincare/test/helper.cpp @@ -64,7 +64,7 @@ Expression parse_expression(const char * expression, bool canBeUnparsable) { char buffer[500]; strlcpy(buffer, expression, sizeof(buffer)); translate_in_special_chars(buffer); - Expression result = Expression::parse(buffer); + Expression result = Expression::Parse(buffer); if (!canBeUnparsable) { quiz_assert(!result.isUninitialized()); } diff --git a/poincare/test/parser.cpp b/poincare/test/parser.cpp index 133cf3211..2c7af7110 100644 --- a/poincare/test/parser.cpp +++ b/poincare/test/parser.cpp @@ -106,7 +106,7 @@ QUIZ_CASE(poincare_parser_memory_exhaustion) { if (ExceptionRun(ecp)) { Addition a = Addition(); while (true) { - Expression e = Expression::parse("1+2+3+4+5+6+7+8+9+10"); + Expression e = Expression::Parse("1+2+3+4+5+6+7+8+9+10"); a.addChildAtIndexInPlace(e, 0, a.numberOfChildren()); } } else { @@ -117,7 +117,7 @@ QUIZ_CASE(poincare_parser_memory_exhaustion) { quiz_assert(memoryFailureHasBeenHandled); assert_pool_size(initialPoolSize); - Expression e = Expression::parse("1+1"); + Expression e = Expression::Parse("1+1"); /* Stupid check to make sure the global variable generated by Bison is not * ruining everything */ }