mirror of
https://github.com/plexusorg/toml4j.git
synced 2025-02-11 03:30:00 +00:00
Removed unused methods
This commit is contained in:
parent
6e4c8fd022
commit
8388e394ed
1 changed files with 0 additions and 103 deletions
|
@ -1,7 +1,5 @@
|
|||
package com.moandjiezana.toml;
|
||||
|
||||
import static com.moandjiezana.toml.ValueConverters.isComment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,7 +23,6 @@ class Keys {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static Keys.Key[] split(String key) {
|
||||
List<Key> splitKey = new ArrayList<Key>();
|
||||
StringBuilder current = new StringBuilder();
|
||||
|
@ -67,105 +64,5 @@ class Keys {
|
|||
return splitKey.toArray(new Key[0]);
|
||||
}
|
||||
|
||||
static String getTableArrayName(String line) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char[] chars = line.toCharArray();
|
||||
boolean quoted = false;
|
||||
boolean terminated = false;
|
||||
int endIndex = -1;
|
||||
boolean preKey = true;
|
||||
|
||||
for (int i = 2; i < chars.length; i++) {
|
||||
char c = chars[i];
|
||||
if (c == '"' && chars[i - 1] != '\\') {
|
||||
if (!quoted && i > 1 && chars [i - 1] != '.' && !Character.isWhitespace(chars[i - 1])) {
|
||||
break;
|
||||
}
|
||||
quoted = !quoted;
|
||||
} else if (!quoted && c == ']') {
|
||||
if (chars.length > i + 1 && chars[i + 1] == ']') {
|
||||
terminated = true;
|
||||
endIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
} else if (!quoted && c == '.') {
|
||||
preKey = true;
|
||||
} else if (!quoted && Character.isWhitespace(c)) {
|
||||
if (preKey && i > 2 && chars[i - 1] != '.' && !Character.isWhitespace(chars[i - 1])) {
|
||||
break;
|
||||
}
|
||||
if (!preKey && chars.length > i + 1 && chars[i + 1] != '.' && chars[i + 1] != ']' && !Character.isWhitespace(chars[i + 1])) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if (!quoted && (ALLOWED_CHARS.indexOf(c) == -1)) {
|
||||
break;
|
||||
} else {
|
||||
preKey = false;
|
||||
}
|
||||
|
||||
sb.append(c);
|
||||
}
|
||||
|
||||
String tableName = sb.toString();
|
||||
|
||||
if (!terminated || tableName.isEmpty() || !isComment(line.substring(endIndex + 1))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return StringConverter.STRING_PARSER.replaceUnicodeCharacters(tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param line trimmed TOML line to parse
|
||||
* @return null if line is not a valid table identifier
|
||||
*/
|
||||
static String getTableName(String line) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char[] chars = line.toCharArray();
|
||||
boolean quoted = false;
|
||||
boolean terminated = false;
|
||||
int endIndex = -1;
|
||||
boolean preKey = true;
|
||||
|
||||
for (int i = 1; i < chars.length; i++) {
|
||||
char c = chars[i];
|
||||
if (c == '"' && chars[i - 1] != '\\') {
|
||||
if (!quoted && i > 1 && chars [i - 1] != '.' && !Character.isWhitespace(chars[i - 1])) {
|
||||
break;
|
||||
}
|
||||
quoted = !quoted;
|
||||
} else if (!quoted && c == ']') {
|
||||
terminated = true;
|
||||
endIndex = i;
|
||||
break;
|
||||
} else if (!quoted && c == '.') {
|
||||
preKey = true;
|
||||
} else if (!quoted && Character.isWhitespace(c)) {
|
||||
if (preKey && i > 1 && chars[i - 1] != '.' && !Character.isWhitespace(chars[i - 1])) {
|
||||
break;
|
||||
}
|
||||
if (!preKey && chars.length > i + 1 && chars[i + 1] != '.' && chars[i + 1] != ']' && !Character.isWhitespace(chars[i + 1])) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
} else if (!quoted && (ALLOWED_CHARS.indexOf(c) == -1)) {
|
||||
break;
|
||||
} else if (!quoted) {
|
||||
preKey = false;
|
||||
}
|
||||
|
||||
sb.append(c);
|
||||
}
|
||||
|
||||
String tableName = sb.toString();
|
||||
|
||||
if (!terminated || !isComment(line.substring(endIndex + 1))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return StringConverter.STRING_PARSER.replaceUnicodeCharacters(tableName);
|
||||
}
|
||||
|
||||
private Keys() {}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue