-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ilyas RIAH #19
base: develop
Are you sure you want to change the base?
Ilyas RIAH #19
Conversation
Adding Enum, BoolExpression and IfElse rules.
|
||
for (StmtWrapper BoolExpWrapper : BoolExpWrappers) { | ||
Matcher matcher = Pattern | ||
.compile("(([\\\\w\\\\d\\\\s.])+(==|!=|<|>|>=|<=)[\\\\w\\\\d\\\\s.]+([&\\\\|]{2})?)+") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regex expression is too long, maintenance will be hard
compilationUnit.accept(new IfElseVisitor(),ifElseWrappers); | ||
|
||
for(StmtWrapper ifElseWrapper: ifElseWrappers){ | ||
Matcher matcher = Pattern.compile(".*\\{([\\S\\s]*)\\}").matcher(ifElseWrapper.getStatement().toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use visitor pattern
public class ClassVisitor extends VoidVisitorAdapter<List<ClassWrapper>> { | ||
|
||
@Override | ||
public void visit(ClassOrInterfaceDeclaration CID, List<ClassWrapper> arg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CID
is not a valid variable name
private String variableDeclaration(Statement statement) { | ||
Matcher m = Pattern.compile("[\\w]+\\s+([\\w]+)\\s*(=\\s*[\\w\\s()]+)?;") | ||
.matcher(statement.toString().replace("return", "")); | ||
if (m.find()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if statement must have curly braces
No description provided.