Support ignore comments on reading
Accept (as equivalent to whitespace) comments, similar to JSON5/HJSON.
Subissues: need to deal with reuse of whitespace in updating values.
Comments (8)
-
reporter -
reporter Big problem: Delete.vi requires reverse parsing back to the preceding comma, when the object is the last item in an array/object. Comments, which can contain commas, are not easily parsed backwards!
Consider this possibility:
[ 1, 2, //3, //Don't do three, as it is not needed 4]
Given a deletion offset at the 4, how do we reverse parse to the comma after the 2?
-
reporter Need to modify “Find” functions to include location of previous comma (-1 if no comma), so we avoid parsing. Note that this excludes ever having Delete-by-Offset, but that is minor.
-
reporter Changed how Delete works (so Find functions return “Start Offset” where delete can start from). f67b7295185275fdd7095a3c5d9ce26a09ac0c60
-
reporter Problem:. New line can be LF or CR or both.
-
reporter Further New Line problem: Pretty Print uses Carriage Return (CR \r) and not Line Feed (LF \n)!
Windows is CR LF
Linux uses LF
Old Macs used to use CR (long gone)
https://blog.codinghorror.com/the-great-newline-schism/
HJSON, in defining //-style comments, uses LF (and ignore CR)
JSON5 follows ecma in allowing both CR and LF, and treats CRLF as one character: https://262.ecma-international.org/5.1/#sec-7.3
LabVIEW seems to display both CRLF and LFCR as single new lines
Start Issue
#79on teh Pretty Print. -
reporter Had to modify “Advanc past number” to accept comments after the number (123//… or 123/*…) else the non-standard character threw an error. Could really have just allowed any non-number character (similar to how existing code accepts [ ]//, null//, etc., as only numbers have no defined end) but this is a bigger change. So just accept //… or /*…
-
reporter - changed status to resolved
1.5.3
- Log in to comment
Added support for comments in /*Inline or Multiline Comment*/ and //Comment till end of line.
Changed the “Set” functions to reuse only strict whitespace (so they don’t partially overwrite a comment and corrupt the JSON).
748981a8b4ad0009ece3e4e7845f0b6c413a3adf