Use method to strip quotes. This could be factored out as it seems generally usefull

This commit is contained in:
Marco Hunsicker 2016-11-20 19:21:54 +01:00
parent 89e3f063c9
commit cb785d5d1e
1 changed files with 4 additions and 2 deletions

View File

@ -233,8 +233,7 @@ class GrammarDependencies {
String value = option.getChild(1).getText();
if ("tokenVocab".equals(key)) {
// make sure to have the name unquoted
String name = value.replaceAll("\\A'|'\\Z", "");
String name = stripQuotes(value);
// the grammar name may be qualified, but we resolve the path anyway
String grammarName = stripPath(name);
String grammarPath = MojoUtils.findSourceSubdir(sourceDirectory,
@ -306,4 +305,7 @@ class GrammarDependencies {
return str.replaceAll("^.*[/\\\\]", "");
}
private String stripQuotes(String str) {
return str.replaceAll("\\A'|'\\Z", "");
}
}