diff options
author | Andrey Somov <public.somov@gmail.com> | 2022-01-25 09:19:59 +0400 |
---|---|---|
committer | Andrey Somov <public.somov@gmail.com> | 2022-01-25 09:32:04 +0400 |
commit | 644caef4c264c7e3abdf5618f9ef823a7277a597 (patch) | |
tree | de218cbd7c0d402421ff52381d7cb64ede0f87a0 /src/main/java/org/yaml/snakeyaml | |
parent | 1c4eba0534b8c4b1c293dc84c358e3be3523305f (diff) | |
download | snakeyaml-644caef4c264c7e3abdf5618f9ef823a7277a597.tar.gz |
Improve Javadoc
Diffstat (limited to 'src/main/java/org/yaml/snakeyaml')
-rw-r--r-- | src/main/java/org/yaml/snakeyaml/scanner/Scanner.java | 11 | ||||
-rw-r--r-- | src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java | 13 |
2 files changed, 8 insertions, 16 deletions
diff --git a/src/main/java/org/yaml/snakeyaml/scanner/Scanner.java b/src/main/java/org/yaml/snakeyaml/scanner/Scanner.java index cf31bafd..395dc7cb 100644 --- a/src/main/java/org/yaml/snakeyaml/scanner/Scanner.java +++ b/src/main/java/org/yaml/snakeyaml/scanner/Scanner.java @@ -33,10 +33,9 @@ public interface Scanner { * Check if the next token is one of the given types. * * @param choices - * token IDs. - * @return <code>true</code> if the next token can be assigned to a variable - * of at least one of the given types. Returns <code>false</code> if - * no more tokens are available. + * token IDs to match with + * @return <code>true</code> if the next token is one of the given types. + * Returns <code>false</code> if no more tokens are available. * @throws ScannerException * Thrown in case of malformed input. */ @@ -44,7 +43,6 @@ public interface Scanner { /** * Return the next token, but do not delete it from the stream. - * The method must be called only after {@link #checkToken}. * * @return The token that will be returned on the next call to {@link #getToken} * @throws ScannerException Thrown in case of malformed input. @@ -56,7 +54,8 @@ public interface Scanner { * Returns the next token. * <p> * The token will be removed from the stream. - * (Every invocation of this method must happen after calling {@link #checkToken}. + * (Every invocation of this method must happen after calling either {@link #checkToken} + * or {@link #peekToken()} * </p> * * @return the coming token diff --git a/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java b/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java index 59d63cb2..d6299b6d 100644 --- a/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java +++ b/src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java @@ -162,8 +162,7 @@ public final class ScannerImpl implements Scanner { // Had we reached the end of the stream? private boolean done = false; - // The number of unclosed '{' and '['. `flow_level == 0` means block - // context. + // The number of unclosed '{' and '['. `flow_level == 0` means block context. private int flowLevel = 0; // List of processed tokens that are not yet emitted. @@ -172,7 +171,7 @@ public final class ScannerImpl implements Scanner { // The last added token private Token lastToken; - // Number of tokens that were emitted through the `get_token` method. + // Number of tokens that were emitted through the `getToken()` method. private int tokensTaken = 0; // The current indentation level. @@ -212,7 +211,7 @@ public final class ScannerImpl implements Scanner { /* * Keep track of possible simple keys. This is a dictionary. The key is - * `flow_level`; there can be no more that one possible simple key for each + * `flow_level`; there can be no more than one possible simple key for each * level. The value is a SimpleKey record: (token_number, required, index, * line, column, mark) A simple key may start with ALIAS, ANCHOR, TAG, * SCALAR(flow), '[', or '{' tokens. @@ -2357,12 +2356,6 @@ public final class ScannerImpl implements Scanner { * </pre> */ private String scanLineBreak() { - // Transforms: - // '\r\n' : '\n' - // '\r' : '\n' - // '\n' : '\n' - // '\x85' : '\n' - // default : '' int c = reader.peek(); if (c == '\r' || c == '\n' || c == '\u0085') { if (c == '\r' && '\n' == reader.peek(1)) { |