Skip to content

Commit

Permalink
feat(format/yaml): Rebase onto latest upstream snakeyaml
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Oct 14, 2023
1 parent bf7360e commit 54a9eea
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
2 changes: 2 additions & 0 deletions vendor/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*]
indent_size = 2
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ Subject: [PATCH] scanner: Initial implementation of tab acceptance


diff --git a/src/main/java/org/yaml/snakeyaml/LoaderOptions.java b/src/main/java/org/yaml/snakeyaml/LoaderOptions.java
index 432730bee858cfaa9e638b87272265826d6270a6..03bcf0d12e35768cee5cc6e179d7150cc5857dee 100644
index 12038cbbab7d0263739b8738a309412157be71c5..772c8819aab4b39d702d89d0508dc79d2126c13f 100644
--- a/src/main/java/org/yaml/snakeyaml/LoaderOptions.java
+++ b/src/main/java/org/yaml/snakeyaml/LoaderOptions.java
@@ -28,6 +28,7 @@ public class LoaderOptions {
// https://en.wikipedia.org/wiki/Billion_laughs_attack
private boolean allowRecursiveKeys = false;
@@ -32,6 +32,8 @@ public class LoaderOptions {

private boolean processComments = false;

+ private boolean acceptTabs = false;
+
private boolean enumCaseSensitive = true;

private int nestingDepthLimit = 50;
private int codePointLimit = 3 * 1024 * 1024; // 3 MB
@@ -148,6 +149,30 @@ public class LoaderOptions {
return processComments;
@@ -149,6 +151,30 @@ public class LoaderOptions {
return this;
}

+ /**
Expand Down Expand Up @@ -48,27 +49,25 @@ index 432730bee858cfaa9e638b87272265826d6270a6..03bcf0d12e35768cee5cc6e179d7150c
* getter
*
diff --git a/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java b/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java
index c9ae314ce57c268e169b99b77d050ac02a143ce2..373e4c1845b0f739b2f805612887b8d84d057700 100644
index ca2343c2d223abee59c219aa58629efd46429fdf..e566816b2cf7719a14c601f2551aa7f6f0c13cd6 100644
--- a/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java
+++ b/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java
@@ -216,6 +216,8 @@ public final class ScannerImpl implements Scanner {
@@ -216,11 +216,14 @@ public final class ScannerImpl implements Scanner {
*/
private final Map<Integer, SimpleKey> possibleSimpleKeys;

+ private final boolean acceptTabs;
+
/**
* Create
*
@@ -232,6 +234,7 @@ public final class ScannerImpl implements Scanner {
public ScannerImpl(StreamReader reader, LoaderOptions options) {
if (options == null) {
throw new NullPointerException("LoaderOptions must be provided.");
}
this.parseComments = options.isProcessComments();
+ this.acceptTabs = options.isAcceptTabs();
this.reader = reader;
this.tokens = new ArrayList<Token>(100);
this.indents = new ArrayStack<Integer>(10);
@@ -1241,7 +1244,7 @@ public final class ScannerImpl implements Scanner {
@@ -1213,7 +1216,7 @@ public final class ScannerImpl implements Scanner {
int ff = 0;
// Peek ahead until we find the first non-space character, then
// move forward directly to that character.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sequences. It might be nice to capture the prettiness status of input
data, but that seems extremely error-prone and probably not worth doing.

diff --git a/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java b/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java
index 155e1f5775c20ae7efb6aa7f8a39c35480231452..81a0a14835931a6b0f201d102b5e9b66d9888bb5 100644
index 7ba1cd72dfe51ca80131b05d38fdba8e7f37e60c..1cdf6658139bb08939a830ce1dbf1d762d0f8fda 100644
--- a/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java
+++ b/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java
@@ -161,7 +161,14 @@ public final class Emitter implements Emitable {
Expand Down Expand Up @@ -104,7 +104,7 @@ index 155e1f5775c20ae7efb6aa7f8a39c35480231452..81a0a14835931a6b0f201d102b5e9b66
inlineCommentsCollector.collectEvents();
writeInlineComments();
state = states.pop();
@@ -1532,6 +1565,10 @@ public final class Emitter implements Emitable {
@@ -1545,6 +1578,10 @@ public final class Emitter implements Emitable {
if (!blockCommentsCollector.isEmpty()) {
writeIndent();
writeCommentLines(blockCommentsCollector.consume());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ first element of the sequence. I don't think there's anything we can
do about that though.... needs more thought i suppose

diff --git a/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java b/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java
index 81a0a14835931a6b0f201d102b5e9b66d9888bb5..c30d3fb69004d63e752d6207f2df376d079da172 100644
index 1cdf6658139bb08939a830ce1dbf1d762d0f8fda..b2f9e9486fd43570b831cf2409e1321aeedcb38b 100644
--- a/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java
+++ b/src/main/java/org/yaml/snakeyaml/emitter/Emitter.java
@@ -753,6 +753,9 @@ public final class Emitter implements Emitable {
Expand Down
2 changes: 1 addition & 1 deletion vendor/snakeyaml-upstream
Submodule snakeyaml-upstream updated from fc1701 to a4df9e

0 comments on commit 54a9eea

Please sign in to comment.