SweepFormula: fix parser handling of signed exponents - #2742
Conversation
|
@copilot This PR should target main |
... I tried to restack this onto |
|
@copilot Can you post the git force push command to remove the superfluous commits? |
Yes — from a local clone, the straightforward sequence is: git checkout copilot/fix-parser-handling-signed-exponents
git fetch origin
git reset --soft origin/main
git commit -m "SweepFormula: fix parser handling of signed exponents"
git push --force-with-lease origin HEAD:copilot/fix-parser-handling-signed-exponentsThat rewrites the branch so it contains a single commit on top of |
a28e744 to
f67dcea
Compare
f67dcea to
5a632b2
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a SweepFormula tokenizer/parser defect where scientific notation with signed exponents (e.g., 1e-3) was incorrectly split at the exponent sign and parsed as subtraction.
Changes:
- Adjusted the parser’s signed-number regex to correctly handle
E[+-]?[0-9]+exponents. - Added special-case handling so
+/-immediately following a pendinge/Eis collected into the numeric token. - Added test coverage for scientific notation (including signed exponents) and updated documentation to mention signed exponents.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Packages/tests/Basic/UTF_SweepFormula.ipf | Adds SweepFormula tests covering scientific notation and signed exponents. |
| Packages/MIES/MIES_SweepFormula_Parser.ipf | Fixes parser tokenization/recognition for signed scientific-notation exponents. |
| Packages/doc/SweepFormula.rst | Documents signed-exponent scientific notation in SweepFormula. |
Fixed in |
|
@copilot Please continue, you got more credits. |
Done in |
|
@MichaelHuth Please have a look what our electric friend did. |
Thanks for opening a PR in MIES ✨!
here for the detailed explanation.
Description
One SweepFormula parser defect:
1e-3gaveOperand for - must be numeric(tokenizer split at the exponent sign).Changes
MIES_SweepFormula_Parser.ipf): corrected the signed-number regex exponent order (E[+-]?[0-9]+) and added a pending-exponent regex so a+/-immediately following a number ending ine/Eis collected into the number rather than parsed as an operator.UTF_SweepFormula.ipfand documented signed exponents inSweepFormula.rst.Examples