Add kParseCommentsFlag documentation

This commit is contained in:
Milo Yip 2015-10-22 10:58:58 +08:00
parent 54eb069f06
commit 76d729e9c0
4 changed files with 6 additions and 0 deletions

View File

@ -115,6 +115,7 @@ Parse flags | Meaning
`kParseIterativeFlag` | Iterative(constant complexity in terms of function call stack size) parsing.
`kParseStopWhenDoneFlag` | After parsing a complete JSON root from stream, stop further processing the rest of stream. When this flag is used, parser will not generate `kParseErrorDocumentRootNotSingular` error. Using this flag for parsing multiple JSONs in the same stream.
`kParseFullPrecisionFlag` | Parse number in full precision (slower). If this flag is not set, the normal precision (faster) is used. Normal precision has maximum 3 [ULP](http://en.wikipedia.org/wiki/Unit_in_the_last_place) error.
`kParseCommentsFlag` | Allow one-line `// ...` and multi-line `/* ... */` comments (relaxed JSON syntax).
By using a non-type template parameter, instead of a function parameter, C++ compiler can generate code which is optimized for specified combinations, improving speed, and reducing code size (if only using a single specialization). The downside is the flags needed to be determined in compile-time.

View File

@ -115,6 +115,7 @@ GenericDocument& GenericDocument::Parse(const Ch* str);
`kParseIterativeFlag` | 迭代式(调用堆栈大小为常数复杂度)解析。
`kParseStopWhenDoneFlag` | 当从流解析了一个完整的JSON根节点之后停止继续处理余下的流。当使用了此标志解析器便不会产生`kParseErrorDocumentRootNotSingular`错误。可使用本标志去解析同一个流里的多个JSON。
`kParseFullPrecisionFlag` | 使用完整的精确度去解析数字较慢。如不设置此标节则会使用正常的精确度较快。正常精确度会有最多3个[ULP](http://en.wikipedia.org/wiki/Unit_in_the_last_place)的误差。
`kParseCommentsFlag` | 容许单行 `// ...` 及多行 `/* ... */` 注释放宽的JSON语法
由于使用了非类型模板参数而不是函数参数C++编译器能为个别组合生成代码,以改善性能及减少代码尺寸(当只用单种特化)。缺点是需要在编译期决定标志。

View File

@ -23,6 +23,8 @@
* Support Unicode surrogate.
* Support null character (`"\u0000"`)
* For example, `["Hello\u0000World"]` can be parsed and handled gracefully. There is API for getting/setting lengths of string.
* Support optional relaxed syntax.
* Single line (`// ...`) and multiple line (`/* ... */`) comments.
## Unicode

View File

@ -23,6 +23,8 @@
* 支持Unicod代理对surrogate pair
* 支持空字符(`"\u0000"`)。
* 例如,可以优雅地解析及处理`["Hello\u0000World"]`。含读写字符串长度的API。
* 支持放宽的可选语法
* 单行(`// ...`)及多行(`/* ... */` 注释。
## Unicode