Giter Site home page Giter Site logo

代码注释编译异常 about qlexpress HOT 4 OPEN

cying314 avatar cying314 commented on August 25, 2024
代码注释编译异常

from qlexpress.

Comments (4)

DQinYuan avatar DQinYuan commented on August 25, 2024

版本是什么?能给出复现代码吗? 我自测没发现这个问题

    @Test
    public void commentTest() throws Exception {
        String express = "/** 2 倍 **/ return 10";
        ExpressRunner runner = new ExpressRunner(false, true);
        DefaultContext<String, Object> context = new DefaultContext<>();
        Object res = runner.execute(express, context, null, true, true);
        System.out.println(res);
    }

from qlexpress.

cying314 avatar cying314 commented on August 25, 2024

版本是什么?能给出复现代码吗?我自测没发现这个问题

    @Test
    public void commentTest() throws Exception {
        String express = "/** 2 倍 **/ return 10";
        ExpressRunner runner = new ExpressRunner(false, true);
        DefaultContext<String, Object> context = new DefaultContext<>();
        Object res = runner.execute(express, context, null, true, true);
        System.out.println(res);
    }

我看到你的代码片段里面,2后面是打了空格的,如果去掉空格呢?
最小复现代码就是/** 2倍 **/其余什么都不打就会报这个错。
涉及版本是3.3.1。
我们当时是将部分业务文档以注释方式打在的生产环境中供客户查看,除了"2倍"被当成数字错误解析外,还发现有很多类似的特殊字符注释会被错误的解析,最终解决方案是用正则匹配去掉/****/内容,再去调表达式解析

from qlexpress.

MoonNigth avatar MoonNigth commented on August 25, 2024

版本:3.3.2
确实有编译问题,会把“2倍”当作数字取解析,导致报错

    @Test
    public void zsTest() throws Exception {
        ExpressRunner runner = new ExpressRunner(true, false);
        DefaultContext<String, Object> context = new DefaultContext<String, Object>();
        // 定义表达式
        String express = "/** 2倍 **/ 1+1";
        System.out.println("表达式结果:" + runner.execute(express, context, null, true, true));

    }

图片

from qlexpress.

DQinYuan avatar DQinYuan commented on August 25, 2024

@MoonNigth @cying314 确实有问题,我拉个分支修一下. 我之前用例里多了个空格, 导致当成数字解析通过了

from qlexpress.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.