Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allowing nested brackets is deceptively complicated compared to allowing single brackets (and only applies to the Chemistry side of the checker).
.bracketed
is now a number value representing the number of brackets anElement
/Compound
/Ion
is contained within, such that 0 or undefined represents anything unbracketed. (This is set in the pre-processingaugmentNode
stage, where any child copies the bracketed of its parent, except aBracket
which increments it by one).bracketAtomCount
is now an array of atom-countingRecord
s of length equal to.bracketed
for the node (operating like a stack).Element
s are added to the top-levelbracketAtomCount
when encountered, and the top level count is added to the second level, multiplied by the subscript.coeff
(then popped off) when a Bracket is closed.termAtomCount
functions similarly tobracketAtomCount
but as the designated always-present bottom level of the stack. Unbracketed Elements are added directly to it, and it is multiplied by theTerm
's leading coefficient and added toatomCount
directly when aTerm
is closed.atomCount
has not changed. It is only ever incremented when aTerm
is closed, and has aFraction
value due to our use ofFraction
coefficients.The same process applies to
bracketChargeCount
,termChargeCount
,chargeCount
- except that charge is only ever added at anIon
node rather than at anElement
node.The Nuclear Checker has a much more basic structure with just
termNucleonCount
andnucleonCount
in the structure[atomCount, massCount]
.Also adds
isChargeBalanced
andsameCharge
to theresponse
, in order to allow the API to give feedback on them.While making this change, more comments were added across the Checker to (hopefully) make it a lot clearer, as well as some restructuring work - mostly such that
Statement
s have a separateCheckerResponse
on their left and right side to stop cross-interference. They are merged for the finalresponse
that is logged/sent to API.