public final class ScannerImpl extends java.lang.Object implements Scanner
Scanner produces tokens of the following types: STREAM-START STREAM-END COMMENT DIRECTIVE(name, value) DOCUMENT-START DOCUMENT-END BLOCK-SEQUENCE-START BLOCK-MAPPING-START BLOCK-END FLOW-SEQUENCE-START FLOW-MAPPING-START FLOW-SEQUENCE-END FLOW-MAPPING-END BLOCK-ENTRY FLOW-ENTRY KEY VALUE ALIAS(value) ANCHOR(value) TAG(value) SCALAR(value, plain, style) Read comments in the Scanner code for more details.
Modifier and Type | Field and Description |
---|---|
static java.util.Map<java.lang.Character,java.lang.Integer> |
ESCAPE_CODES
A mapping from a character to a number of bytes to read-ahead for that escape sequence.
|
static java.util.Map<java.lang.Character,java.lang.String> |
ESCAPE_REPLACEMENTS
A mapping from an escaped character in the input stream to the string representation that they
should be replaced with.
|
Constructor and Description |
---|
ScannerImpl(StreamReader reader) |
ScannerImpl(StreamReader reader,
LoaderOptions options) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkToken(Token.ID... choices)
Check whether the next token is one of the given types.
|
Token |
getToken()
Return the next token, removing it from the queue.
|
boolean |
isParseComments()
Deprecated.
|
Token |
peekToken()
Return the next token, but do not delete it from the queue.
|
ScannerImpl |
setParseComments(boolean parseComments)
Deprecated.
|
public static final java.util.Map<java.lang.Character,java.lang.String> ESCAPE_REPLACEMENTS
public static final java.util.Map<java.lang.Character,java.lang.Integer> ESCAPE_CODES
\xHH : escaped 8-bit Unicode character \uHHHH : escaped 16-bit Unicode character \UHHHHHHHH : escaped 32-bit Unicode character
public ScannerImpl(StreamReader reader)
public ScannerImpl(StreamReader reader, LoaderOptions options)
@Deprecated public ScannerImpl setParseComments(boolean parseComments)
CommentToken
.parseComments
- true
to parse; false
to ignore@Deprecated public boolean isParseComments()
public boolean checkToken(Token.ID... choices)
checkToken
in interface Scanner
choices
- token IDs to match withtrue
if the next token is one of the given types. Returns
false
if no more tokens are available.public Token peekToken()
peekToken
in interface Scanner
Scanner.getToken()
Copyright © 2008–2023. All rights reserved.