Skip to content

Commit f48fb78

Browse files
committed
Internal API notes.
1 parent 103552b commit f48fb78

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/co/casterlabs/rakurai/json/lex/JsonParser.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ public static JsonElement parse(char[] json) {
3333
return parsed;
3434
}
3535

36+
/**
37+
* Consumes the next token from the queue and parses it into a JsonElement. This
38+
* method is recursive and will call itself when parsing nested structures
39+
* (objects and arrays).
40+
*
41+
* When done, the queue may contain tokens that were not consumed during
42+
* parsing.
43+
*
44+
* For example, when parsing an object, the method will consume tokens until it
45+
* finds the closing brace, but it will not consume any tokens that come after
46+
* the closing brace. The caller is responsible for ensuring that the queue
47+
* contains the correct tokens for parsing and for handling any remaining tokens
48+
* after parsing is complete.
49+
*/
3650
private static JsonElement parseTokens(Queue<JsonToken> tokens) {
3751
JsonToken token = tokens.remove();
3852
switch (token.type) {

0 commit comments

Comments
 (0)