aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/yaml/snakeyaml/tokens
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/yaml/snakeyaml/tokens')
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/AliasToken.java46
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/AnchorToken.java46
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/BlockEndToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/BlockEntryToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/BlockMappingStartToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/BlockSequenceStartToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/CommentToken.java52
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/DirectiveToken.java66
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/DocumentEndToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/DocumentStartToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/FlowEntryToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/FlowMappingEndToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/FlowMappingStartToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceEndToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceStartToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/KeyToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/ScalarToken.java79
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/StreamEndToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/StreamStartToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/TagToken.java46
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/TagTuple.java47
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/Token.java103
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/ValueToken.java32
-rw-r--r--src/main/java/org/yaml/snakeyaml/tokens/WhitespaceToken.java37
24 files changed, 473 insertions, 529 deletions
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/AliasToken.java b/src/main/java/org/yaml/snakeyaml/tokens/AliasToken.java
index df2ee2e9..be8a5144 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/AliasToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/AliasToken.java
@@ -1,41 +1,35 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
import org.yaml.snakeyaml.error.Mark;
public final class AliasToken extends Token {
- private final String value;
- public AliasToken(String value, Mark startMark, Mark endMark) {
- super(startMark, endMark);
- this.value = value;
- }
+ private final String value;
- public String getValue() {
- return this.value;
- }
+ public AliasToken(String value, Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ this.value = value;
+ }
- @Override
- protected String getArguments() {
- return "value=" + value;
- }
+ public String getValue() {
+ return this.value;
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.Alias;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Alias;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/AnchorToken.java b/src/main/java/org/yaml/snakeyaml/tokens/AnchorToken.java
index 3629eeae..6d10cf71 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/AnchorToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/AnchorToken.java
@@ -1,41 +1,35 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
import org.yaml.snakeyaml.error.Mark;
public final class AnchorToken extends Token {
- private final String value;
- public AnchorToken(String value, Mark startMark, Mark endMark) {
- super(startMark, endMark);
- this.value = value;
- }
+ private final String value;
- public String getValue() {
- return this.value;
- }
+ public AnchorToken(String value, Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ this.value = value;
+ }
- @Override
- protected String getArguments() {
- return "value=" + value;
- }
+ public String getValue() {
+ return this.value;
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.Anchor;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Anchor;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/BlockEndToken.java b/src/main/java/org/yaml/snakeyaml/tokens/BlockEndToken.java
index 3315bc40..0f994154 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/BlockEndToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/BlockEndToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class BlockEndToken extends Token {
- public BlockEndToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public BlockEndToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.BlockEnd;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.BlockEnd;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/BlockEntryToken.java b/src/main/java/org/yaml/snakeyaml/tokens/BlockEntryToken.java
index 574445f0..3657ae70 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/BlockEntryToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/BlockEntryToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class BlockEntryToken extends Token {
- public BlockEntryToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public BlockEntryToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.BlockEntry;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.BlockEntry;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/BlockMappingStartToken.java b/src/main/java/org/yaml/snakeyaml/tokens/BlockMappingStartToken.java
index 95a61642..4a35c917 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/BlockMappingStartToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/BlockMappingStartToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class BlockMappingStartToken extends Token {
- public BlockMappingStartToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public BlockMappingStartToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.BlockMappingStart;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.BlockMappingStart;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/BlockSequenceStartToken.java b/src/main/java/org/yaml/snakeyaml/tokens/BlockSequenceStartToken.java
index d70194c7..3ea7a20d 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/BlockSequenceStartToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/BlockSequenceStartToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class BlockSequenceStartToken extends Token {
- public BlockSequenceStartToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public BlockSequenceStartToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.BlockSequenceStart;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.BlockSequenceStart;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/CommentToken.java b/src/main/java/org/yaml/snakeyaml/tokens/CommentToken.java
index 12c067ef..36fe079e 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/CommentToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/CommentToken.java
@@ -1,29 +1,45 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
+import java.util.Objects;
+import org.yaml.snakeyaml.comments.CommentType;
import org.yaml.snakeyaml.error.Mark;
-public class CommentToken extends Token {
- public CommentToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+public final class CommentToken extends Token {
- @Override
- public ID getTokenId() {
- return ID.Comment;
- }
+ private final CommentType type;
+ private final String value;
+
+ public CommentToken(CommentType type, String value, Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ Objects.requireNonNull(type);
+ this.type = type;
+ Objects.requireNonNull(value);
+ this.value = value;
+ }
+
+ public CommentType getCommentType() {
+ return this.type;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Comment;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/DirectiveToken.java b/src/main/java/org/yaml/snakeyaml/tokens/DirectiveToken.java
index af1743f8..d6d53035 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/DirectiveToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/DirectiveToken.java
@@ -1,58 +1,46 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
import java.util.List;
-
import org.yaml.snakeyaml.error.Mark;
import org.yaml.snakeyaml.error.YAMLException;
public final class DirectiveToken<T> extends Token {
- private final String name;
- private final List<T> value;
- public DirectiveToken(String name, List<T> value, Mark startMark, Mark endMark) {
- super(startMark, endMark);
- this.name = name;
- if (value != null && value.size() != 2) {
- throw new YAMLException("Two strings must be provided instead of "
- + String.valueOf(value.size()));
- }
- this.value = value;
- }
+ private final String name;
+ private final List<T> value;
- public String getName() {
- return this.name;
+ public DirectiveToken(String name, List<T> value, Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ this.name = name;
+ if (value != null && value.size() != 2) {
+ throw new YAMLException("Two strings must be provided instead of " + value.size());
}
+ this.value = value;
+ }
- public List<T> getValue() {
- return this.value;
- }
+ public String getName() {
+ return this.name;
+ }
- @Override
- protected String getArguments() {
- if (value != null) {
- return "name=" + name + ", value=[" + value.get(0) + ", " + value.get(1) + "]";
- } else {
- return "name=" + name;
- }
- }
+ public List<T> getValue() {
+ return this.value;
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.Directive;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Directive;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/DocumentEndToken.java b/src/main/java/org/yaml/snakeyaml/tokens/DocumentEndToken.java
index ee17dab1..4c2319c3 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/DocumentEndToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/DocumentEndToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class DocumentEndToken extends Token {
- public DocumentEndToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public DocumentEndToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.DocumentEnd;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.DocumentEnd;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/DocumentStartToken.java b/src/main/java/org/yaml/snakeyaml/tokens/DocumentStartToken.java
index 0b72deb3..1ce5445d 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/DocumentStartToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/DocumentStartToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class DocumentStartToken extends Token {
- public DocumentStartToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public DocumentStartToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.DocumentStart;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.DocumentStart;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/FlowEntryToken.java b/src/main/java/org/yaml/snakeyaml/tokens/FlowEntryToken.java
index b1afb0f5..03e5c9ff 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/FlowEntryToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/FlowEntryToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class FlowEntryToken extends Token {
- public FlowEntryToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public FlowEntryToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.FlowEntry;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.FlowEntry;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingEndToken.java b/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingEndToken.java
index 1659a9f0..8ec5dd4c 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingEndToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingEndToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class FlowMappingEndToken extends Token {
- public FlowMappingEndToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public FlowMappingEndToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.FlowMappingEnd;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.FlowMappingEnd;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingStartToken.java b/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingStartToken.java
index 5a984c72..8ee9814b 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingStartToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/FlowMappingStartToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class FlowMappingStartToken extends Token {
- public FlowMappingStartToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public FlowMappingStartToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.FlowMappingStart;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.FlowMappingStart;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceEndToken.java b/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceEndToken.java
index 39b03c43..cc991d42 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceEndToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceEndToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class FlowSequenceEndToken extends Token {
- public FlowSequenceEndToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public FlowSequenceEndToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.FlowSequenceEnd;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.FlowSequenceEnd;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceStartToken.java b/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceStartToken.java
index da89785e..1e2de015 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceStartToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/FlowSequenceStartToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class FlowSequenceStartToken extends Token {
- public FlowSequenceStartToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public FlowSequenceStartToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.FlowSequenceStart;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.FlowSequenceStart;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/KeyToken.java b/src/main/java/org/yaml/snakeyaml/tokens/KeyToken.java
index 0f880438..2b36521c 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/KeyToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/KeyToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class KeyToken extends Token {
- public KeyToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public KeyToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.Key;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Key;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/ScalarToken.java b/src/main/java/org/yaml/snakeyaml/tokens/ScalarToken.java
index 828189e8..5a6ccd51 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/ScalarToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/ScalarToken.java
@@ -1,57 +1,56 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
+import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.error.Mark;
public final class ScalarToken extends Token {
- private final String value;
- private final boolean plain;
- private final char style;
- public ScalarToken(String value, Mark startMark, Mark endMark, boolean plain) {
- this(value, plain, startMark, endMark, (char) 0);
+ private final String value;
+ private final boolean plain;
+ private final DumperOptions.ScalarStyle style;
+
+ public ScalarToken(String value, Mark startMark, Mark endMark, boolean plain) {
+ this(value, plain, startMark, endMark, DumperOptions.ScalarStyle.PLAIN);
+ }
+
+ public ScalarToken(String value, boolean plain, Mark startMark, Mark endMark,
+ DumperOptions.ScalarStyle style) {
+ super(startMark, endMark);
+ this.value = value;
+ this.plain = plain;
+ if (style == null) {
+ throw new NullPointerException("Style must be provided.");
}
+ this.style = style;
+ }
- public ScalarToken(String value, boolean plain, Mark startMark, Mark endMark, char style) {
- super(startMark, endMark);
- this.value = value;
- this.plain = plain;
- this.style = style;
- }
-
- public boolean getPlain() {
- return this.plain;
- }
-
- public String getValue() {
- return this.value;
- }
+ public boolean getPlain() {
+ return this.plain;
+ }
- public char getStyle() {
- return this.style;
- }
+ public String getValue() {
+ return this.value;
+ }
- @Override
- protected String getArguments() {
- return "value=" + value + ", plain=" + plain + ", style=" + style;
- }
+ public DumperOptions.ScalarStyle getStyle() {
+ return this.style;
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.Scalar;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Scalar;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/StreamEndToken.java b/src/main/java/org/yaml/snakeyaml/tokens/StreamEndToken.java
index ece87b95..4998ee32 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/StreamEndToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/StreamEndToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class StreamEndToken extends Token {
- public StreamEndToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public StreamEndToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.StreamEnd;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.StreamEnd;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/StreamStartToken.java b/src/main/java/org/yaml/snakeyaml/tokens/StreamStartToken.java
index 4b5419a6..f085f45c 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/StreamStartToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/StreamStartToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class StreamStartToken extends Token {
- public StreamStartToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public StreamStartToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.StreamStart;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.StreamStart;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/TagToken.java b/src/main/java/org/yaml/snakeyaml/tokens/TagToken.java
index 505a360f..affa00a1 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/TagToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/TagToken.java
@@ -1,41 +1,35 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
import org.yaml.snakeyaml.error.Mark;
public final class TagToken extends Token {
- private final TagTuple value;
- public TagToken(TagTuple value, Mark startMark, Mark endMark) {
- super(startMark, endMark);
- this.value = value;
- }
+ private final TagTuple value;
- public TagTuple getValue() {
- return this.value;
- }
+ public TagToken(TagTuple value, Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ this.value = value;
+ }
- @Override
- protected String getArguments() {
- return "value=[" + value.getHandle() + ", " + value.getSuffix() + "]";
- }
+ public TagTuple getValue() {
+ return this.value;
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.Tag;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Tag;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/TagTuple.java b/src/main/java/org/yaml/snakeyaml/tokens/TagTuple.java
index b4ea0646..dd0ef388 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/TagTuple.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/TagTuple.java
@@ -1,37 +1,36 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
public final class TagTuple {
- private final String handle;
- private final String suffix;
- public TagTuple(String handle, String suffix) {
- if (suffix == null) {
- throw new NullPointerException("Suffix must be provided.");
- }
- this.handle = handle;
- this.suffix = suffix;
- }
+ private final String handle;
+ private final String suffix;
- public String getHandle() {
- return handle;
+ public TagTuple(String handle, String suffix) {
+ if (suffix == null) {
+ throw new NullPointerException("Suffix must be provided.");
}
+ this.handle = handle;
+ this.suffix = suffix;
+ }
- public String getSuffix() {
- return suffix;
- }
+ public String getHandle() {
+ return handle;
+ }
+
+ public String getSuffix() {
+ return suffix;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/Token.java b/src/main/java/org/yaml/snakeyaml/tokens/Token.java
index 8b583f5d..63a49271 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/Token.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/Token.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,64 +17,53 @@ import org.yaml.snakeyaml.error.Mark;
import org.yaml.snakeyaml.error.YAMLException;
public abstract class Token {
- public enum ID {
- Alias, Anchor, BlockEnd, BlockEntry, BlockMappingStart, BlockSequenceStart, Directive, DocumentEnd, DocumentStart, FlowEntry, FlowMappingEnd, FlowMappingStart, FlowSequenceEnd, FlowSequenceStart, Key, Scalar, StreamEnd, StreamStart, Tag, Value, Whitespace, Comment, Error
- }
- private final Mark startMark;
- private final Mark endMark;
+ public enum ID {
+ Alias("<alias>"), Anchor("<anchor>"), BlockEnd("<block end>"), BlockEntry(
+ "-"), BlockMappingStart("<block mapping start>"), BlockSequenceStart(
+ "<block sequence start>"), Directive("<directive>"), DocumentEnd(
+ "<document end>"), DocumentStart("<document start>"), FlowEntry(
+ ","), FlowMappingEnd("}"), FlowMappingStart("{"), FlowSequenceEnd(
+ "]"), FlowSequenceStart("["), Key("?"), Scalar("<scalar>"), StreamEnd(
+ "<stream end>"), StreamStart("<stream start>"), Tag("<tag>"), Value(
+ ":"), Whitespace("<whitespace>"), Comment("#"), Error("<error>");
- public Token(Mark startMark, Mark endMark) {
- if (startMark == null || endMark == null) {
- throw new YAMLException("Token requires marks.");
- }
- this.startMark = startMark;
- this.endMark = endMark;
- }
+ private final String description;
- public String toString() {
- return "<" + this.getClass().getName() + "(" + getArguments() + ")>";
+ ID(String s) {
+ description = s;
}
- public Mark getStartMark() {
- return startMark;
+ @Override
+ public String toString() {
+ return description;
}
+ }
- public Mark getEndMark() {
- return endMark;
- }
+ private final Mark startMark;
+ private final Mark endMark;
- /**
- * @see "__repr__ for Token in PyYAML"
- */
- protected String getArguments() {
- return "";
+ public Token(Mark startMark, Mark endMark) {
+ if (startMark == null || endMark == null) {
+ throw new YAMLException("Token requires marks.");
}
+ this.startMark = startMark;
+ this.endMark = endMark;
+ }
- /**
- * For error reporting.
- *
- * @see "class variable 'id' in PyYAML"
- */
- public abstract Token.ID getTokenId();
+ public Mark getStartMark() {
+ return startMark;
+ }
- /*
- * for tests only
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof Token) {
- return toString().equals(obj.toString());
- } else {
- return false;
- }
- }
+ public Mark getEndMark() {
+ return endMark;
+ }
- /*
- * for tests only
- */
- @Override
- public int hashCode() {
- return toString().hashCode();
- }
+ /**
+ * For error reporting.
+ *
+ * @see "class variable 'id' in PyYAML"
+ * @return ID of this token
+ */
+ public abstract Token.ID getTokenId();
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/ValueToken.java b/src/main/java/org/yaml/snakeyaml/tokens/ValueToken.java
index 58fe0576..504f1c6f 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/ValueToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/ValueToken.java
@@ -1,17 +1,15 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
@@ -19,12 +17,12 @@ import org.yaml.snakeyaml.error.Mark;
public final class ValueToken extends Token {
- public ValueToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
+ public ValueToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
- @Override
- public Token.ID getTokenId() {
- return ID.Value;
- }
+ @Override
+ public Token.ID getTokenId() {
+ return ID.Value;
+ }
}
diff --git a/src/main/java/org/yaml/snakeyaml/tokens/WhitespaceToken.java b/src/main/java/org/yaml/snakeyaml/tokens/WhitespaceToken.java
index 65af212d..f61de83e 100644
--- a/src/main/java/org/yaml/snakeyaml/tokens/WhitespaceToken.java
+++ b/src/main/java/org/yaml/snakeyaml/tokens/WhitespaceToken.java
@@ -1,29 +1,32 @@
/**
- * Copyright (c) 2008, http://www.snakeyaml.org
+ * Copyright (c) 2008, SnakeYAML
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
*/
package org.yaml.snakeyaml.tokens;
import org.yaml.snakeyaml.error.Mark;
+/**
+ * @deprecated it will be removed because it is not used
+ */
+@Deprecated
public class WhitespaceToken extends Token {
- public WhitespaceToken(Mark startMark, Mark endMark) {
- super(startMark, endMark);
- }
- @Override
- public ID getTokenId() {
- return ID.Whitespace;
- }
+ public WhitespaceToken(Mark startMark, Mark endMark) {
+ super(startMark, endMark);
+ }
+
+ @Override
+ public ID getTokenId() {
+ return ID.Whitespace;
+ }
}