Support ignore comments on reading

Issue #77 resolved
James Powell repo owner created an issue

Accept (as equivalent to whitespace) comments, similar to JSON5/HJSON.

Subissues: need to deal with reuse of whitespace in updating values.

Comments (8)

  1. James Powell 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?

  2. James Powell 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.

  3. James Powell 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 #79 on teh Pretty Print.

  4. James Powell 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 /*…

  5. Log in to comment