- Blank terms are not valid syntax any more.
- Trailing comma are not valid syntax any more. I think it is not math, it is more related to programming langs.
- You can use ellipsis as valid
Factor
, e.g.,1 + 2 + ... + 10
- This expression will throw syntax error,
1 + 2 + (...) + 10
options.operatorSequence
||options.extra.ellipsis.infixOperators
"..."
, at the beginning of options array that has default value of typeChecker
. This ellipsis will put the default ones.
- Blank terms are represented as
{ type: "blank" }
. - Ellipsis are represented as
{ type: "ellpisis" }
.
class Node
hasChildR
hasChild
- Update section
Unsure About
in README.md, change the way this ambiguous expression parsed. extra.ellipsis
now accept a boolean value, true, false.- These expression are valid if allowed in
options.extra.{ellipsis, blankTerms}
:(..., a)
(, a)
(a, )
is tuple depending on extra options.
- Intervals, should have 2 terms as math expression:
(..., a]
: throw syntax error, parsed ifextra.ellipsis
istrue
(..., a)
: is a tuple, parsed ifextra.ellipsis
istrue
[2, 1, ]
: is a matrix, parsed ifextra.trailingComma
istrue
(1, 2,)
: is a tuple, parsed ifextra.trailingComma
istrue
[, a]
: is a matrix, parsed ifextra.blankTerms
istrue
(, a)
: is a tuple, parsed ifextra.blankTerms
istrue
- Remove option
strict
.
options.keepParen
: if you want to parse parenthesis as nodes in the AST,{ type: "parenthesis" }
.options.extra.matrices
options.builtInIDs
infinity, pi, phi
: these have specific values or notions in maths.phix
is considered as automult of single-char ids, ifoptions.singleCharName=true
, otherwise it is node of type "id" with name "phix".- when strict the previous expression will be automult of single-char ids, equivalent to
p*h*i*x
.
- Node of type "function", when its args is
[{ type: "block", name: "()", ... }]
, function's args is assigned to parenthesis args. In other words, in this case it will beArray
not{ type: "block", ... }
. - Removing node type
delimeter
:f(1,3,4)
when parsed as function, it will have args with length 3.(1,3,4)
will be parsed withtype = "tuple"
.
- Removing node of type
block
, we now haveset, tuple, parentheses, interval
. options.memberExpressionAllowed
is nowoptions.extra.ellipsis
.
- Built-in function
sqrt
options.extra
:memberExpressions
intervals
: true or false, will return node with properties{ startInlusive: boolean, endInclusive: boolean }
.[1,2]
(-.5, infinity)
(-pi, 1]
[2,5)
sets
true or false, will return its items in the propertyargs
, affected with the optionextra.ellipsis
.tuples
true or false, e.g.,(1, 2, x, ...)
.ellipsis
:0
or other falsy values: is not allowed1
or other truthy values:(1, 2, x, ...)
is allowed.2
:(1, 2, ..., x, ...)
is allowed.- The same for function's arguments.
trailingComma
: to allow some expressions likef(1,2,)
blankTerms
: to allow some expressions likef(1,,2)
- Validate built-in functions arguments.
- Pre-validation for input
math
.- So
1+(2
is not valid in strict modeoptions.strict = true
. 1+2)
is not valid at all.1+[2)
, is valid, it is interval.1+ {2)
is not valid.
- So
- check for validity of block (including brackets) syntax, e.g., make sure that they are put in the right order and nested correctly, the block has opening and closing characters.
Summary of changes:
- Add version property to the exported package, which is now "2.2.0"
- Add strict to options, see README.md
- Parse "member expression" such as "p.first_component" and "f(x).someThing.another()" wether or not
options.singleCharName == true
. - When
options.strict == false
, "f()" is function regardless ofoptions.functions
. - When
options.strict == false
, "f + a - sin" is parse with no "Function used as variable" error. - Allow functions to be invoke by void parentheses such as "f()";
- A more intelligent way to handle
- Fix operators ^ and ! from the previous release to parse some expression like: "5^2x!" as "(5^2)(x!)".
Summary of Changes:
- Fix operators ^ and ! to parse some expression like: "5^2x!".
Summary of Changes:
- update the README file
Summary of Changes:
- Fix factorial postfix operator "!"
- Enable single char to be a char followed by int num such as "p1, x0, x1, y123"
- Add "member expressions" Node and parse something like " 1+ p1.x" Summary of Changes (dev):
- Add tests for member expression
- Commenting out some tests for future releases, insha'Allah!
- When a test fails: the logged objects (node and struct) are simplified first to focus on some properties
Summary of Changes:
- All the changes after v1.0.0 - the last complete version - are ready
- Update the readme file
Because that changes after the last complete version are major, making the next version major is the best thing.
Summary of Changes:
- Fix ReferenceError: identifier "name" is not defined. Summary of Changes (dev):
- Remove .toThrow tests from src/__tests__/parser.test.js
Summary of Changes:
- Node has check and checkType methods:
check
: to check for all property except argscheckType
: to check the type of Node instance, it can be done using check
- Node has types:
- number
- id
- function
- block: (), [], {}, ||
- automult
- operator:
- infix: *, /, -, +, ^, &&, ||, ==
- postfix: !
- delimiter
- Do some tests in the parsing process
- Add some todo comments for next releases