Skip to content

Commit

Permalink
fix: Fix config load issues with \r newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Jun 24, 2024
1 parent 40c6b92 commit 921ca16
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void next(NotomlStateMachine state, NotomlParseBuffer buffer, NotomlTokenConsume
Comment {
@Override
void next(NotomlStateMachine state, NotomlParseBuffer buffer, NotomlTokenConsumer consumer) {
String comment = buffer.readUntilConsume("\n", "\r\n").trim();
String comment = buffer.readUntilConsume("\n", "\r\n", "\r").trim();
consumer.emitComment(comment);
state.transition(None);
}
Expand All @@ -40,7 +40,7 @@ void next(NotomlStateMachine state, NotomlParseBuffer buffer, NotomlTokenConsume

@Override
void next(NotomlStateMachine state, NotomlParseBuffer buffer, NotomlTokenConsumer consumer) {
String property = buffer.readUntilConsume("=", "\n", "\r\n").trim();
String property = buffer.readUntilConsume("=", "\n", "\r\n", "\r").trim();
if (!PROPERTY_KEY_PATTERN.matcher(property).matches()) {
throw new IllegalStateException("Invalid property key '" + property + "' (properties may only contain letters, numbers, dashes and underscores)");
}
Expand All @@ -63,7 +63,7 @@ void next(NotomlStateMachine state, NotomlParseBuffer buffer, NotomlTokenConsume
consumer.emitListStart();
state.transition(List);
} else {
String value = buffer.readUntilConsume("\n", "\r\n");
String value = buffer.readUntilConsume("\n", "\r\n", "\r");
consumer.emitPropertyValue(value);
state.transition(None);
}
Expand Down

0 comments on commit 921ca16

Please sign in to comment.