Skip to content

Commit

Permalink
fix bug, VerbalExpression is easy and pain!
Browse files Browse the repository at this point in the history
  • Loading branch information
caofanCPU committed May 8, 2021
1 parent 3d87bb6 commit 07c43cb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/main/java/com/xyz/caofancpu/d8ger/WhoAmI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.xyz.caofancpu.d8ger;

/**
* Who You Are?
*/
public class WhoAmI {

/**
* ID
*/
private Long id;

private Integer age;

private String name;

}
7 changes: 6 additions & 1 deletion src/main/java/com/xyz/caofancpu/d8ger/util/ConstantUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,15 @@ public class ConstantUtil {
*/
public static final String SPACE = StringUtils.SPACE;

/**
* Tab: Two spaces
*/
public static final String MINI_TAB = CollectionUtil.join(Collections.nCopies(2, SPACE), EMPTY);

/**
* Tab: Four spaces
*/
public static final String TAB = CollectionUtil.join(Collections.nCopies(4, SPACE), EMPTY);
public static final String TAB = CollectionUtil.join(Collections.nCopies(2, MINI_TAB), EMPTY);

/**
* Origin Tab character
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static VerbalExpression buildRegex(String matchKeyWord) {
public static String extractComment(String originComment) {
VerbalExpression regex = VerbalExpression.regex()
.capt()
.oneOf("/", "*", ConstantUtil.NEXT_LINE, ConstantUtil.TAB).oneOrMore()
.oneOf("/", "\\*", ConstantUtil.NEXT_LINE, ConstantUtil.TAB, ConstantUtil.ORIGIN_TAB, ConstantUtil.MINI_TAB).oneOrMore()
.endCapt()
.build();
return executePatternRex(regex, originComment, ConstantUtil.EMPTY);
Expand Down

0 comments on commit 07c43cb

Please sign in to comment.