-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate parsing from writing in node constructors #165
Conversation
- isDotted was true for non-dotted keys, causing empty keys - lineNo was included in key comparison, breaking table insertion - Pretty print output included whitespace - Pretty print output for tables only included the child table - Usages of TomlKey.toString were mixed between rawContent and content
Hmm
That was weird. Re-running them worked |
Small problem is that we need to merge the work related to Long/Int numbers first, let's take it also into the next release |
# Conflicts: # ktoml-core/src/commonMain/kotlin/com/akuleshov7/ktoml/decoders/TomlAbstractDecoder.kt # ktoml-core/src/commonMain/kotlin/com/akuleshov7/ktoml/parsers/TomlParser.kt # ktoml-core/src/commonMain/kotlin/com/akuleshov7/ktoml/tree/nodes/tables/TomlArrayOfTables.kt # ktoml-core/src/commonMain/kotlin/com/akuleshov7/ktoml/tree/nodes/tables/TomlTablePrimitive.kt
| - TomlKeyValuePrimitive (color=red) | ||
| - TomlKeyValuePrimitive (shape=round) | ||
| - TomlTablePrimitive ([fruit.physical]) | ||
| - TomlKeyValuePrimitive (color="red") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, why we did not have quotes here before? 🤔
// full name of the table (like a.b.c.d) | ||
public override lateinit var fullTableName: String | ||
|
||
init { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you moved this part of code to static method in TomlTable
- is done for some unification or some other ideas under the hood?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The former
ktoml-core/src/commonMain/kotlin/com/akuleshov7/ktoml/tree/nodes/pairs/keys/TomlKey.kt
Outdated
Show resolved
Hide resolved
*/ | ||
public sealed class TomlValue(public val lineNo: Int) { | ||
public sealed class TomlValue { | ||
@Deprecated(message = "lineNo is deprecated. Will be removed in next releases.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will argue on this. I still think that lineNo
is very important on the side of nodes.
For debug purposes and for the future usage. In good AST they always store it inside nodes... Actually this is the only real concern in this PR for me.
@NightEule5 why you do not like line number
here so much? :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I isolate this change in a separate PR at least related to TomlValue? At least not include in this big PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after looking more into the code, I understood your pain.
Yes, we can really remove lineNo from TomlKey and TomlValue: but anyway we should keep it on KeyValue and Table level, it's very important...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we can add it back. I just thought it's only used in the parsing process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, but the only real concern I have here is related to lineNo
Fixes #160