alibaba / alibaba/QLExpress

不支持使用负号“-”

Open
#345 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
5.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

@Test
public void qlBigDecimalTest() throws Exception {

ExpressRunner runner = new ExpressRunner(true, false);
runner.setShortCircuit(true);
DefaultContext context = new DefaultContext();
BigDecimal value = new BigDecimal("12.22");
context.put("b", value);
Object execute = runner.execute("-b", context, null, false, false);
System.out.println(execute);
}

com.ql.util.express.exception.QLCompileException: 程序错误,不满足语法规范,没有匹配到合适的语法,最大匹配致[0:-1]

at com.ql.util.express.match.QLPattern.findMatchStatement(QLPattern.java:30)
at com.ql.util.express.parse.ExpressParse.parse(ExpressParse.java:404)
at com.ql.util.express.parse.ExpressParse.parse(ExpressParse.java:362)
at com.ql.util.express.parse.ExpressParse.parse(ExpressParse.java:335)
at com.ql.util.express.ExpressRunner.parseInstructionSet(ExpressRunner.java:678)
at com.ql.util.express.ExpressRunner.executeInner(ExpressRunner.java:638)
at com.ql.util.express.ExpressRunner.execute(ExpressRunner.java:629)
at com.example.demo.ExpressTest.qlBigDecimalTest(ExpressTest.java:74)

使用过程中想直接转为负数,但是报错。
这个有什么方法能处理吗,还是只能写成 "0-b"

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the failing example at ExpressTest.java:74 and trace the reported path through ExpressRunner.execute, ExpressParse.parse, and QLPattern.findMatchStatement. Reproduce the failure for "-b" with the shown BigDecimal context, then verify that the expression executes successfully and that coverage includes the unary negative case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.