Skip to content

Commit

Permalink
Fix issue #8
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed May 24, 2016
1 parent 0e3f53a commit 2f9f8ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,17 @@ public void init() {
public void visitNode(AstNode astNode) {
for (AstNode nameNode : astNode.getChildren(EsqlGrammar.NAME)){
String name = nameNode.getTokenOriginalValue();
if (!pattern.matcher(name).matches()) {
if (!isValidName(name)) {
getContext().createLineViolation(this,
"Rename {0} \"{1}\" to match the regular expression {2}.",
nameNode, typeName(), name, getFormat());
}
}
}

protected boolean isValidName(String nameToCheck){
return pattern.matcher(nameToCheck).matches();
}

public abstract String typeName();
public abstract AstNodeType getType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,13 @@ public AstNodeType getType() {
}


@Override
protected boolean isValidName(String nameToCheck) {
//Issue 8
if ("Main".equals(nameToCheck)){
return true;
}
return super.isValidName(nameToCheck);
}

}

0 comments on commit 2f9f8ef

Please sign in to comment.