mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-28 19:24:15 +00:00
Removed duplicate comment checks
This commit is contained in:
parent
b7b546dc83
commit
e0762bf82a
1 changed files with 1 additions and 22 deletions
|
@ -1,6 +1,7 @@
|
|||
package com.moandjiezana.toml;
|
||||
|
||||
import static com.moandjiezana.toml.ValueConverterUtils.INVALID;
|
||||
import static com.moandjiezana.toml.ValueConverterUtils.isComment;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -39,10 +40,6 @@ class TomlParser {
|
|||
String tableName = Keys.getTableArrayName(line);
|
||||
if (tableName != null) {
|
||||
results.startTableArray(tableName);
|
||||
String afterTableName = line.substring(tableName.length() + 4);
|
||||
if (!isComment(afterTableName)) {
|
||||
results.errors.append("Invalid table array definition: " + line + "\n\n");
|
||||
}
|
||||
} else {
|
||||
results.errors.append("Invalid table array definition: " + line + "\n\n");
|
||||
}
|
||||
|
@ -173,24 +170,6 @@ class TomlParser {
|
|||
return line.startsWith("[");
|
||||
}
|
||||
|
||||
private boolean isComment(String line) {
|
||||
if (line == null || line.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char[] chars = line.toCharArray();
|
||||
|
||||
for (char c : chars) {
|
||||
if (Character.isWhitespace(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return c == '#';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private String removeComment(String line) {
|
||||
line = line.trim();
|
||||
if (line.startsWith("\"")) {
|
||||
|
|
Loading…
Reference in a new issue