Skip to content

Commit

Permalink
yaml: Update snakeyaml revision
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Dec 19, 2021
1 parent 031bd3e commit cd37b65
Showing 1 changed file with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ final class YamlParserComposer extends ParserImpl {
// "api" //

public void singleDocumentStream(final ConfigurationNode node) throws ParsingException {
requireEvent(Event.ID.StreamStart);
document(node);
requireEvent(Event.ID.StreamEnd);
this.requireEvent(Event.ID.StreamStart);
this.document(node);
this.requireEvent(Event.ID.StreamEnd);
}

public void document(final ConfigurationNode node) throws ParsingException {
if (this.processComments && node instanceof CommentedConfigurationNodeIntermediary<@NonNull ?>) {
// Only collect comments if we can handle them in the first place
this.scanner().setEmitComments(true);
this.scanner().setParseComments(true);
}

if (peekEvent().is(Event.ID.StreamEnd)) {
if (this.peekEvent().is(Event.ID.StreamEnd)) {
return;
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public void document(final ConfigurationNode node) throws ParsingException {
ex.initPath(active.node::path);
throw ex;
} finally {
this.scanner().setEmitComments(false);
this.scanner().setParseComments(false);
this.aliases.clear();
this.declaredTags.clear();
}
Expand All @@ -138,7 +138,7 @@ ScannerImpl scanner() {
// events //

void requireEvent(final Event.ID type) throws ParsingException {
final Event next = peekEvent();
final Event next = this.peekEvent();
if (!next.is(type)) {
throw makeError(next.getStartMark(), "Expected next event of type" + type + " but was " + next.getEventId(), null);
}
Expand All @@ -147,7 +147,7 @@ void requireEvent(final Event.ID type) throws ParsingException {

@SuppressWarnings("unchecked")
<T extends Event> T requireEvent(final Event.ID type, final Class<T> clazz) throws ParsingException {
final Event next = peekEvent();
final Event next = this.peekEvent();
if (!next.is(type)) {
throw makeError(next.getStartMark(), "Expected next event of type " + type + " but was " + next.getEventId(), null);
}
Expand Down Expand Up @@ -210,7 +210,7 @@ void popFrame() {
}

Frame peekFrame() {
return peekFrame(0);
return this.peekFrame(0);
}

Frame peekFrame(final int depth) {
Expand Down Expand Up @@ -328,12 +328,12 @@ void applyComment(final @Nullable String comment, final ConfigurationNode node)
}

void collectComments() {
if (!this.processComments || !this.scanner().isEmitComments()) {
if (!this.processComments || !this.scanner().isParseComments()) {
return;
}

while (peekEvent().is(Event.ID.Comment)) {
final CommentEvent event = (CommentEvent) getEvent();
while (this.peekEvent().is(Event.ID.Comment)) {
final CommentEvent event = (CommentEvent) this.getEvent();
if (event.getCommentType() != CommentType.BLANK_LINE) {
@Nullable StringBuilder commentCollector = this.commentCollector;
if (commentCollector == null) {
Expand All @@ -352,23 +352,23 @@ void collectComments() {
}

public <N extends ConfigurationNode> Stream<N> stream(final ConfigurationNodeFactory<N> factory) throws ParsingException {
requireEvent(Event.ID.StreamStart);
this.requireEvent(Event.ID.StreamStart);
return StreamSupport.stream(Spliterators.spliteratorUnknownSize(new Iterator<N>() {
@Override
public boolean hasNext() {
return !checkEvent(Event.ID.StreamEnd);
return !YamlParserComposer.this.checkEvent(Event.ID.StreamEnd);
}

@Override
public N next() {
if (!hasNext()) {
if (!this.hasNext()) {
throw new IndexOutOfBoundsException();
}
try {
final N node = factory.createNode();
document(node);
if (!hasNext()) {
requireEvent(Event.ID.StreamEnd);
YamlParserComposer.this.document(node);
if (!this.hasNext()) {
YamlParserComposer.this.requireEvent(Event.ID.StreamEnd);
}
return node;
} catch (final ConfigurateException e) {
Expand Down

0 comments on commit cd37b65

Please sign in to comment.