havCSON v0.7.0 Released

November 29, 2026 · · 3 min read

Today I'm releasing version 0.7.0 of havCSON. Two days ago I wrote that the original CSON library for JavaScript accepts some CSON that havCSON rejects or reads differently. That's no longer the case: havCSON now reads CSON the same way the original library does.

To get there I replaced the reading code of the library. The original library reads CSON with the CoffeeScript compiler, so havCSON now follows the steps of that compiler. Both parsers of havCSON share this one reader. Before, the plain parser and the lossless parser were separate code and could disagree about the same file. Now they can't.

A lot of CSON that used to be an error is read now: tabs as indentation, strings between triple single quotes, strings that run over several lines, hexadecimal, binary and octal numbers, yes, no, on and off, block comments and more. Simple calculations work too, so timeout: 60 * 1000 gives 60000.

The other direction matters just as much if you update. Some CSON that earlier versions read is rejected now, because the original library rejects it. A word without quotes is no longer a string, so name: Havoc has to become name: 'Havoc'. An empty file is an error and an array needs its closing bracket. Strings between triple quotes are still read, but their value can change: the indentation their lines share and the line breaks next to the quotes are no longer part of the string. That also applies to strings with line breaks that havCSON saved before version 0.6.1, because it wrote them between triple quotes back then.

A few things stay different on purpose. The original library keeps the last value when a key appears twice in an object, while havCSON reports an error. The README lists the other exceptions. Apart from those, the two libraries agreed on everything in my tests.

Changelog (v0.7.0)
  • Changed reading to work the same way as in the original CSON library for JavaScript. Both parsers share one reader, so they always agree
  • Added reading of strings between triple single quotes, strings that run over several lines, tabs as indentation, hexadecimal, binary and octal numbers, numbers that start with a dot, "yes", "no", "on" and "off", the escapes for a byte in hexadecimal, a code point in braces, backspace, form feed, vertical tab and the null character, block comments between "###", semicolons, and keys that are numbers or contain "$" or letters outside ASCII
  • Added operators on numbers, "+" on two strings and parentheses. They are computed while reading
  • Changed strings between triple quotes. The indentation their lines share and the line breaks next to the quotes are no longer part of the string, and escapes are read
  • Changed what is rejected to what the original library rejects: words without quotes as values, an empty document, an array without its closing bracket, a comma after a value that stands on the lines below its key, a plus sign before a number, numbers such as "5." and "1E3", "#{" between double quotes, and a carriage return alone as a line break
  • Added ErrorCode::Unsupported for CSON that the original library reads and havCSON rejects on purpose, such as operators on mixed types. Removed ErrorCode::InvalidIndentChar
  • Changed ParseOptions::maxDepth to count parentheses as well
  • Fixed slow reading of nested arrays and objects with MSVC, where a growing array copied its elements. A Value is now moved without throwing
  • Reduced the stack that each level of nesting needs
  • Fixed two warnings that GCC reports with -Wsign-conversion