summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/utils/ExpressionParser.java
AgeCommit message (Collapse)Author
2025-06-07Fix e-notation & consolidate expression parsingAdrien Hopkins
This commit moves all of the expression formatting code to one method, and changes it so that it works with things like '1e+2'. This does mean that I had to require spaces for addition and subtraction, but without that, the rules would be complicated.
2025-06-04Add version numbers to all @since tagsAdrien Hopkins
Specifically, for every @since tag with a date, I added another that contains the correspending version. I did not add date @since tags to comments that do not have them, as that would be too tedious for what it's worth. These dates could still be found by using git bisect though.
2025-06-04Update copyright notices' yearsAdrien Hopkins
I used the Git history for years after 2019, and only included 2019 or 2018 if they were already there. I also added copyright notices to all code files that don't already have them.
2025-05-30Throw error on expressions with too many operatorsAdrien Hopkins
2025-05-30ExpressionParser: use correct operand orderAdrien Hopkins
Most of the internal problems with the expression parser happened because I was accepting the arguments for binary operators in the wrong order. For example, '2 - 1' became '1 2 -', not '2 1 -'. The likely cause of this error is the following sequence of events: - In commit 6dbd32cd, I created the code for interpreting RPN. I accepted two arguments from the stack (o1 and o2), then performed o1 <op> o2. However, because stacks are in LIFO order, I should have actually done o2 <op> o1. - Later, in commit 94349688, I created the code for converting an infix expression to RPN. Creating the expressions in the correct order did not work, because my interpreter used the incorrect order. To 'fix' this problem, I created the expressions in the incorrect order. I did not notice any discrepancy, probably because I was not testing the individual methods, only the two-step whole (which found no errors).
2024-03-24Format source code & set explicit UTF-8Adrien Hopkins
2024-03-23Complete exponentiation of dimensionsAdrien Hopkins
Previously, you could only exponentiate individual dimensions in expressions. For example, `Length^3` was valid, but `(Length / Time)^2` was not. This is now fixed.
2021-09-27The ExpressionParser test is now a paramaterized testAdrien Hopkins
2021-09-27Added some tests for invalid unitfilesAdrien Hopkins
2021-08-07Renamed sevenUnits.math to sevenUnits.utilsAdrien Hopkins