Removed unused methods and variables

This commit is contained in:
moandji.ezana 2015-02-13 08:44:54 +02:00
parent be85328555
commit ca7fcc766b
3 changed files with 8 additions and 28 deletions

View file

@ -4,8 +4,7 @@ class Identifier {
static final Identifier INVALID = new Identifier("", null);
private static final String ALLOWED_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_-.";
private static final String ALLOWED_CHARS_KEYS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_-";
private static final String ALLOWED_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_-";
private final String name;
private final Type type;
@ -102,7 +101,7 @@ class Identifier {
return false;
}
quoted = !quoted;
} else if (!quoted && (ALLOWED_CHARS_KEYS.indexOf(c) == -1)) {
} else if (!quoted && (ALLOWED_CHARS.indexOf(c) == -1)) {
context.errors.invalidKey(name, context.line.get());
return false;
}
@ -170,7 +169,7 @@ class Identifier {
quoteAllowed = true;
}
} else {
if (charAllowed && ALLOWED_CHARS_KEYS.indexOf(c) > -1) {
if (charAllowed && ALLOWED_CHARS.indexOf(c) > -1) {
charAllowed = true;
dotAllowed = true;
quoteAllowed = false;
@ -185,7 +184,6 @@ class Identifier {
return false;
}
// return StringConverter.STRING_PARSER.replaceUnicodeCharacters(tableName);
return true;
}
@ -248,7 +246,7 @@ class Identifier {
quoteAllowed = true;
}
} else {
if (charAllowed && ALLOWED_CHARS_KEYS.indexOf(c) > -1) {
if (charAllowed && ALLOWED_CHARS.indexOf(c) > -1) {
charAllowed = true;
dotAllowed = true;
quoteAllowed = false;

View file

@ -42,13 +42,12 @@ class TomlParser {
value = null;
line.incrementAndGet();
} else if (!inComment && identifier != null && identifier.isKey() && value == null && !Character.isWhitespace(c)) {
Object converted = ValueConverters.CONVERTERS.convert(tomlString, index, new Context(identifier, line, results.errors));
value = converted;
value = ValueConverters.CONVERTERS.convert(tomlString, index, new Context(identifier, line, results.errors));
if (converted instanceof Results.Errors) {
results.errors.add((Results.Errors) converted);
if (value instanceof Results.Errors) {
results.errors.add((Results.Errors) value);
} else {
results.addValue(identifier.getName(), converted);
results.addValue(identifier.getName(), value);
}
} else if (value != null && !inComment && !Character.isWhitespace(c)) {
results.errors.invalidTextAfterIdentifier(identifier, c, line.get());

View file

@ -16,23 +16,6 @@ class ValueConverters {
static final ValueConverters CONVERTERS = new ValueConverters();
static boolean isComment(String line) {
if (line == null || line.isEmpty()) {
return true;
}
for (int i = 0; i < line.length(); i++) {
char c = line.charAt(i);
if (Character.isWhitespace(c)) {
continue;
}
return c == '#';
}
return false;
}
Object convert(String value, AtomicInteger index, Context context) {
String substring = value.substring(index.get());
for (ValueConverter valueParser : PARSERS) {