@@ -11,35 +11,45 @@ CESON is mostly like JSON, but:
11
11
the ECMAScript spec, to avoid problems with Unicode line terminators.
12
12
* For increased compatibility, outside of values, CESON parsers should
13
13
ignore characters that are whitespace in JSON but not in ECMAScript.
14
- * CESON defines ` simplespace ` as any combination of ` \t \r\n `
15
- (U+:TODO:).
14
+ * CESON defines "simplespace" as any combination of ` \t \r\n `
15
+ (U+0009, U+0020, U+000D, U+000A).
16
+ * A "blank line" is a line that consists entirely of an optional BOM
17
+ (only valid if it's the first line) and optional simplespace.
18
+ * More definitions:
19
+ * "Line text" is the minimal continuous substring of a line that precludes
20
+ it from being a blank line. (Everything except first line BOM, leading
21
+ and trailing simplespace.) Blank lines don't have line text.
22
+ * A "container head" is any bracket character that, in JSON, could mark
23
+ the start of a data container. (At time of writing: ` [ ` and ` { ` )
24
+ A "container tail" is any bracket character that, in JSON, could mark
25
+ the end of a data container. (At time of writing: ` ] ` and ` } ` )
16
26
* Line comments and block comments work as in ECMAScript, but with some
17
27
restrictions for easier parsing.
18
- * In the line where a comment starts, in front of that comment,
19
- the only acceptable characters are:
20
- * simplespace
21
- * byte order marks (so you don't have to care whether they are whitespace)
22
- * commas and
23
- * opening brackets that, in JSON, could open a data container.
24
- * In the line where a block comment ends, any remainder of that line may
25
- only consist of
26
- * simplespace
27
- * commas and
28
- * closing brackets that, in JSON, could close a data container.
28
+ * In lines where a comment starts, line text in front of that line's
29
+ first comment is restricted to any combination of simplespace, commas,
30
+ and container heads.
31
+ * The end of each block comment can be followed by optional simplespace,
32
+ after which it must be followed by either:
33
+ * end of line (comment is the last part of line text), or
34
+ * start of another block comment, or
35
+ * any combination of simplespace, commas, and container tails.
29
36
* You can continue a string in a new line by adding its parts with the plus
30
37
operator (` + ` ).
31
- * Except for simplespace and byte order marks, the plus sign has to be
32
- at the start or end of a line. A line can have plus signs on both sides.
33
- * Whitespace after the plus sign is allowed only if that whitespace is
34
- followed by a string part.
35
- * The validity and effect of commas at the end of data containers is
36
- inherited from ECMAScript.
38
+ * The plus sign has to be at the start or end of line text.
39
+ A line can have plus signs on both sides of its line text.
40
+ * Commas at the end of data containers, inside them:
41
+ * A comma at the end of line text has no effect if the next line text
42
+ starts with a container tail.
43
+ * For all other cases of commas at the end of data containers, their
44
+ validity and effect is inherited from ECMAScript.
45
+
37
46
38
47
39
48
Related projects
40
49
================
50
+
41
51
* [ JSONv5] ( http://json5.org/ ) : A lot more flexible, and thus a lot harder
42
- to safely handle with low-level tools like ` sed ` .
52
+ to safely handle with low-level tools like [ sed] ( http://sed.sf.net/ ) .
43
53
* [ strip-json-comments] ( https://github.com/sindresorhus/strip-json-comments )
44
54
45
55
0 commit comments