Commit Graph

56 Commits

Author SHA1 Message Date
Patrick Lühne 1a497254a8
Add unit tests for precedence-0 formulas and lower 2020-04-09 16:07:31 +02:00
Patrick Lühne d57b3b3b62
Test remaining formula types 2020-04-09 16:07:31 +02:00
Patrick Lühne 57d568916f
Minor formatting 2020-04-09 16:07:31 +02:00
Patrick Lühne e4fe047aba
Start testing formula formatter 2020-04-09 16:07:31 +02:00
Patrick Lühne 600a6a1b4b
Refactor precedence rules 2020-04-09 16:07:31 +02:00
Patrick Lühne 8bf9d4bd45
Fix implication formatting 2020-04-09 16:07:31 +02:00
Patrick Lühne f82a20e5f1
Work in progress 2020-04-09 16:07:31 +02:00
Patrick Lühne 5c51018ab1
Add unit test for function declaration formatting 2020-04-09 16:07:30 +02:00
Patrick Lühne 23e1854346
Test term formatting 2020-04-09 16:07:30 +02:00
Patrick Lühne a3da369346
Split formatting functionality into two files 2020-04-09 16:07:30 +02:00
Patrick Lühne caf957deed
Fix implication parser and output 2020-04-09 16:07:30 +02:00
Patrick Lühne 1ece0e89ef
Add note 2020-04-09 16:07:30 +02:00
Patrick Lühne 0fdec430af
Parentheses for stronger checks 2020-04-09 16:07:30 +02:00
Patrick Lühne 5ea0a96ec4
Test disjunction parser 2020-04-09 16:07:30 +02:00
Patrick Lühne 17d8dbd8ba
Test conjunction parser 2020-04-09 16:07:30 +02:00
Patrick Lühne 834e59207f
Add note 2020-04-09 16:07:30 +02:00
Patrick Lühne 257e02f285
Minor refactoring 2020-04-09 16:07:30 +02:00
Patrick Lühne 2e3707e0af
Check that names don’t start with special characters 2020-04-09 16:07:30 +02:00
Patrick Lühne d0263dd1c4
Add missing word boundary character 2020-04-09 16:07:30 +02:00
Patrick Lühne a7dd4d2fe9
Disallow reserved keywords as names 2020-04-09 16:07:29 +02:00
Patrick Lühne c127bc5eea
Address clippy warning 2020-04-09 16:07:29 +02:00
Patrick Lühne cb616eba87
Refactor term parser tests 2020-04-09 16:07:29 +02:00
Patrick Lühne 95677bae34
Fix negation parser 2020-04-09 16:07:29 +02:00
Patrick Lühne 3414e8075c
Address warnings 2020-04-09 16:07:29 +02:00
Patrick Lühne 675063e1b8
Move string parser to separate module 2020-04-09 16:07:29 +02:00
Patrick Lühne 7d78a504b1
Move special integer parser to separate module 2020-04-09 16:07:29 +02:00
Patrick Lühne 6f86cd40d7
Move integer parser to separate module 2020-04-09 16:07:29 +02:00
Patrick Lühne 29ea4578e4
Move boolean parser to separate module 2020-04-09 16:07:29 +02:00
Patrick Lühne a1bbae9201
Finish implementing formula parsing 2020-04-09 16:07:29 +02:00
Patrick Lühne 1c00e5be16
Continue parsing formulas 2020-04-09 16:07:29 +02:00
Patrick Lühne 1b89d8900e
Start parsing formulas 2020-04-09 16:07:29 +02:00
Patrick Lühne af1ec8a606
Fix term parsing and finish tests 2020-04-09 16:07:29 +02:00
Patrick Lühne 2907d10148
Make parse feature the default 2020-04-09 16:07:28 +02:00
Patrick Lühne 19e70a90c5
Test associativity of multiplication 2020-04-09 16:07:28 +02:00
Patrick Lühne 385c878597
Add term parsing test 2020-04-09 16:07:28 +02:00
Patrick Lühne 5b98e8a29c
Finish implementing term parsing 2020-04-09 16:07:28 +02:00
Patrick Lühne 3530364ea8
Implement variable parsing 2020-04-09 16:07:28 +02:00
Patrick Lühne deae102405
Require word boundaries around names 2020-04-09 16:07:28 +02:00
Patrick Lühne 0fc8506164
Implement booleans 2020-04-09 16:07:28 +02:00
Patrick Lühne e6a5c20d42
Add pipe character to allowed word boundaries 2020-04-09 16:07:28 +02:00
Patrick Lühne d5cd179a2d
Implement strings 2020-04-09 16:07:28 +02:00
Patrick Lühne 5ec9331b4c
Implement word boundaries 2020-04-09 16:07:28 +02:00
Patrick Lühne 896af02120
Start parsing terms 2020-04-09 16:07:28 +02:00
Patrick Lühne 0c057211ed
Implement name parsing 2020-04-09 16:07:28 +02:00
Patrick Lühne 91918cf645
Start reimplementing parser 2020-04-09 16:07:25 +02:00
Patrick Lühne fd6ba4a005
Test crate with GitHub Actions
This adds a GitHub Actions workflow to test this crate with the Rust
stable, beta, and nightly toolchains.
2020-04-09 15:34:49 +02:00
Patrick Lühne 153f77621e
Fix precedence of absolute value operation
As the absolute value operation has its own type of parentheses, it
never needs to take precedence over other terms in order to be displayed
correctly. To avoid extraneous parentheses around absolute value
operations, set its precedence level to 0.
2020-03-30 06:42:54 +02:00
Patrick Lühne 551c35ed75
Fix formatting of binary operations
The precedence rules of binary operations are a bit trickier than
expected. The fact that a parent and a child term have the same
precedence level doesn’t automatically mean that parentheses can be
omitted. This is the case, for example, with

    a - (b + c)

While addition and subtraction have the same precedence level, the
parenthesis cannot be omitted. In general, this happens on the right-
hand side of the subtraction, division, and modulo operators if the
right-hand side has the same precedence level.

This patch fixes the output of binary operations accordingly.
2020-03-30 06:37:21 +02:00
Patrick Lühne 549f127729
Derive simple enums from basic traits
This adds derive statements from Copy, Clone, PartialEq, and Eq to the
operator enums as well as SpecialInteger.
2020-03-30 06:37:21 +02:00
Patrick Lühne a304ec9a75
Fix output of Booleans in formulas
Booleans are supposed to be formatted without a leading hash sign in
both terms and formulas. By mistake, the formula formatter added leading
hash signs though.
2020-03-30 06:37:21 +02:00