Commit Graph

2847 Commits

Author SHA1 Message Date
Léa Saviot
8101847d65 [poincare] Token: initialize text to "" 2018-11-23 12:04:09 +01:00
Léa Saviot
4d54834815 [poincare] Parser: avoid reading out of bound
popToken is called from parseUntil and from parseStore. It should be
responsible for not reading out of bound buffer
2018-11-23 12:04:09 +01:00
Émilie Feral
cffb144c41 [poincare] Power: fix one-child addition while reducing power 2018-11-23 12:04:09 +01:00
Émilie Feral
61b629db92 [poincare] Parser: avoid reading out of buffer 2018-11-23 12:04:09 +01:00
Léa Saviot
584f6d6f6b [poincare] Add parsing test on 1E2E3 2018-11-23 12:04:09 +01:00
Léa Saviot
70707a9985 [poincare] Infinity::Name() gives "inf" 2018-11-23 12:04:08 +01:00
Léa Saviot
5e404736b3 [poincare] LayoutHelper::String second parameter is a length, not size 2018-11-23 12:04:08 +01:00
Léa Saviot
63e83c246b [poincare] Undefined::Name() gives "undef" 2018-11-23 12:04:08 +01:00
Émilie Feral
55bfffcb9b [poincare] Expression: fix isApproximate and IsMatrix to expand
Function encountered
2018-11-23 12:04:08 +01:00
Émilie Feral
19b3a8a479 [poincare] Factorize 'expand' and 'matches' methods between Symbol and
Function
2018-11-23 12:04:08 +01:00
Émilie Feral
721cd59227 [poincare] Add tests on User Variable
- test isApproximate on Symbols and Functions
- test IsMatrix on Symbols and Functions
2018-11-23 12:04:08 +01:00
Émilie Feral
c01d66c77b [poincare] Change name: replaceReplaceableSymbols -->
shallowReplaceReplaceableSymbols
2018-11-23 12:04:08 +01:00
Émilie Feral
e80512f362 [poincare] Context::expressionForSymbol takes a boolean notifying that
we want a copy or not
2018-11-23 12:04:08 +01:00
Émilie Feral
05083e76af [poincare] Clean Symbol 2018-11-23 12:04:08 +01:00
Émilie Feral
ac6f7346e0 [poincare] Fix Function: expand and replace child before getting
properties
2018-11-23 12:04:08 +01:00
Émilie Feral
fb57ac73d7 [poincare] add tests on Function properties 2018-11-23 12:04:08 +01:00
Émilie Feral
6530d87805 [poincare] Test: divide store tests in store and user variable tests 2018-11-23 12:04:08 +01:00
Émilie Feral
dd4a83fc59 [poincare] Store: add tests on composed functions 2018-11-23 12:04:08 +01:00
Émilie Feral
55048ab907 [poincare] VariableContext::expressionForSymbol returns a clone of its
kept value to unable any modification of its value (without calling
setExpressionForSymbol).

All contexts::expressionForSymbol return new Expression that can be tempered with.
2018-11-23 12:04:08 +01:00
Émilie Feral
a6ad7484a0 [poincare] FunctionNode: pay attention to parent context with UnknownX value to
avoid overriding it.

For example, when evaluating the expression 'f(x)' in a context where x =
2 and f: x-->x^2.
2018-11-23 12:04:08 +01:00
Émilie Feral
bd09638b68 [poincare] Add tests to Store: f(x+1)+f(x-1) 2018-11-23 12:04:08 +01:00
Émilie Feral
e516c9d544 [poincare] Helper: add a function to check approximateWithValueForSymbol 2018-11-23 12:04:08 +01:00
Émilie Feral
e042279471 [poincare] Function: fix replaceReplaceableSymbols 2018-11-23 12:04:08 +01:00
Émilie Feral
acdb4ca357 [poincare] Expression::ExpressionWithoutSymbol does not take into
account SystemSymbol (UnknownX)
2018-11-23 12:04:08 +01:00
Émilie Feral
140ccbfa77 [poincare] Add tests on composed functions 2018-11-23 12:04:08 +01:00
Émilie Feral
5b6aa67dca [poincare] Fix ExpressionWithoutSymbols 2018-11-23 12:04:07 +01:00
Émilie Feral
b78f25f9bd [poincare] Store: add tests with 1 circular function and 2 defined
functions
2018-11-23 12:04:07 +01:00
Émilie Feral
b4098fb5e2 [poincare] Store: fix tests
In storage, we record the expression without any simplification.
2018-11-23 12:04:07 +01:00
Léa Saviot
658485c197 [poincare] ans symbol can be shallowReduced, it will give undef 2018-11-23 12:04:07 +01:00
Léa Saviot
ff20cb840d [apps/poincare] Expressions are not reduced before storing in Storage 2018-11-23 12:04:07 +01:00
Léa Saviot
1c859fd1df [poincare] Do not beautify after reduce interrupted simplification 2018-11-23 12:04:07 +01:00
Léa Saviot
36e19f3122 [poincare/test] Add store test 2018-11-23 12:04:07 +01:00
Léa Saviot
8a272458de [poincare] recursivelyMatches takes replaceSymbols parameter
This fixes:
[7]->a
1+2->a
The second operation would get interrupted because 'a' is a matrix if
symbols are replaced
2018-11-23 12:04:07 +01:00
Léa Saviot
07d1aabb56 [apps/solver] Remove max variable name size redefinition 2018-11-23 12:04:07 +01:00
Léa Saviot
5421874358 [poincare] Fix parentheses on first child of a multiplication
They are not needed if the child is not an addition or a subtraction
2018-11-23 12:04:07 +01:00
Léa Saviot
7038048d12 [poincare] static replacement count in Expression::ExpressionWithoutSymbols 2018-11-23 12:04:07 +01:00
Léa Saviot
61c1f6a7d4 [poincare] Stop simplif. if reducing children triggered an interruption 2018-11-23 12:04:07 +01:00
Léa Saviot
2d20aacc89 [poincare/parser] Parser::IsReservedName 2018-11-23 12:04:07 +01:00
Léa Saviot
42c372b4b4 [poincare/parser] Static method checking if name is special identifier 2018-11-23 12:04:07 +01:00
Léa Saviot
b753619378 [poincare/parser] Rename Parser::currentTokenIsSpecialIdentifier 2018-11-23 12:04:07 +01:00
Léa Saviot
76aae9d478 [poincare/parser] Static method checking if name is reserved function 2018-11-23 12:04:07 +01:00
Léa Saviot
fb484bf941 [poincare] More elegant prevention of parsing "3=4>x" and "4<x=3" 2018-11-23 12:04:07 +01:00
Léa Saviot
d411ff292e [poincare] Do not parse 1>ans 2018-11-23 12:04:07 +01:00
Léa Saviot
44963179c7 [poincare] Store and Equal must be topmost expressions 2018-11-23 12:04:07 +01:00
Léa Saviot
9dc5794d22 [poincare] Fix tests 2018-11-23 12:04:06 +01:00
Léa Saviot
17eaadb280 [poincare] Replace functions when replacing symbols iteratively 2018-11-23 12:04:06 +01:00
Léa Saviot
cb88dbc0a1 [poincare] Replacing iteratively only existing symbols 2018-11-23 12:04:06 +01:00
Léa Saviot
23895f40e2 [poincare] When storing a function, replace unknownX by user's variable 2018-11-23 12:04:06 +01:00
Léa Saviot
71ba760b71 [poincare] Remove duplicate simplification interruption check 2018-11-23 12:04:06 +01:00
Léa Saviot
58c995d63c [poincare] Symbol replacements limit for functions 2018-11-23 12:04:06 +01:00