Add support for newline separated SNBTs#1
Open
Taskeren wants to merge 6 commits into
Open
Conversation
Glavo
reviewed
Jun 2, 2026
Member
Glavo
left a comment
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
已将具体审查建议标注在对应代码行。
Glavo
reviewed
Jun 3, 2026
Member
Glavo
left a comment
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
已将具体审查建议标注在对应代码行。
| Token peekToken(boolean tokenizeNewLine) { | ||
| // nullability of lookaheadNewLineParam is same to lookahead. | ||
| assert (lookahead == null) == (lookaheadNewLineParam == null); | ||
| if (lookahead == null || tokenizeNewLine != lookaheadNewLineParam) { |
Member
There was a problem hiding this comment.
本审查建议由 GPT-5 生成
[P1] peekToken(boolean) 在 tokenizeNewLine 参数变化时直接重新调用 readNextToken(tokenizeNewLine),但此时 cursor 已经被上一次 peek 推进了,不能重新读取同一个 token。当前新增测试里的 str_dict 就会触发:解析 a: foo\nb: bar 时,nextTag() 为了检查 foo(...) 调用 peekToken(false),跳过换行并把 b 缓存在 lookahead,同时 cursor 已在 b 后面;随后 compound separator 调用 peekToken(true),这段代码从 b 后继续读,得到的是 COLON,最终抛出 Unexpected token: COLON。结果是启用 allowNewLineAsSeparator 后,包含未加引号字符串值的 newline-separated SNBT 仍然无法读取,并且 PR 新增的 SNBTCodecTest.testNewLineSeparatedSNBT 应该会失败。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FTB-Library splits the compounds and lists with
\n, and this PR adds the support for it.New-lines will only be tokenized when
allowNewLineAsSeparator = true, and in the context of reading compounds and lists.applied_energistics.snbt is obtained from the modpack Star Technology, which is licensed under MIT.Removed@Glavo