feat(express): 支持一元正负号运算符#355
Open
zgxkbtl wants to merge 1 commit intoalibaba:branch_version_3.x.xfrom
Open
Conversation
在 `OperatorFactory` 和 `OperatorInstructionFactory` 中增加了对一元正负号运算符的支持,并添加了相应的单元测试。同时更新了 `KeyWordDefine4Java` 以识别新的运算符。 - 新增 `OperatorUnaryPlus` 和 `OperatorUnaryMinus` 类 - 更新 `KeyWordDefine4Java` 以支持一元正负号运算符 - 添加 `Issue345NegativeNumberTest` 单元测试
DQinYuan
requested changes
Oct 15, 2024
| Stack<ForRelBreakContinue> forStack, ExpressNode node, boolean isRoot) throws Exception { | ||
| boolean returnVal = false; | ||
| ExpressNode[] children = node.getChildrenArray(); | ||
| // |
| if (list[0] instanceof Number) { | ||
| return list[0]; | ||
| } | ||
| throw new Exception("Cannot apply unary plus to non-number type"); |
| String express = "-b"; | ||
| Object result = runner.execute(express, context, null, true, true); | ||
| //Assert.assertTrue((Boolean)result); | ||
| Assert.assertEquals(new BigDecimal("-12.22"), result); |
Collaborator
Collaborator
DQinYuan
requested changes
Oct 27, 2024
|
|
||
| "CAST_CALL:TYPE=EXPRESS,DEFINE=(LEFT_BRACKET~$CONST_CLASS$RIGHT_BRACKET~#cast)^*$((LAMBDA#LAMBDA)|ARRAY_CALL)", | ||
| "EXPRESS_OP_L1:TYPE=EXPRESS,DEFINE=OP_LEVEL1^*$CAST_CALL", | ||
| "EXPRESS_OP_L1:TYPE=EXPRESS,DEFINE=(OP_LEVEL1^$CAST_CALL)^*", |
Collaborator
There was a problem hiding this comment.
这里为什么要从左边改成右边?如果使用原来的就能能通过大多数测试(和 addOperatorWithLevelOfReference 相关的依旧过不了,因为还有其他代码需要修改)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


在
OperatorFactory和OperatorInstructionFactory中增加了对一元正负号运算符的支持,并添加了相应的单元测试。同时更新了KeyWordDefine4Java以识别新的运算符。OperatorUnaryPlus和OperatorUnaryMinus类KeyWordDefine4Java以支持一元正负号运算符Issue345NegativeNumberTest单元测试