Merge pull request #54 from DanilaFe/precedence-fix

Make sure the set and define operators have the lowest precedence.
This commit is contained in:
Danila Fedorin 2018-01-16 00:16:46 -08:00 committed by GitHub
commit 18e0bdebc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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