Skip to content

Commit

Permalink
Merge pull request #316 from alibaba/fix_commit_with_invalid_number
Browse files Browse the repository at this point in the history
修复注释解析问题
  • Loading branch information
DQinYuan authored Mar 31, 2024
2 parents 4004bef + 53fd3f9 commit 8363eb4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/ql/util/express/parse/ExpressParse.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ public List<ExpressNode> transferWord2ExpressNode(ExpressPackage rootExpressPack
treeNodeType = nodeTypeManager.findNodeType("CONST");
objectValue = Boolean.valueOf(tempWord);
point = point + 1;
} else if ("/**".equals(tempWord)) {
while ((++point) < wordObjects.length && !"**/".equals(wordObjects[point].word));
point++;
continue;
} else {
tempType = nodeTypeManager.isExistNodeTypeDefine(tempWord);
if (tempType != null && tempType.getKind() != NodeTypeKind.KEYWORD) {
Expand Down
23 changes: 23 additions & 0 deletions src/test/java/com/ql/util/express/bugfix/CommentTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.ql.util.express.bugfix;

import com.ql.util.express.DefaultContext;
import com.ql.util.express.ExpressRunner;
import org.junit.Assert;
import org.junit.Test;

/**
* Author: DQinYuan
*/
public class CommentTest {

@Test
public void invalidNumInCommitTest() throws Exception {
ExpressRunner runner = new ExpressRunner(true, false);
DefaultContext<String, Object> context = new DefaultContext<>();
// 定义表达式
String express = "/** 2倍 **/ 1+1";
Object result = runner.execute(express, context, null, true, true);
Assert.assertEquals(2, result);
}

}

0 comments on commit 8363eb4

Please sign in to comment.