Repository navigation
Description
I love the idea of making a compact DSL that is able to express money flow simpler and more precise than English!
I've notice that here is a small consistency issue in the syntax. That put me off initially, but I've tried it anyway and I love it, so I'm reporting it here, as I think bug reports nowadays are more valuable than PRs.
It isn't clear where remaining can be used, The example below works with remaining to working in both top level destination and nested group:
send [USD/2 10000] (
source = @orders:1234
destination = {
15% to {
20% to @platform:commission:sales_tax
remaining to @platform:commission:revenue
}
10% to {
// user gets 10% cashback up to $5 for participating merchants
max [USD/2 500] to @users:1234:cashback
remaining to @merchants:6789
}
remaining to @merchants:6789
}
)However a symmetric example using complex source and multiple groups breaks with error because of one "remaining from", but the other is fine:
send [USD/2 29900] (
source = {
10% from {
max [USD/2 2000] from @coupons:FALL24
remaining from @users:1234 # Error, should be just @users:1234
}
remaining from @users:1234 # Fine
}
destination = @payments:4567
)Here is the error that the example above produce:
Got errors while parsing:
extraneous input 'remaining' expecting {'max', 'overdraft', 'oneof', '(', '[', '{', '}', '-', PERCENTAGE_PORTION_LITERAL, STRING, IDENTIFIER, NUMBER, ASSET, '@', VARIABLE_NAME}
5 | max [USD/2 2000] from @coupons:FALL24
6 | remaining from @users:1234
| ~~~~~~~~
7 | }
mismatched input 'remaining' expecting 'destination'
7 | }
8 | remaining from @users:1234
| ~~~~~~~~
9 | }
It would be really cool to make this two consistent, it helps agents and people to read through the flow.
Activity