mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 07:20:09 -08:00
Merge pull request #54 from DanilaFe/precedence-fix
Make sure the set and define operators have the lowest precedence.
This commit is contained in:
commit
18e0bdebc5
|
@ -11,7 +11,7 @@ import org.nwapw.abacus.number.NumberInterface
|
|||
*
|
||||
* This is a standard operator that simply performs addition.
|
||||
*/
|
||||
class OperatorAdd: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 0) {
|
||||
class OperatorAdd: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 1) {
|
||||
|
||||
override fun matchesParams(context: PluginEvaluationContext, params: Array<out NumberInterface>) =
|
||||
params.size == 2
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.nwapw.abacus.plugin.standard.StandardPlugin.*
|
|||
*
|
||||
* This is a standard operator that brings one number to the power of the other.
|
||||
*/
|
||||
class OperatorCaret: NumberOperator(OperatorAssociativity.RIGHT, OperatorType.BINARY_INFIX, 2) {
|
||||
class OperatorCaret: NumberOperator(OperatorAssociativity.RIGHT, OperatorType.BINARY_INFIX, 3) {
|
||||
|
||||
override fun matchesParams(context: PluginEvaluationContext, params: Array<out NumberInterface>) =
|
||||
params.size == 2
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.nwapw.abacus.number.NumberInterface
|
|||
*
|
||||
* This is a standard operator that simply performs division.
|
||||
*/
|
||||
class OperatorDivide: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 1) {
|
||||
class OperatorDivide: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 2) {
|
||||
|
||||
override fun matchesParams(context: PluginEvaluationContext, params: Array<out NumberInterface>) =
|
||||
params.size == 2
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.nwapw.abacus.number.NumberInterface
|
|||
*
|
||||
* This is a standard operator that simply performs multiplication.
|
||||
*/
|
||||
class OperatorMultiply: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 1) {
|
||||
class OperatorMultiply: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 2) {
|
||||
|
||||
override fun matchesParams(context: PluginEvaluationContext, params: Array<out NumberInterface>) =
|
||||
params.size == 2
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.nwapw.abacus.plugin.standard.StandardPlugin.OP_NPR
|
|||
* This is a standard operator that returns the number of possible combinations, regardless of order,
|
||||
* of a certain size can be taken out of a pool of a bigger size.
|
||||
*/
|
||||
class OperatorNcr: NumberOperator(OperatorAssociativity.RIGHT, OperatorType.BINARY_INFIX, 0) {
|
||||
class OperatorNcr: NumberOperator(OperatorAssociativity.RIGHT, OperatorType.BINARY_INFIX, 1) {
|
||||
|
||||
override fun matchesParams(context: PluginEvaluationContext, params: Array<out NumberInterface>) =
|
||||
params.size == 2 && params[0].isInteger()
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.nwapw.abacus.number.NumberInterface
|
|||
* his is a standard operator that returns the number of possible combinations
|
||||
* of a certain size can be taken out of a pool of a bigger size.
|
||||
*/
|
||||
class OperatorNpr: NumberOperator(OperatorAssociativity.RIGHT, OperatorType.BINARY_INFIX, 0) {
|
||||
class OperatorNpr: NumberOperator(OperatorAssociativity.RIGHT, OperatorType.BINARY_INFIX, 1) {
|
||||
|
||||
override fun matchesParams(context: PluginEvaluationContext, params: Array<out NumberInterface>) =
|
||||
params.size == 2 && params[0].isInteger()
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.nwapw.abacus.number.NumberInterface
|
|||
*
|
||||
* This is a standard operator that performs subtraction.
|
||||
*/
|
||||
class OperatorSubtract: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 0) {
|
||||
class OperatorSubtract: NumberOperator(OperatorAssociativity.LEFT, OperatorType.BINARY_INFIX, 1) {
|
||||
|
||||
override fun matchesParams(context: PluginEvaluationContext, params: Array<out NumberInterface>) =
|
||||
params.size == 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user