mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-05-16 09:31:36 +00:00
Added Results.Errors to Context constructor and Context.with(Identifier)
This commit is contained in:
parent
786529fce6
commit
7292fe5468
|
@ -5,9 +5,15 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
class Context {
|
||||
final Identifier identifier;
|
||||
final AtomicInteger line;
|
||||
final Results.Errors errors;
|
||||
|
||||
public Context(Identifier identifier, AtomicInteger line) {
|
||||
public Context(Identifier identifier, AtomicInteger line, Results.Errors errors) {
|
||||
this.identifier = identifier;
|
||||
this.line = line;
|
||||
this.errors = errors;
|
||||
}
|
||||
|
||||
public Context with(Identifier identifier) {
|
||||
return new Context(identifier, line, errors);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class InlineTableConverter implements ValueConverter {
|
|||
} else if (quoted) {
|
||||
currentKey.append(c);
|
||||
} else if (inValue && !Character.isWhitespace(c)) {
|
||||
Object converted = CONVERTERS.convert(s, sharedIndex, new Context(new Identifier(currentKey.toString()), context.line));
|
||||
Object converted = CONVERTERS.convert(s, sharedIndex, context.with(new Identifier(currentKey.toString())));
|
||||
|
||||
if (converted instanceof Results.Errors) {
|
||||
errors.add((Results.Errors) converted);
|
||||
|
@ -49,7 +49,7 @@ class InlineTableConverter implements ValueConverter {
|
|||
inValue = false;
|
||||
} else if (c == '{') {
|
||||
sharedIndex.incrementAndGet();
|
||||
Object converted = convert(s, sharedIndex, new Context(new Identifier(currentKey.toString()), context.line));
|
||||
Object converted = convert(s, sharedIndex, context.with(new Identifier(currentKey.toString())));
|
||||
|
||||
if (converted instanceof Results.Errors) {
|
||||
errors.add((Results.Errors) converted);
|
||||
|
|
Loading…
Reference in a new issue