Replies: 1 comment
-
I think this will be addressed by #75 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I've been spending a bit of time writing an (incomplete) Kotlin implementation of KDL (with serialization support), and I really like how clear/readable it is to work with!
I do have a slight concern about the way that comments are supposed to be handled - I believe the current spec prioritizes identifiers over the comment syntax so that
/*identifier
(unless a corresponding*/
appears later in the file),ident/**/ifier
,identi//fier
(etc.) are all valid nodes (please correct me if I am mistaken!).Currently, my tokenizer always prioritizes the single/multiline comment syntax at any point except during a string. When processing an identifier, the program isn't sure whether it is a value/keyword/identifier until it finds the end, at which point it would be less efficient to backtrace and remove a comment block that has just been discovered (i.e. in the first example above). I would like to avoid doing that if possible, as I'm trying to enable partial parsing of large files - so that nodes can be skipped or functions can do an early return before the entire document has been read.
Additionally, from a user perspective, I feel like this could create some weird cases when inserting comments in/after properties - for example,
node null//=true TODO: make this false maybe?
might seenull//=true
as a property and then fail to parse the following comment. Especially when debugging, I imagine users that don't know about the/-
syntax (I'd never seen it before!) could try to comment the rest of the node without a preceding space and run into these problems. (e.g.node// property=0
)Since string identifiers do exist (although I have yet to add them in my implementation!), I'm interested in your thoughts on making them a requirement for using any comment syntax within an identifier, i.e.
"iden/*tifier"=0
, and simply allowing comments anywhere else in the document.Beta Was this translation helpful? Give feedback.
All reactions