diff --git a/CHANGELOG.md b/CHANGELOG.md index cc087e2..9132d3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# [3.3.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.2.0...v3.3.0) (2020-08-13) + + +### Bug Fixes + +* Empty version files ([091fdfc](https://github.com/TriPSs/conventional-changelog-action/commit/091fdfc6a55a151e3adff5ada382986ead85d58e)) +* Message when using the fallback version ([b525f9a](https://github.com/TriPSs/conventional-changelog-action/commit/b525f9ae66cb03aa2a58cd043963504b911bac31)) +* Pull all tags ([3396dfc](https://github.com/TriPSs/conventional-changelog-action/commit/3396dfc4323e48de090308fff522ef4c557f73e5)) +* Show info if the version couldn't be detected ([9a324db](https://github.com/TriPSs/conventional-changelog-action/commit/9a324dbd51d0d32c1b9df1a291e14cc20a5bbaff)) +* Use fallback if it's not a valid JSON-File ([97f1bb3](https://github.com/TriPSs/conventional-changelog-action/commit/97f1bb3543e6f2480ef3e699fc695ecb8b3f881b)) + + +### Features + +* Add fallback version ([63d0e46](https://github.com/TriPSs/conventional-changelog-action/commit/63d0e46a0b69e3db3f7a5f44e963323afc35d29c)) + + + # [3.2.0](https://github.com/TriPSs/conventional-changelog-action/compare/v3.1.2...v3.2.0) (2020-08-03) @@ -42,27 +60,3 @@ -# [3.0.0](https://github.com/TriPSs/conventional-changelog-action/compare/v2.4.0...v3.0.0) (2020-07-03) - - -### Documentation - -* Updated README ([000434c](https://github.com/TriPSs/conventional-changelog-action/commit/000434c4469403159c004a4ed0f5715a06f80448)) - - -### Features - -* Added skip commit and skip tag ([3eab241](https://github.com/TriPSs/conventional-changelog-action/commit/3eab2417f9b3e1db3d630b6ec1820106da9a21a9)) -* Added support for toml files ([5aff23f](https://github.com/TriPSs/conventional-changelog-action/commit/5aff23f51411f417adf6ea22364d158d335a5fce)) -* Added support for yaml files ([bdf8ec0](https://github.com/TriPSs/conventional-changelog-action/commit/bdf8ec04e6f0d493ef859df06ffbeecb1f47a970)) -* Added version-file, version-path, skip-version-file options ([d022b0d](https://github.com/TriPSs/conventional-changelog-action/commit/d022b0d7e98b6b13ce0af3e6c44a550256b0ca59)) -* Added versioning through GIT ([7143306](https://github.com/TriPSs/conventional-changelog-action/commit/714330612535ae25eb483d0f24fb2fe0c091dc86)) -* More git configurations are possible ([9ee9c27](https://github.com/TriPSs/conventional-changelog-action/commit/9ee9c274488b9013bf3dd5e5a1f9af3345901f7e)) - - -### BREAKING CHANGES - -* `package-json` is now renamed to `version-file` - - - diff --git a/node_modules/@iarna/toml/CHANGELOG.md b/node_modules/@iarna/toml/CHANGELOG.md new file mode 100755 index 0000000..21964f9 --- /dev/null +++ b/node_modules/@iarna/toml/CHANGELOG.md @@ -0,0 +1,278 @@ +# 2.2.5 + +* Docs: Updated benchmark results. Add fast-toml to result list. Improved benchmark layout. +* Update @sgarciac/bombadil and @ltd/j-toml in benchmarks and compliance tests. +* Dev: Some dev dep updates that shouldn't have any impact. + +# 2.2.4 + +* Bug fix: Plain date literals (not datetime) immediately followed by another statement (no whitespace or blank line) would crash. Fixes [#19](https://github.com/iarna/iarna-toml/issues/19) and [#23](https://github.com/iarna/iarna-toml/issues/23), thank you [@arnau](https://github.com/arnau) and [@jschaf](https://github.com/jschaf) for reporting this! +* Bug fix: Hex literals with lowercase Es would throw errors. (Thank you [@DaeCatt](https://github.com/DaeCatt) for this fix!) Fixed [#20](https://github.com/iarna/iarna-toml/issues/20) +* Some minor doc tweaks +* Added Node 12 and 13 to Travis. (Node 6 is failing there now, mysteriously. It works on my machine™, shipping anyway. 🙃) + +# 2.2.3 + +This release just updates the spec compliance tests and benchmark data to +better represent @ltd/j-toml. + +# 2.2.2 + +## Fixes + +* Support parsing and stringifying objects with `__proto__` properties. ([@LongTengDao](https://github.com/LongTengDao)) + +## Misc + +* Updates for spec compliance and benchmarking: + * @sgarciac/bombadil -> 2.1.0 + * toml -> 3.0.0 +* Added spec compliance and benchmarking for: + * @ltd/j-toml + +# 2.2.1 + +## Fixes + +* Fix bug where keys with names matching javascript Object methods would + error. Thanks [@LongTengDao](https://github.com/LongTengDao) for finding this! +* Fix bug where a bundled version would fail if `util.inspect` wasn't + provided. This was supposed to be guarded against, but there was a bug in + the guard. Thanks [@agriffis](https://github.com/agriffis) for finding and fixing this! + +## Misc + +* Update the version of bombadil for spec compliance and benchmarking purposes to 2.0.0 + +## Did you know? + +Node 6 and 8 are measurably slower than Node 6, 10 and 11, at least when it comes to parsing TOML! + +![](https://pbs.twimg.com/media/DtDeVjmU4AE5apz.jpg) + +# 2.2.0 + +## Features + +* Typescript: Lots of improvements to our type definitions, many many to + [@jorgegonzalez](https://github.com/jorgegonzalez) and [@momocow](https://github.com/momocow) for working through these. + +## Fixes + +* Very large integers (>52bit) are stored as BigInts on runtimes that + support them. BigInts are 128bits, but the TOML spec limits its integers + to 64bits. We now limit our integers to 64bits + as well. +* Fix a bug in stringify where control characters were being emitted as unicode chars and not escape sequences. + +## Misc + +* Moved our spec tests out to an external repo +* Improved the styling of the spec compliance comparison + +# 2.1.1 + +## Fixes + +* Oops, type defs didn't end up in the tarball, ty [@jorgegonzalez](https://github.com/jorgegonzalez)‼ + +# 2.1.0 + +## Features + +* Types for typescript support, thank you [@momocow](https://github.com/momocow)! + +## Fixes + +* stringify: always strip invalid dates. This fixes a bug where an + invalid date in an inline array would not be removed and would instead + result in an error. +* stringify: if an invalid type is found make sure it's thrown as an + error object. Previously the type name was, unhelpfully, being thrown. +* stringify: Multiline strings ending in a quote would generate invalid TOML. +* parse: Error if a signed integer has a leading zero, eg, `-01` or `+01`. +* parse: Error if \_ appears at the end of the integer part of a float, eg `1_.0`. \_ is only valid between _digits_. + +## Fun + +* BurntSushi's comprehensive TOML 0.4.0 test suite is now used in addition to our existing test suite. +* You can see exactly how the other JS TOML libraries stack up in testing + against both BurntSushi's tests and my own in the new + [TOML-SPEC-SUPPORT](TOML-SPEC-SUPPORT.md) doc. + +# 2.0.0 + +With 2.0.0, @iarna/toml supports the TOML v0.5.0 specification. TOML 0.5.0 +brings some changes: + +* Delete characters (U+007F) are not allowed in plain strings. You can include them with + escaped unicode characters, eg `\u007f`. +* Integers are specified as being 64bit unsigned values. These are + supported using `BigInt`s if you are using Node 10 or later. +* Keys may be literal strings, that is, you can use single quoted strings to + quote key names, so the following is now valid: + 'a"b"c' = 123 +* The floating point values `nan`, `inf` and `-inf` are supported. The stringifier will no + longer strip NaN, Infinity and -Infinity, instead serializing them as these new values.. +* Datetimes can separate the date and time with a space instead of a T, so + `2017-12-01T00:00:00Z` can be written as `2017-12-01 00:00:00Z`. +* Datetimes can be floating, that is, they can be represented without a timezone. + These are represented in javascript as Date objects whose `isFloating` property is true and + whose `toISOString` method will return a representation without a timezone. +* Dates without times are now supported. Dates do not have timezones. Dates + are represented in javascript as a Date object whose `isDate` property is true and + whose `toISOString` method returns just the date. +* Times without dates are now supported. Times do not have timezones. Times + are represented in javascript as a Date object whose `isTime` property is true and + whose `toISOString` method returns just the time. +* Keys can now include dots to directly address deeper structures, so `a.b = 23` is + the equivalent of `a = {b = 23}` or ```[a] +b = 23```. These can be used both as keys to regular tables and inline tables. +* Integers can now be specified in binary, octal and hexadecimal by prefixing the + number with `0b`, `0o` and `0x` respectively. It is now illegal to left + pad a decimal value with zeros. + +Some parser details were also fixed: + +* Negative zero (`-0.0`) and positive zero (`0.0`) are distinct floating point values. +* Negative integer zero (`-0`) is not distinguished from positive zero (`0`). + +# 1.7.1 + +Another 18% speed boost on our overall benchmarks! This time it came from +switching from string comparisons to integer by converting each character to +its respective code point. This also necessitated rewriting the boolean +parser to actually parse character-by-character as it should. End-of-stream +is now marked with a numeric value outside of the Unicode range, rather than +a Symbol, meaning that the parser's char property is now monomorphic. + +Bug fix, previously, `'abc''def'''` was accepted (as the value: `abcdef`). +Now it will correctly raise an error. + +Spec tests now run against bombadil as well (it fails some, which is unsurprising +given its incomplete state). + +# 1.7.0 + +This release features an overall 15% speed boost on our benchmarks. This +came from a few things: + +* Date parsing was rewritten to not use regexps, resulting in a huge speed increase. +* Strings of all kinds and bare keywords now use tight loops to collect characters when this will help. +* Regexps in general were mostly removed. This didn't result in a speed + change, but it did allow refactoring the parser to be a lot easier to + follow. +* The internal state tracking now uses a class and is constructed with a + fixed set of properties, allowing v8's optimizer to be more effective. + +In the land of new features: + +* Errors in the syntax of your TOML will now have the `fromTOML` property + set to true. This is in addition to the `line`, `col` and `pos` + properties they already have. + + The main use of this is to make it possible to distinguish between errors + in the TOML and errors in the parser code itself. This is of particular utility + when testing parse errors. + +# 1.6.0 + +**FIXES** + +* TOML.stringify: Allow toJSON properties that aren't functions, to align with JSON.stringify's behavior. +* TOML.stringify: Don't use ever render keys as literal strings. +* TOML.stringify: Don't try to escape control characters in literal strings. + +**FEATURES** + +* New Export: TOML.stringify.value, for encoding a stand alone inline value as TOML would. This produces + a TOML fragment, not a complete valid document. + +# 1.5.6 + +* String literals are NOT supported as key names. +* Accessing a shallower table after accessing it more deeply is ok and no longer crashes, eg: + ```toml + [a.b] + [a] + ``` +* Unicode characters in the reserved range now crash. +* Empty bare keys, eg `[.abc]` or `[]` now crash. +* Multiline backslash trimming supports CRs. +* Multiline post quote trimming supports CRs. +* Strings may not contain bare control chars (0x00-0x1f), except for \n, \r and \t. + +# 1.5.5 + +* Yet MORE README fixes. 🙃 + +# 1.5.4 + +* README fix + +# 1.5.3 + +* Benchmarks! +* More tests! +* More complete LICENSE information (some dev files are from other, MIT + licensed, projects, this is now more explicitly documented.) + +# 1.5.2 + +* parse: Arrays with mixed types now throw errors, per the spec. +* parse: Fix a parser bug that would result in errors when trying to parse arrays of numbers or dates + that were not separated by a space from the closing ]. +* parse: Fix a bug in the error pretty printer that resulted in errors on + the first line not getting the pretty print treatment. +* stringify: Fix long standing bug where an array of Numbers, some of which required + decimals, would be emitted in a way that parsers would treat as mixed + Integer and Float values. Now if any Numbers in an array must be + represented with a decimal then all will be emitted such that parsers will + understand them to be Float. + +# 1.5.1 + +* README fix + +# 1.5.0 + +* A brand new TOML parser, from scratch, that performs like `toml-j0.4` + without the crashes and with vastly better error messages. +* 100% test coverage for both the new parser and the existing stringifier. Some subtle bugs squashed! + +# v1.4.2 + +* Revert fallback due to its having issues with the same files. (New plan + will be to write my own.) + +# v1.4.1 + +* Depend on both `toml` and `toml-j0.4` with fallback from the latter to the + former when the latter crashes. + +# v1.4.0 + +* Ducktype dates to make them compatible with `moment` and other `Date` replacements. + +# v1.3.1 + +* Update docs with new toml module. + +# v1.3.0 + +* Switch from `toml` to `toml-j0.4`, which is between 20x and 200x faster. + (The larger the input, the faster it is compared to `toml`). + +# v1.2.0 + +* Return null when passed in null as the top level object. +* Detect and skip invalid dates and numbers + +# v1.1.0 + +* toJSON transformations are now honored (for everything except Date objects, as JSON represents them as strings). +* Undefined/null values no longer result in exceptions, they now just result in the associated key being elided. + +# v1.0.1 + +* Initial release diff --git a/node_modules/@iarna/toml/LICENSE b/node_modules/@iarna/toml/LICENSE new file mode 100755 index 0000000..51bcf57 --- /dev/null +++ b/node_modules/@iarna/toml/LICENSE @@ -0,0 +1,14 @@ +Copyright (c) 2016, Rebecca Turner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/@iarna/toml/README.md b/node_modules/@iarna/toml/README.md new file mode 100755 index 0000000..1958324 --- /dev/null +++ b/node_modules/@iarna/toml/README.md @@ -0,0 +1,301 @@ +# @iarna/toml + +Better TOML parsing and stringifying all in that familiar JSON interface. + +[![Coverage Status](https://coveralls.io/repos/github/iarna/iarna-toml/badge.svg)](https://coveralls.io/github/iarna/iarna-toml) + +# ** TOML 0.5.0 ** + +### TOML Spec Support + +The most recent version as of 2018-07-26: [v0.5.0](https://github.com/mojombo/toml/blob/master/versions/en/toml-v0.5.0.md) + +### Example + +```js +const TOML = require('@iarna/toml') +const obj = TOML.parse(`[abc] +foo = 123 +bar = [1,2,3]`) +/* obj = +{abc: {foo: 123, bar: [1,2,3]}} +*/ +const str = TOML.stringify(obj) +/* str = +[abc] +foo = 123 +bar = [ 1, 2, 3 ] +*/ +``` + +Visit the project github [for more examples](https://github.com/iarna/iarna-toml/tree/latest/examples)! + + +## Why @iarna/toml + +* See [TOML-SPEC-SUPPORT](https://shared.by.re-becca.org/misc/TOML-SPEC-SUPPORT.html) + for a comparison of which TOML features are supported by the various + Node.js TOML parsers. +* BigInt support on Node 10! +* 100% test coverage. +* Fast parsing. It's as much as 100 times + faster than `toml` and 3 times faster than `toml-j0.4`. However a recent + newcomer [`@ltd/j-toml`](https://www.npmjs.com/package/@ltd/j-toml) has + appeared with 0.5 support and astoundingly fast parsing speeds for large + text blocks. All I can say is you'll have to test your specific work loads + if you want to know which of @iarna/toml and @ltd/j-toml is faster for + you, as we currently excell in different areas. +* Careful adherence to spec. Tests go beyond simple coverage. +* Smallest parser bundle (if you use `@iarna/toml/parse-string`). +* No deps. +* Detailed and easy to read error messages‼ + +```console +> TOML.parse(src) +Error: Unexpected character, expecting string, number, datetime, boolean, inline array or inline table at row 6, col 5, pos 87: +5: "abc\"" = { abc=123,def="abc" } +6> foo=sdkfj + ^ +7: +``` + +## TOML.parse(str) → Object [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse.js) + +Also available with: `require('@iarna/toml/parse-string')` + +Synchronously parse a TOML string and return an object. + + +## TOML.stringify(obj) → String [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/stringify.js) + +Also available with: `require('@iarna/toml/stringify)` + +Serialize an object as TOML. + +## [your-object].toJSON + +If an object `TOML.stringify` is serializing has a `toJSON` method then it +will call it to transform the object before serializing it. This matches +the behavior of `JSON.stringify`. + +The one exception to this is that `toJSON` is not called for `Date` objects +because `JSON` represents dates as strings and TOML can represent them natively. + +[`moment`](https://www.npmjs.com/package/moment) objects are treated the +same as native `Date` objects, in this respect. + +## TOML.stringify.value(obj) -> String + +Also available with: `require('@iarna/toml/stringify').value` + +Serialize a value as TOML would. This is a fragment and not a complete +valid TOML document. + +## Promises and Streaming + +The parser provides alternative async and streaming interfaces, for times +that you're working with really absurdly big TOML files and don't want to +tie-up the event loop while it parses. + +### TOML.parse.async(str[, opts]) → Promise(Object) [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-async.js) + +Also available with: `require('@iarna/toml/parse-async')` + +`opts.blocksize` is the amount text to parser per pass through the event loop. Defaults to 40kb. + +Asynchronously parse a TOML string and return a promise of the resulting object. + +### TOML.parse.stream(readable) → Promise(Object) [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-stream-readable.js) + +Also available with: `require('@iarna/toml/parse-stream')` + +Given a readable stream, parse it as it feeds us data. Return a promise of the resulting object. + +### readable.pipe(TOML.parse.stream()) → Transform [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-stream-through.js) + +Also available with: `require('@iarna/toml/parse-stream')` + +Returns a transform stream in object mode. When it completes, emit the +resulting object. Only one object will ever be emitted. + +## Lowlevel Interface [(example)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-lowlevel.js) [(example w/ parser debugging)](https://github.com/iarna/iarna-toml/blob/latest/examples/parse-lowlevel-debug.js) + +You construct a parser object, per TOML file you want to process: + +```js +const TOMLParser = require('@iarna/toml/lib/toml-parser.js') +const parser = new TOMLParser() +``` + +Then you call the `parse` method for each chunk as you read them, or in a +single call: + +```js +parser.parse(`hello = 'world'`) +``` + +And finally, you call the `finish` method to complete parsing and retrieve +the resulting object. + +```js +const data = parser.finish() +``` + +Both the `parse` method and `finish` method will throw if they find a +problem with the string they were given. Error objects thrown from the +parser have `pos`, `line` and `col` attributes. `TOML.parse` adds a visual +summary of where in the source string there were issues using +`parse-pretty-error` and you can too: + +```js +const prettyError = require('./parse-pretty-error.js') +const newErr = prettyError(err, sourceString) +``` + +## What's Different + +Version 2 of this module supports TOML 0.5.0. Other modules currently +published to the npm registry support 0.4.0. 0.5.0 is mostly backwards +compatible with 0.4.0, but if you have need, you can install @iarna/toml@1 +to get a version of this module that supports 0.4.0. Please see the +[CHANGELOG](CHANGELOG.md#2.0.0) for details on exactly whats changed. + +## TOML we can't do + +* `-nan` is a valid TOML value and is converted into `NaN`. There is no way to + produce `-nan` when stringifying. Stringification will produce positive `nan`. +* Detecting and erroring on invalid utf8 documents: This is because Node's + UTF8 processing converts invalid sequences into the placeholder character + and does not have facilities for reporting these as errors instead. We + _can_ detect the placeholder character, but it's valid to intentionally + include them in documents, so erroring on them is not great. +* On versions of Node < 10, very large Integer values will lose precision. + On Node >=10, bigints are used. +* Floating/local dates and times are still represented by JavaScript Date + objects, which don't actually support these concepts. The objects + returned have been modified so that you can determine what kind of thing + they are (with `isFloating`, `isDate`, `isTime` properties) and that + their ISO representation (via `toISOString`) is representative of their + TOML value. They will correctly round trip if you pass them to + `TOML.stringify`. +* Binary, hexadecimal and octal values are converted to ordinary integers and + will be decimal if you stringify them. + +## Changes + +I write a by hand, honest-to-god, +[CHANGELOG](https://github.com/iarna/iarna-toml/blob/latest/CHANGELOG.md) +for this project. It's a description of what went into a release that you +the consumer of the module could care about, not a list of git commits, so +please check it out! + +## Benchmarks + +You can run them yourself with: + +```console +$ npm run benchmark +``` + +The results below are from my desktop using Node 13.13.0. The library +versions tested were `@iarna/toml@2.2.4`, `toml-j0.4@1.1.1`, `toml@3.0.0`, +`@sgarciac/bombadil@2.3.0`, `@ltd/j-toml@0.5.107`, and `fast-toml@0.5.4`. The speed value is +megabytes-per-second that the parser can process of that document type. +Bigger is better. The percentage after average results is the margin of error. + +New here is fast-toml. fast-toml is very fast, for some datatypes, but it +also is missing most error checking demanded by the spec. For 0.4, it is +complete except for detail of multiline strings caught by the compliance +tests. Its support for 0.5 is incomplete. Check out the +[spec compliance](https://shared.by.re-becca.org/misc/TOML-SPEC-SUPPORT.html) doc +for details. + +As this table is getting a little wide, with how npm and github display it, +you can also view it seperately in the +[BENCHMARK](https://shared.by.re-becca.org/misc/BENCHMARK.html) document. + +| | @iarna/toml | toml-j0.4 | toml | @sgarciac/bombadil | @ltd/j-toml | fast-toml | +| - | :---------: | :-------: | :--: | :----------------: | :---------: | :-------: | +| **Overall** | 28MB/sec
0.35% | 6.5MB/sec
0.25% | 0.2MB/sec
0.70% | - | 35MB/sec
0.23% | - | +| **Spec Example: v0.4.0** | 26MB/sec
0.37% | 10MB/sec
0.27% | 1MB/sec
0.42% | 1.2MB/sec
0.95% | 28MB/sec
0.31% | - | +| **Spec Example: Hard Unicode** | 64MB/sec
0.59% | 18MB/sec
0.12% | 2MB/sec
0.20% | 0.6MB/sec
0.53% | 68MB/sec
0.31% | 78MB/sec
0.28% | +| **Types: Array, Inline** | 7.3MB/sec
0.60% | 4MB/sec
0.16% | 0.1MB/sec
0.91% | 1.3MB/sec
0.81% | 10MB/sec
0.35% | 9MB/sec
0.16% | +| **Types: Array** | 6.8MB/sec
0.19% | 6.7MB/sec
0.15% | 0.2MB/sec
0.79% | 1.2MB/sec
0.93% | 8.8MB/sec
0.47% | 27MB/sec
0.21% | +| **Types: Boolean,** | 21MB/sec
0.20% | 9.4MB/sec
0.17% | 0.2MB/sec
0.96% | 1.8MB/sec
0.70% | 16MB/sec
0.20% | 8.4MB/sec
0.22% | +| **Types: Datetime** | 18MB/sec
0.14% | 11MB/sec
0.15% | 0.3MB/sec
0.85% | 1.6MB/sec
0.45% | 9.8MB/sec
0.48% | 6.5MB/sec
0.23% | +| **Types: Float** | 8.8MB/sec
0.09% | 5.9MB/sec
0.14% | 0.2MB/sec
0.51% | 2.1MB/sec
0.82% | 14MB/sec
0.15% | 7.9MB/sec
0.14% | +| **Types: Int** | 5.9MB/sec
0.11% | 4.5MB/sec
0.28% | 0.1MB/sec
0.78% | 1.5MB/sec
0.64% | 10MB/sec
0.14% | 8MB/sec
0.17% | +| **Types: Literal String, 7 char** | 26MB/sec
0.29% | 8.5MB/sec
0.32% | 0.3MB/sec
0.84% | 2.3MB/sec
1.02% | 23MB/sec
0.15% | 13MB/sec
0.15% | +| **Types: Literal String, 92 char** | 46MB/sec
0.19% | 11MB/sec
0.20% | 0.3MB/sec
0.56% | 12MB/sec
0.92% | 101MB/sec
0.17% | 75MB/sec
0.29% | +| **Types: Literal String, Multiline, 1079 char** | 22MB/sec
0.42% | 6.7MB/sec
0.55% | 0.9MB/sec
0.78% | 44MB/sec
1.00% | 350MB/sec
0.16% | 636MB/sec
0.16% | +| **Types: Basic String, 7 char** | 25MB/sec
0.15% | 7.3MB/sec
0.18% | 0.2MB/sec
0.96% | 2.2MB/sec
1.09% | 14MB/sec
0.16% | 12MB/sec
0.22% | +| **Types: Basic String, 92 char** | 43MB/sec
0.30% | 7.2MB/sec
0.16% | 0.1MB/sec
4.04% | 12MB/sec
1.33% | 71MB/sec
0.19% | 70MB/sec
0.23% | +| **Types: Basic String, 1079 char** | 24MB/sec
0.45% | 5.8MB/sec
0.17% | 0.1MB/sec
3.64% | 44MB/sec
1.05% | 93MB/sec
0.29% | 635MB/sec
0.28% | +| **Types: Table, Inline** | 9.7MB/sec
0.10% | 5.5MB/sec
0.22% | 0.1MB/sec
0.87% | 1.4MB/sec
1.18% | 8.7MB/sec
0.60% | 8.7MB/sec
0.22% | +| **Types: Table** | 7.1MB/sec
0.14% | 5.6MB/sec
0.42% | 0.1MB/sec
0.65% | 1.4MB/sec
1.11% | 7.4MB/sec
0.70% | 18MB/sec
0.20% | +| **Scaling: Array, Inline, 1000 elements** | 40MB/sec
0.21% | 2.4MB/sec
0.19% | 0.1MB/sec
0.35% | 1.6MB/sec
1.02% | 17MB/sec
0.15% | 32MB/sec
0.16% | +| **Scaling: Array, Nested, 1000 deep** | 2MB/sec
0.15% | 1.7MB/sec
0.26% | 0.3MB/sec
0.58% | - | 1.8MB/sec
0.74% | 13MB/sec
0.20% | +| **Scaling: Literal String, 40kb** | 61MB/sec
0.18% | 10MB/sec
0.15% | 3MB/sec
0.84% | 12MB/sec
0.51% | 551MB/sec
0.44% | 19kMB/sec
0.19% | +| **Scaling: Literal String, Multiline, 40kb** | 62MB/sec
0.16% | 5MB/sec
0.45% | 0.2MB/sec
1.70% | 11MB/sec
0.74% | 291MB/sec
0.24% | 21kMB/sec
0.22% | +| **Scaling: Basic String, Multiline, 40kb** | 62MB/sec
0.18% | 5.8MB/sec
0.38% | 2.9MB/sec
0.86% | 11MB/sec
0.41% | 949MB/sec
0.44% | 26kMB/sec
0.16% | +| **Scaling: Basic String, 40kb** | 59MB/sec
0.20% | 6.3MB/sec
0.17% | 0.2MB/sec
1.95% | 12MB/sec
0.44% | 508MB/sec
0.35% | 18kMB/sec
0.15% | +| **Scaling: Table, Inline, 1000 elements** | 28MB/sec
0.12% | 8.2MB/sec
0.19% | 0.3MB/sec
0.89% | 2.3MB/sec
1.14% | 5.3MB/sec
0.24% | 13MB/sec
0.20% | +| **Scaling: Table, Inline, Nested, 1000 deep** | 7.8MB/sec
0.28% | 5MB/sec
0.20% | 0.1MB/sec
0.84% | - | 3.2MB/sec
0.52% | 10MB/sec
0.23% | + +## Tests + +The test suite is maintained at 100% coverage: [![Coverage Status](https://coveralls.io/repos/github/iarna/iarna-toml/badge.svg)](https://coveralls.io/github/iarna/iarna-toml) + +The spec was carefully hand converted into a series of test framework +independent (and mostly language independent) assertions, as pairs of TOML +and YAML files. You can find those files here: +[spec-test](https://github.com/iarna/iarna-toml/blob/latest/test/spec-test/). +A number of examples of invalid Unicode were also written, but are difficult +to make use of in Node.js where Unicode errors are silently hidden. You can +find those here: [spec-test-disabled](https://github.com/iarna/iarna-toml/blob/latest/test/spec-test-disabled/). + +Further tests were written to increase coverage to 100%, these may be more +implementation specific, but they can be found in [coverage](https://github.com/iarna/iarna-toml/blob/latest/test/coverage.js) and +[coverage-error](https://github.com/iarna/iarna-toml/blob/latest/test/coverage-error.js). + +I've also written some quality assurance style tests, which don't contribute +to coverage but do cover scenarios that could easily be problematic for some +implementations can be found in: +[test/qa.js](https://github.com/iarna/iarna-toml/blob/latest/test/qa.js) and +[test/qa-error.js](https://github.com/iarna/iarna-toml/blob/latest/test/qa-error.js). + +All of the official example files from the TOML spec are run through this +parser and compared to the official YAML files when available. These files are from the TOML spec as of: +[357a4ba6](https://github.com/toml-lang/toml/tree/357a4ba6782e48ff26e646780bab11c90ed0a7bc) +and specifically are: + +* [github.com/toml-lang/toml/tree/357a4ba6/examples](https://github.com/toml-lang/toml/tree/357a4ba6782e48ff26e646780bab11c90ed0a7bc/examples) +* [github.com/toml-lang/toml/tree/357a4ba6/tests](https://github.com/toml-lang/toml/tree/357a4ba6782e48ff26e646780bab11c90ed0a7bc/tests) + +The stringifier is tested by round-tripping these same files, asserting that +`TOML.parse(sourcefile)` deepEqual +`TOML.parse(TOML.stringify(TOML.parse(sourcefile))`. This is done in +[test/roundtrip-examples.js](https://github.com/iarna/iarna-toml/blob/latest/test/round-tripping.js) +There are also some tests written to complete coverage from stringification in: +[test/stringify.js](https://github.com/iarna/iarna-toml/blob/latest/test/stringify.js) + +Tests for the async and streaming interfaces are in [test/async.js](https://github.com/iarna/iarna-toml/blob/latest/test/async.js) and [test/stream.js](https://github.com/iarna/iarna-toml/blob/latest/test/stream.js) respectively. + +Tests for the parsers debugging mode live in [test/devel.js](https://github.com/iarna/iarna-toml/blob/latest/test/devel.js). + +And finally, many more stringification tests were borrowed from [@othiym23](https://github.com/othiym23)'s +[toml-stream](https://npmjs.com/package/toml-stream) module. They were fetched as of +[b6f1e26b572d49742d49fa6a6d11524d003441fa](https://github.com/othiym23/toml-stream/tree/b6f1e26b572d49742d49fa6a6d11524d003441fa/test) and live in +[test/toml-stream](https://github.com/iarna/iarna-toml/blob/latest/test/toml-stream/). + +## Improvements to make + +* In stringify: + * Any way to produce comments. As a JSON stand-in I'm not too worried + about this. That said, a document orientated fork is something I'd like + to look at eventually… + * Stringification could use some work on its error reporting. It reports + _what's_ wrong, but not where in your data structure it was. +* Further optimize the parser: + * There are some debugging assertions left in the main parser, these should be moved to a subclass. + * Make the whole debugging parser thing work as a mixin instead of as a superclass. diff --git a/node_modules/@iarna/toml/index.d.ts b/node_modules/@iarna/toml/index.d.ts new file mode 100755 index 0000000..d37e2b6 --- /dev/null +++ b/node_modules/@iarna/toml/index.d.ts @@ -0,0 +1,57 @@ +import { Transform } from "stream"; + +type JsonArray = boolean[] | number[] | string[] | JsonMap[] | Date[] +type AnyJson = boolean | number | string | JsonMap | Date | JsonArray | JsonArray[] + +interface JsonMap { + [key: string]: AnyJson; +} + +interface ParseOptions { + /** + * The amount text to parser per pass through the event loop. Defaults to 40kb (`40000`). + */ + blocksize: number +} + +interface FuncParse { + /** + * Synchronously parse a TOML string and return an object. + */ + (toml: string): JsonMap + + /** + * Asynchronously parse a TOML string and return a promise of the resulting object. + */ + async (toml: string, options?: ParseOptions): Promise + + /** + * Given a readable stream, parse it as it feeds us data. Return a promise of the resulting object. + */ + stream (readable: NodeJS.ReadableStream): Promise + stream (): Transform +} + +interface FuncStringify { + /** + * Serialize an object as TOML. + * + * If an object `TOML.stringify` is serializing has a `toJSON` method + * then it will call it to transform the object before serializing it. + * This matches the behavior of JSON.stringify. + * + * The one exception to this is that `toJSON` is not called for `Date` objects + * because JSON represents dates as strings and TOML can represent them natively. + * + * `moment` objects are treated the same as native `Date` objects, in this respect. + */ + (obj: JsonMap): string + + /** + * Serialize a value as TOML would. This is a fragment and not a complete valid TOML document. + */ + value (any: AnyJson): string +} + +export const parse: FuncParse +export const stringify: FuncStringify diff --git a/node_modules/@iarna/toml/lib/create-date.js b/node_modules/@iarna/toml/lib/create-date.js new file mode 100755 index 0000000..469fc65 --- /dev/null +++ b/node_modules/@iarna/toml/lib/create-date.js @@ -0,0 +1,23 @@ +'use strict' +const f = require('./format-num.js') +const DateTime = global.Date + +class Date extends DateTime { + constructor (value) { + super(value) + this.isDate = true + } + toISOString () { + return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}` + } +} + +module.exports = value => { + const date = new Date(value) + /* istanbul ignore if */ + if (isNaN(date)) { + throw new TypeError('Invalid Datetime') + } else { + return date + } +} diff --git a/node_modules/@iarna/toml/lib/create-datetime-float.js b/node_modules/@iarna/toml/lib/create-datetime-float.js new file mode 100755 index 0000000..6fb30ac --- /dev/null +++ b/node_modules/@iarna/toml/lib/create-datetime-float.js @@ -0,0 +1,24 @@ +'use strict' +const f = require('./format-num.js') + +class FloatingDateTime extends Date { + constructor (value) { + super(value + 'Z') + this.isFloating = true + } + toISOString () { + const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}` + const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}` + return `${date}T${time}` + } +} + +module.exports = value => { + const date = new FloatingDateTime(value) + /* istanbul ignore if */ + if (isNaN(date)) { + throw new TypeError('Invalid Datetime') + } else { + return date + } +} diff --git a/node_modules/@iarna/toml/lib/create-datetime.js b/node_modules/@iarna/toml/lib/create-datetime.js new file mode 100755 index 0000000..47deded --- /dev/null +++ b/node_modules/@iarna/toml/lib/create-datetime.js @@ -0,0 +1,10 @@ +'use strict' +module.exports = value => { + const date = new Date(value) + /* istanbul ignore if */ + if (isNaN(date)) { + throw new TypeError('Invalid Datetime') + } else { + return date + } +} diff --git a/node_modules/@iarna/toml/lib/create-time.js b/node_modules/@iarna/toml/lib/create-time.js new file mode 100755 index 0000000..190c767 --- /dev/null +++ b/node_modules/@iarna/toml/lib/create-time.js @@ -0,0 +1,22 @@ +'use strict' +const f = require('./format-num.js') + +class Time extends Date { + constructor (value) { + super(`0000-01-01T${value}Z`) + this.isTime = true + } + toISOString () { + return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}` + } +} + +module.exports = value => { + const date = new Time(value) + /* istanbul ignore if */ + if (isNaN(date)) { + throw new TypeError('Invalid Datetime') + } else { + return date + } +} diff --git a/node_modules/@iarna/toml/lib/format-num.js b/node_modules/@iarna/toml/lib/format-num.js new file mode 100755 index 0000000..6addf08 --- /dev/null +++ b/node_modules/@iarna/toml/lib/format-num.js @@ -0,0 +1,6 @@ +'use strict' +module.exports = (d, num) => { + num = String(num) + while (num.length < d) num = '0' + num + return num +} diff --git a/node_modules/@iarna/toml/lib/parser-debug.js b/node_modules/@iarna/toml/lib/parser-debug.js new file mode 100755 index 0000000..e222f27 --- /dev/null +++ b/node_modules/@iarna/toml/lib/parser-debug.js @@ -0,0 +1,60 @@ +'use strict' +const Parser = require('./parser.js') +const util = require('util') + +const dump = _ => util.inspect(_, {colors: true, depth: 10, breakLength: Infinity}) +class DebugParser extends Parser { + stateName (state) { + // istanbul ignore next + return (state.parser && state.parser.name) || state.name || ('anonymous') + } + runOne () { + const callStack = this.stack.concat(this.state).map(_ => this.stateName(_)).join(' <- ') + console.log('RUN', callStack, dump({line: this.line, col: this.col, char: this.char, ret: this.state.returned})) + return super.runOne() + } + finish () { + const obj = super.finish() + // istanbul ignore if + if (this.stack.length !== 0) { + throw new Parser.Error('All states did not return by end of stream') + } + return obj + } + callStack () { + const callStack = this.stack.map(_ => this.stateName(_)).join(' ').replace(/\S/g, ' ') + return callStack ? callStack + ' ' : '' + } + next (fn) { + console.log(' ', this.callStack(), 'NEXT', this.stateName(fn)) + return super.next(fn) + } + goto (fn) { + console.log(' ', this.callStack(), 'GOTO', this.stateName(fn)) + super.next(fn) + return false + } + call (fn, returnWith) { + console.log(' ', this.callStack(), 'CALL', fn.name, returnWith ? '-> ' + returnWith.name : '') + if (returnWith) super.next(returnWith) + this.stack.push(this.state) + this.state = {parser: fn, buf: '', returned: null} + } + callNow (fn, returnWith) { + console.log(' ', this.callStack(), 'CALLNOW', fn.name, returnWith ? '-> ' + returnWith.name : '') + if (returnWith) super.next(returnWith) + this.stack.push(this.state) + this.state = {parser: fn, buf: '', returned: null} + return false + } + return (value) { + console.log(' ', this.callStack(), 'RETURN') + return super.return(value) + } + returnNow (value) { + console.log(' ', this.callStack(), 'RETURNNOW') + super.return(value) + return false + } +} +module.exports = DebugParser diff --git a/node_modules/@iarna/toml/lib/parser.js b/node_modules/@iarna/toml/lib/parser.js new file mode 100755 index 0000000..398856b --- /dev/null +++ b/node_modules/@iarna/toml/lib/parser.js @@ -0,0 +1,127 @@ +'use strict' +const ParserEND = 0x110000 +class ParserError extends Error { + /* istanbul ignore next */ + constructor (msg, filename, linenumber) { + super('[ParserError] ' + msg, filename, linenumber) + this.name = 'ParserError' + this.code = 'ParserError' + if (Error.captureStackTrace) Error.captureStackTrace(this, ParserError) + } +} +class State { + constructor (parser) { + this.parser = parser + this.buf = '' + this.returned = null + this.result = null + this.resultTable = null + this.resultArr = null + } +} +class Parser { + constructor () { + this.pos = 0 + this.col = 0 + this.line = 0 + this.obj = {} + this.ctx = this.obj + this.stack = [] + this._buf = '' + this.char = null + this.ii = 0 + this.state = new State(this.parseStart) + } + + parse (str) { + /* istanbul ignore next */ + if (str.length === 0 || str.length == null) return + + this._buf = String(str) + this.ii = -1 + this.char = -1 + let getNext + while (getNext === false || this.nextChar()) { + getNext = this.runOne() + } + this._buf = null + } + nextChar () { + if (this.char === 0x0A) { + ++this.line + this.col = -1 + } + ++this.ii + this.char = this._buf.codePointAt(this.ii) + ++this.pos + ++this.col + return this.haveBuffer() + } + haveBuffer () { + return this.ii < this._buf.length + } + runOne () { + return this.state.parser.call(this, this.state.returned) + } + finish () { + this.char = ParserEND + let last + do { + last = this.state.parser + this.runOne() + } while (this.state.parser !== last) + + this.ctx = null + this.state = null + this._buf = null + + return this.obj + } + next (fn) { + /* istanbul ignore next */ + if (typeof fn !== 'function') throw new ParserError('Tried to set state to non-existent state: ' + JSON.stringify(fn)) + this.state.parser = fn + } + goto (fn) { + this.next(fn) + return this.runOne() + } + call (fn, returnWith) { + if (returnWith) this.next(returnWith) + this.stack.push(this.state) + this.state = new State(fn) + } + callNow (fn, returnWith) { + this.call(fn, returnWith) + return this.runOne() + } + return (value) { + /* istanbul ignore next */ + if (this.stack.length === 0) throw this.error(new ParserError('Stack underflow')) + if (value === undefined) value = this.state.buf + this.state = this.stack.pop() + this.state.returned = value + } + returnNow (value) { + this.return(value) + return this.runOne() + } + consume () { + /* istanbul ignore next */ + if (this.char === ParserEND) throw this.error(new ParserError('Unexpected end-of-buffer')) + this.state.buf += this._buf[this.ii] + } + error (err) { + err.line = this.line + err.col = this.col + err.pos = this.pos + return err + } + /* istanbul ignore next */ + parseStart () { + throw new ParserError('Must declare a parseStart method') + } +} +Parser.END = ParserEND +Parser.Error = ParserError +module.exports = Parser diff --git a/node_modules/@iarna/toml/lib/toml-parser.js b/node_modules/@iarna/toml/lib/toml-parser.js new file mode 100755 index 0000000..ebcaec8 --- /dev/null +++ b/node_modules/@iarna/toml/lib/toml-parser.js @@ -0,0 +1,1379 @@ +'use strict' +/* eslint-disable no-new-wrappers, no-eval, camelcase, operator-linebreak */ +module.exports = makeParserClass(require('./parser.js')) +module.exports.makeParserClass = makeParserClass + +class TomlError extends Error { + constructor (msg) { + super(msg) + this.name = 'TomlError' + /* istanbul ignore next */ + if (Error.captureStackTrace) Error.captureStackTrace(this, TomlError) + this.fromTOML = true + this.wrapped = null + } +} +TomlError.wrap = err => { + const terr = new TomlError(err.message) + terr.code = err.code + terr.wrapped = err + return terr +} +module.exports.TomlError = TomlError + +const createDateTime = require('./create-datetime.js') +const createDateTimeFloat = require('./create-datetime-float.js') +const createDate = require('./create-date.js') +const createTime = require('./create-time.js') + +const CTRL_I = 0x09 +const CTRL_J = 0x0A +const CTRL_M = 0x0D +const CTRL_CHAR_BOUNDARY = 0x1F // the last non-character in the latin1 region of unicode, except DEL +const CHAR_SP = 0x20 +const CHAR_QUOT = 0x22 +const CHAR_NUM = 0x23 +const CHAR_APOS = 0x27 +const CHAR_PLUS = 0x2B +const CHAR_COMMA = 0x2C +const CHAR_HYPHEN = 0x2D +const CHAR_PERIOD = 0x2E +const CHAR_0 = 0x30 +const CHAR_1 = 0x31 +const CHAR_7 = 0x37 +const CHAR_9 = 0x39 +const CHAR_COLON = 0x3A +const CHAR_EQUALS = 0x3D +const CHAR_A = 0x41 +const CHAR_E = 0x45 +const CHAR_F = 0x46 +const CHAR_T = 0x54 +const CHAR_U = 0x55 +const CHAR_Z = 0x5A +const CHAR_LOWBAR = 0x5F +const CHAR_a = 0x61 +const CHAR_b = 0x62 +const CHAR_e = 0x65 +const CHAR_f = 0x66 +const CHAR_i = 0x69 +const CHAR_l = 0x6C +const CHAR_n = 0x6E +const CHAR_o = 0x6F +const CHAR_r = 0x72 +const CHAR_s = 0x73 +const CHAR_t = 0x74 +const CHAR_u = 0x75 +const CHAR_x = 0x78 +const CHAR_z = 0x7A +const CHAR_LCUB = 0x7B +const CHAR_RCUB = 0x7D +const CHAR_LSQB = 0x5B +const CHAR_BSOL = 0x5C +const CHAR_RSQB = 0x5D +const CHAR_DEL = 0x7F +const SURROGATE_FIRST = 0xD800 +const SURROGATE_LAST = 0xDFFF + +const escapes = { + [CHAR_b]: '\u0008', + [CHAR_t]: '\u0009', + [CHAR_n]: '\u000A', + [CHAR_f]: '\u000C', + [CHAR_r]: '\u000D', + [CHAR_QUOT]: '\u0022', + [CHAR_BSOL]: '\u005C' +} + +function isDigit (cp) { + return cp >= CHAR_0 && cp <= CHAR_9 +} +function isHexit (cp) { + return (cp >= CHAR_A && cp <= CHAR_F) || (cp >= CHAR_a && cp <= CHAR_f) || (cp >= CHAR_0 && cp <= CHAR_9) +} +function isBit (cp) { + return cp === CHAR_1 || cp === CHAR_0 +} +function isOctit (cp) { + return (cp >= CHAR_0 && cp <= CHAR_7) +} +function isAlphaNumQuoteHyphen (cp) { + return (cp >= CHAR_A && cp <= CHAR_Z) + || (cp >= CHAR_a && cp <= CHAR_z) + || (cp >= CHAR_0 && cp <= CHAR_9) + || cp === CHAR_APOS + || cp === CHAR_QUOT + || cp === CHAR_LOWBAR + || cp === CHAR_HYPHEN +} +function isAlphaNumHyphen (cp) { + return (cp >= CHAR_A && cp <= CHAR_Z) + || (cp >= CHAR_a && cp <= CHAR_z) + || (cp >= CHAR_0 && cp <= CHAR_9) + || cp === CHAR_LOWBAR + || cp === CHAR_HYPHEN +} +const _type = Symbol('type') +const _declared = Symbol('declared') + +const hasOwnProperty = Object.prototype.hasOwnProperty +const defineProperty = Object.defineProperty +const descriptor = {configurable: true, enumerable: true, writable: true, value: undefined} + +function hasKey (obj, key) { + if (hasOwnProperty.call(obj, key)) return true + if (key === '__proto__') defineProperty(obj, '__proto__', descriptor) + return false +} + +const INLINE_TABLE = Symbol('inline-table') +function InlineTable () { + return Object.defineProperties({}, { + [_type]: {value: INLINE_TABLE} + }) +} +function isInlineTable (obj) { + if (obj === null || typeof (obj) !== 'object') return false + return obj[_type] === INLINE_TABLE +} + +const TABLE = Symbol('table') +function Table () { + return Object.defineProperties({}, { + [_type]: {value: TABLE}, + [_declared]: {value: false, writable: true} + }) +} +function isTable (obj) { + if (obj === null || typeof (obj) !== 'object') return false + return obj[_type] === TABLE +} + +const _contentType = Symbol('content-type') +const INLINE_LIST = Symbol('inline-list') +function InlineList (type) { + return Object.defineProperties([], { + [_type]: {value: INLINE_LIST}, + [_contentType]: {value: type} + }) +} +function isInlineList (obj) { + if (obj === null || typeof (obj) !== 'object') return false + return obj[_type] === INLINE_LIST +} + +const LIST = Symbol('list') +function List () { + return Object.defineProperties([], { + [_type]: {value: LIST} + }) +} +function isList (obj) { + if (obj === null || typeof (obj) !== 'object') return false + return obj[_type] === LIST +} + +// in an eval, to let bundlers not slurp in a util proxy +let _custom +try { + const utilInspect = eval("require('util').inspect") + _custom = utilInspect.custom +} catch (_) { + /* eval require not available in transpiled bundle */ +} +/* istanbul ignore next */ +const _inspect = _custom || 'inspect' + +class BoxedBigInt { + constructor (value) { + try { + this.value = global.BigInt.asIntN(64, value) + } catch (_) { + /* istanbul ignore next */ + this.value = null + } + Object.defineProperty(this, _type, {value: INTEGER}) + } + isNaN () { + return this.value === null + } + /* istanbul ignore next */ + toString () { + return String(this.value) + } + /* istanbul ignore next */ + [_inspect] () { + return `[BigInt: ${this.toString()}]}` + } + valueOf () { + return this.value + } +} + +const INTEGER = Symbol('integer') +function Integer (value) { + let num = Number(value) + // -0 is a float thing, not an int thing + if (Object.is(num, -0)) num = 0 + /* istanbul ignore else */ + if (global.BigInt && !Number.isSafeInteger(num)) { + return new BoxedBigInt(value) + } else { + /* istanbul ignore next */ + return Object.defineProperties(new Number(num), { + isNaN: {value: function () { return isNaN(this) }}, + [_type]: {value: INTEGER}, + [_inspect]: {value: () => `[Integer: ${value}]`} + }) + } +} +function isInteger (obj) { + if (obj === null || typeof (obj) !== 'object') return false + return obj[_type] === INTEGER +} + +const FLOAT = Symbol('float') +function Float (value) { + /* istanbul ignore next */ + return Object.defineProperties(new Number(value), { + [_type]: {value: FLOAT}, + [_inspect]: {value: () => `[Float: ${value}]`} + }) +} +function isFloat (obj) { + if (obj === null || typeof (obj) !== 'object') return false + return obj[_type] === FLOAT +} + +function tomlType (value) { + const type = typeof value + if (type === 'object') { + /* istanbul ignore if */ + if (value === null) return 'null' + if (value instanceof Date) return 'datetime' + /* istanbul ignore else */ + if (_type in value) { + switch (value[_type]) { + case INLINE_TABLE: return 'inline-table' + case INLINE_LIST: return 'inline-list' + /* istanbul ignore next */ + case TABLE: return 'table' + /* istanbul ignore next */ + case LIST: return 'list' + case FLOAT: return 'float' + case INTEGER: return 'integer' + } + } + } + return type +} + +function makeParserClass (Parser) { + class TOMLParser extends Parser { + constructor () { + super() + this.ctx = this.obj = Table() + } + + /* MATCH HELPER */ + atEndOfWord () { + return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine() + } + atEndOfLine () { + return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M + } + + parseStart () { + if (this.char === Parser.END) { + return null + } else if (this.char === CHAR_LSQB) { + return this.call(this.parseTableOrList) + } else if (this.char === CHAR_NUM) { + return this.call(this.parseComment) + } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { + return null + } else if (isAlphaNumQuoteHyphen(this.char)) { + return this.callNow(this.parseAssignStatement) + } else { + throw this.error(new TomlError(`Unknown character "${this.char}"`)) + } + } + + // HELPER, this strips any whitespace and comments to the end of the line + // then RETURNS. Last state in a production. + parseWhitespaceToEOL () { + if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { + return null + } else if (this.char === CHAR_NUM) { + return this.goto(this.parseComment) + } else if (this.char === Parser.END || this.char === CTRL_J) { + return this.return() + } else { + throw this.error(new TomlError('Unexpected character, expected only whitespace or comments till end of line')) + } + } + + /* ASSIGNMENT: key = value */ + parseAssignStatement () { + return this.callNow(this.parseAssign, this.recordAssignStatement) + } + recordAssignStatement (kv) { + let target = this.ctx + let finalKey = kv.key.pop() + for (let kw of kv.key) { + if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) { + throw this.error(new TomlError("Can't redefine existing key")) + } + target = target[kw] = target[kw] || Table() + } + if (hasKey(target, finalKey)) { + throw this.error(new TomlError("Can't redefine existing key")) + } + // unbox our numbers + if (isInteger(kv.value) || isFloat(kv.value)) { + target[finalKey] = kv.value.valueOf() + } else { + target[finalKey] = kv.value + } + return this.goto(this.parseWhitespaceToEOL) + } + + /* ASSSIGNMENT expression, key = value possibly inside an inline table */ + parseAssign () { + return this.callNow(this.parseKeyword, this.recordAssignKeyword) + } + recordAssignKeyword (key) { + if (this.state.resultTable) { + this.state.resultTable.push(key) + } else { + this.state.resultTable = [key] + } + return this.goto(this.parseAssignKeywordPreDot) + } + parseAssignKeywordPreDot () { + if (this.char === CHAR_PERIOD) { + return this.next(this.parseAssignKeywordPostDot) + } else if (this.char !== CHAR_SP && this.char !== CTRL_I) { + return this.goto(this.parseAssignEqual) + } + } + parseAssignKeywordPostDot () { + if (this.char !== CHAR_SP && this.char !== CTRL_I) { + return this.callNow(this.parseKeyword, this.recordAssignKeyword) + } + } + + parseAssignEqual () { + if (this.char === CHAR_EQUALS) { + return this.next(this.parseAssignPreValue) + } else { + throw this.error(new TomlError('Invalid character, expected "="')) + } + } + parseAssignPreValue () { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else { + return this.callNow(this.parseValue, this.recordAssignValue) + } + } + recordAssignValue (value) { + return this.returnNow({key: this.state.resultTable, value: value}) + } + + /* COMMENTS: #...eol */ + parseComment () { + do { + if (this.char === Parser.END || this.char === CTRL_J) { + return this.return() + } + } while (this.nextChar()) + } + + /* TABLES AND LISTS, [foo] and [[foo]] */ + parseTableOrList () { + if (this.char === CHAR_LSQB) { + this.next(this.parseList) + } else { + return this.goto(this.parseTable) + } + } + + /* TABLE [foo.bar.baz] */ + parseTable () { + this.ctx = this.obj + return this.goto(this.parseTableNext) + } + parseTableNext () { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else { + return this.callNow(this.parseKeyword, this.parseTableMore) + } + } + parseTableMore (keyword) { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else if (this.char === CHAR_RSQB) { + if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) { + throw this.error(new TomlError("Can't redefine existing key")) + } else { + this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table() + this.ctx[_declared] = true + } + return this.next(this.parseWhitespaceToEOL) + } else if (this.char === CHAR_PERIOD) { + if (!hasKey(this.ctx, keyword)) { + this.ctx = this.ctx[keyword] = Table() + } else if (isTable(this.ctx[keyword])) { + this.ctx = this.ctx[keyword] + } else if (isList(this.ctx[keyword])) { + this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1] + } else { + throw this.error(new TomlError("Can't redefine existing key")) + } + return this.next(this.parseTableNext) + } else { + throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]')) + } + } + + /* LIST [[a.b.c]] */ + parseList () { + this.ctx = this.obj + return this.goto(this.parseListNext) + } + parseListNext () { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else { + return this.callNow(this.parseKeyword, this.parseListMore) + } + } + parseListMore (keyword) { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else if (this.char === CHAR_RSQB) { + if (!hasKey(this.ctx, keyword)) { + this.ctx[keyword] = List() + } + if (isInlineList(this.ctx[keyword])) { + throw this.error(new TomlError("Can't extend an inline array")) + } else if (isList(this.ctx[keyword])) { + const next = Table() + this.ctx[keyword].push(next) + this.ctx = next + } else { + throw this.error(new TomlError("Can't redefine an existing key")) + } + return this.next(this.parseListEnd) + } else if (this.char === CHAR_PERIOD) { + if (!hasKey(this.ctx, keyword)) { + this.ctx = this.ctx[keyword] = Table() + } else if (isInlineList(this.ctx[keyword])) { + throw this.error(new TomlError("Can't extend an inline array")) + } else if (isInlineTable(this.ctx[keyword])) { + throw this.error(new TomlError("Can't extend an inline table")) + } else if (isList(this.ctx[keyword])) { + this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1] + } else if (isTable(this.ctx[keyword])) { + this.ctx = this.ctx[keyword] + } else { + throw this.error(new TomlError("Can't redefine an existing key")) + } + return this.next(this.parseListNext) + } else { + throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]')) + } + } + parseListEnd (keyword) { + if (this.char === CHAR_RSQB) { + return this.next(this.parseWhitespaceToEOL) + } else { + throw this.error(new TomlError('Unexpected character, expected whitespace, . or ]')) + } + } + + /* VALUE string, number, boolean, inline list, inline object */ + parseValue () { + if (this.char === Parser.END) { + throw this.error(new TomlError('Key without value')) + } else if (this.char === CHAR_QUOT) { + return this.next(this.parseDoubleString) + } if (this.char === CHAR_APOS) { + return this.next(this.parseSingleString) + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + return this.goto(this.parseNumberSign) + } else if (this.char === CHAR_i) { + return this.next(this.parseInf) + } else if (this.char === CHAR_n) { + return this.next(this.parseNan) + } else if (isDigit(this.char)) { + return this.goto(this.parseNumberOrDateTime) + } else if (this.char === CHAR_t || this.char === CHAR_f) { + return this.goto(this.parseBoolean) + } else if (this.char === CHAR_LSQB) { + return this.call(this.parseInlineList, this.recordValue) + } else if (this.char === CHAR_LCUB) { + return this.call(this.parseInlineTable, this.recordValue) + } else { + throw this.error(new TomlError('Unexpected character, expecting string, number, datetime, boolean, inline array or inline table')) + } + } + recordValue (value) { + return this.returnNow(value) + } + + parseInf () { + if (this.char === CHAR_n) { + return this.next(this.parseInf2) + } else { + throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"')) + } + } + parseInf2 () { + if (this.char === CHAR_f) { + if (this.state.buf === '-') { + return this.return(-Infinity) + } else { + return this.return(Infinity) + } + } else { + throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"')) + } + } + + parseNan () { + if (this.char === CHAR_a) { + return this.next(this.parseNan2) + } else { + throw this.error(new TomlError('Unexpected character, expected "nan"')) + } + } + parseNan2 () { + if (this.char === CHAR_n) { + return this.return(NaN) + } else { + throw this.error(new TomlError('Unexpected character, expected "nan"')) + } + } + + /* KEYS, barewords or basic, literal, or dotted */ + parseKeyword () { + if (this.char === CHAR_QUOT) { + return this.next(this.parseBasicString) + } else if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralString) + } else { + return this.goto(this.parseBareKey) + } + } + + /* KEYS: barewords */ + parseBareKey () { + do { + if (this.char === Parser.END) { + throw this.error(new TomlError('Key ended without value')) + } else if (isAlphaNumHyphen(this.char)) { + this.consume() + } else if (this.state.buf.length === 0) { + throw this.error(new TomlError('Empty bare keys are not allowed')) + } else { + return this.returnNow() + } + } while (this.nextChar()) + } + + /* STRINGS, single quoted (literal) */ + parseSingleString () { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiStringMaybe) + } else { + return this.goto(this.parseLiteralString) + } + } + parseLiteralString () { + do { + if (this.char === CHAR_APOS) { + return this.return() + } else if (this.atEndOfLine()) { + throw this.error(new TomlError('Unterminated string')) + } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I)) { + throw this.errorControlCharInString() + } else { + this.consume() + } + } while (this.nextChar()) + } + parseLiteralMultiStringMaybe () { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiString) + } else { + return this.returnNow() + } + } + parseLiteralMultiString () { + if (this.char === CTRL_M) { + return null + } else if (this.char === CTRL_J) { + return this.next(this.parseLiteralMultiStringContent) + } else { + return this.goto(this.parseLiteralMultiStringContent) + } + } + parseLiteralMultiStringContent () { + do { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiEnd) + } else if (this.char === Parser.END) { + throw this.error(new TomlError('Unterminated multi-line string')) + } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M)) { + throw this.errorControlCharInString() + } else { + this.consume() + } + } while (this.nextChar()) + } + parseLiteralMultiEnd () { + if (this.char === CHAR_APOS) { + return this.next(this.parseLiteralMultiEnd2) + } else { + this.state.buf += "'" + return this.goto(this.parseLiteralMultiStringContent) + } + } + parseLiteralMultiEnd2 () { + if (this.char === CHAR_APOS) { + return this.return() + } else { + this.state.buf += "''" + return this.goto(this.parseLiteralMultiStringContent) + } + } + + /* STRINGS double quoted */ + parseDoubleString () { + if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiStringMaybe) + } else { + return this.goto(this.parseBasicString) + } + } + parseBasicString () { + do { + if (this.char === CHAR_BSOL) { + return this.call(this.parseEscape, this.recordEscapeReplacement) + } else if (this.char === CHAR_QUOT) { + return this.return() + } else if (this.atEndOfLine()) { + throw this.error(new TomlError('Unterminated string')) + } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I)) { + throw this.errorControlCharInString() + } else { + this.consume() + } + } while (this.nextChar()) + } + recordEscapeReplacement (replacement) { + this.state.buf += replacement + return this.goto(this.parseBasicString) + } + parseMultiStringMaybe () { + if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiString) + } else { + return this.returnNow() + } + } + parseMultiString () { + if (this.char === CTRL_M) { + return null + } else if (this.char === CTRL_J) { + return this.next(this.parseMultiStringContent) + } else { + return this.goto(this.parseMultiStringContent) + } + } + parseMultiStringContent () { + do { + if (this.char === CHAR_BSOL) { + return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement) + } else if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiEnd) + } else if (this.char === Parser.END) { + throw this.error(new TomlError('Unterminated multi-line string')) + } else if (this.char === CHAR_DEL || (this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M)) { + throw this.errorControlCharInString() + } else { + this.consume() + } + } while (this.nextChar()) + } + errorControlCharInString () { + let displayCode = '\\u00' + if (this.char < 16) { + displayCode += '0' + } + displayCode += this.char.toString(16) + + return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`)) + } + recordMultiEscapeReplacement (replacement) { + this.state.buf += replacement + return this.goto(this.parseMultiStringContent) + } + parseMultiEnd () { + if (this.char === CHAR_QUOT) { + return this.next(this.parseMultiEnd2) + } else { + this.state.buf += '"' + return this.goto(this.parseMultiStringContent) + } + } + parseMultiEnd2 () { + if (this.char === CHAR_QUOT) { + return this.return() + } else { + this.state.buf += '""' + return this.goto(this.parseMultiStringContent) + } + } + parseMultiEscape () { + if (this.char === CTRL_M || this.char === CTRL_J) { + return this.next(this.parseMultiTrim) + } else if (this.char === CHAR_SP || this.char === CTRL_I) { + return this.next(this.parsePreMultiTrim) + } else { + return this.goto(this.parseEscape) + } + } + parsePreMultiTrim () { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else if (this.char === CTRL_M || this.char === CTRL_J) { + return this.next(this.parseMultiTrim) + } else { + throw this.error(new TomlError("Can't escape whitespace")) + } + } + parseMultiTrim () { + // explicitly whitespace here, END should follow the same path as chars + if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) { + return null + } else { + return this.returnNow() + } + } + parseEscape () { + if (this.char in escapes) { + return this.return(escapes[this.char]) + } else if (this.char === CHAR_u) { + return this.call(this.parseSmallUnicode, this.parseUnicodeReturn) + } else if (this.char === CHAR_U) { + return this.call(this.parseLargeUnicode, this.parseUnicodeReturn) + } else { + throw this.error(new TomlError('Unknown escape character: ' + this.char)) + } + } + parseUnicodeReturn (char) { + try { + const codePoint = parseInt(char, 16) + if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) { + throw this.error(new TomlError('Invalid unicode, character in range 0xD800 - 0xDFFF is reserved')) + } + return this.returnNow(String.fromCodePoint(codePoint)) + } catch (err) { + throw this.error(TomlError.wrap(err)) + } + } + parseSmallUnicode () { + if (!isHexit(this.char)) { + throw this.error(new TomlError('Invalid character in unicode sequence, expected hex')) + } else { + this.consume() + if (this.state.buf.length >= 4) return this.return() + } + } + parseLargeUnicode () { + if (!isHexit(this.char)) { + throw this.error(new TomlError('Invalid character in unicode sequence, expected hex')) + } else { + this.consume() + if (this.state.buf.length >= 8) return this.return() + } + } + + /* NUMBERS */ + parseNumberSign () { + this.consume() + return this.next(this.parseMaybeSignedInfOrNan) + } + parseMaybeSignedInfOrNan () { + if (this.char === CHAR_i) { + return this.next(this.parseInf) + } else if (this.char === CHAR_n) { + return this.next(this.parseNan) + } else { + return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart) + } + } + parseNumberIntegerStart () { + if (this.char === CHAR_0) { + this.consume() + return this.next(this.parseNumberIntegerExponentOrDecimal) + } else { + return this.goto(this.parseNumberInteger) + } + } + parseNumberIntegerExponentOrDecimal () { + if (this.char === CHAR_PERIOD) { + this.consume() + return this.call(this.parseNoUnder, this.parseNumberFloat) + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume() + return this.next(this.parseNumberExponentSign) + } else { + return this.returnNow(Integer(this.state.buf)) + } + } + parseNumberInteger () { + if (isDigit(this.char)) { + this.consume() + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder) + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume() + return this.next(this.parseNumberExponentSign) + } else if (this.char === CHAR_PERIOD) { + this.consume() + return this.call(this.parseNoUnder, this.parseNumberFloat) + } else { + const result = Integer(this.state.buf) + /* istanbul ignore if */ + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')) + } else { + return this.returnNow(result) + } + } + } + parseNoUnder () { + if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) { + throw this.error(new TomlError('Unexpected character, expected digit')) + } else if (this.atEndOfWord()) { + throw this.error(new TomlError('Incomplete number')) + } + return this.returnNow() + } + parseNoUnderHexOctBinLiteral () { + if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) { + throw this.error(new TomlError('Unexpected character, expected digit')) + } else if (this.atEndOfWord()) { + throw this.error(new TomlError('Incomplete number')) + } + return this.returnNow() + } + parseNumberFloat () { + if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder, this.parseNumberFloat) + } else if (isDigit(this.char)) { + this.consume() + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume() + return this.next(this.parseNumberExponentSign) + } else { + return this.returnNow(Float(this.state.buf)) + } + } + parseNumberExponentSign () { + if (isDigit(this.char)) { + return this.goto(this.parseNumberExponent) + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + this.consume() + this.call(this.parseNoUnder, this.parseNumberExponent) + } else { + throw this.error(new TomlError('Unexpected character, expected -, + or digit')) + } + } + parseNumberExponent () { + if (isDigit(this.char)) { + this.consume() + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder) + } else { + return this.returnNow(Float(this.state.buf)) + } + } + + /* NUMBERS or DATETIMES */ + parseNumberOrDateTime () { + if (this.char === CHAR_0) { + this.consume() + return this.next(this.parseNumberBaseOrDateTime) + } else { + return this.goto(this.parseNumberOrDateTimeOnly) + } + } + parseNumberOrDateTimeOnly () { + // note, if two zeros are in a row then it MUST be a date + if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnder, this.parseNumberInteger) + } else if (isDigit(this.char)) { + this.consume() + if (this.state.buf.length > 4) this.next(this.parseNumberInteger) + } else if (this.char === CHAR_E || this.char === CHAR_e) { + this.consume() + return this.next(this.parseNumberExponentSign) + } else if (this.char === CHAR_PERIOD) { + this.consume() + return this.call(this.parseNoUnder, this.parseNumberFloat) + } else if (this.char === CHAR_HYPHEN) { + return this.goto(this.parseDateTime) + } else if (this.char === CHAR_COLON) { + return this.goto(this.parseOnlyTimeHour) + } else { + return this.returnNow(Integer(this.state.buf)) + } + } + parseDateTimeOnly () { + if (this.state.buf.length < 4) { + if (isDigit(this.char)) { + return this.consume() + } else if (this.char === CHAR_COLON) { + return this.goto(this.parseOnlyTimeHour) + } else { + throw this.error(new TomlError('Expected digit while parsing year part of a date')) + } + } else { + if (this.char === CHAR_HYPHEN) { + return this.goto(this.parseDateTime) + } else { + throw this.error(new TomlError('Expected hyphen (-) while parsing year part of date')) + } + } + } + parseNumberBaseOrDateTime () { + if (this.char === CHAR_b) { + this.consume() + return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin) + } else if (this.char === CHAR_o) { + this.consume() + return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct) + } else if (this.char === CHAR_x) { + this.consume() + return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex) + } else if (this.char === CHAR_PERIOD) { + return this.goto(this.parseNumberInteger) + } else if (isDigit(this.char)) { + return this.goto(this.parseDateTimeOnly) + } else { + return this.returnNow(Integer(this.state.buf)) + } + } + parseIntegerHex () { + if (isHexit(this.char)) { + this.consume() + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnderHexOctBinLiteral) + } else { + const result = Integer(this.state.buf) + /* istanbul ignore if */ + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')) + } else { + return this.returnNow(result) + } + } + } + parseIntegerOct () { + if (isOctit(this.char)) { + this.consume() + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnderHexOctBinLiteral) + } else { + const result = Integer(this.state.buf) + /* istanbul ignore if */ + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')) + } else { + return this.returnNow(result) + } + } + } + parseIntegerBin () { + if (isBit(this.char)) { + this.consume() + } else if (this.char === CHAR_LOWBAR) { + return this.call(this.parseNoUnderHexOctBinLiteral) + } else { + const result = Integer(this.state.buf) + /* istanbul ignore if */ + if (result.isNaN()) { + throw this.error(new TomlError('Invalid number')) + } else { + return this.returnNow(result) + } + } + } + + /* DATETIME */ + parseDateTime () { + // we enter here having just consumed the year and about to consume the hyphen + if (this.state.buf.length < 4) { + throw this.error(new TomlError('Years less than 1000 must be zero padded to four characters')) + } + this.state.result = this.state.buf + this.state.buf = '' + return this.next(this.parseDateMonth) + } + parseDateMonth () { + if (this.char === CHAR_HYPHEN) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Months less than 10 must be zero padded to two characters')) + } + this.state.result += '-' + this.state.buf + this.state.buf = '' + return this.next(this.parseDateDay) + } else if (isDigit(this.char)) { + this.consume() + } else { + throw this.error(new TomlError('Incomplete datetime')) + } + } + parseDateDay () { + if (this.char === CHAR_T || this.char === CHAR_SP) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Days less than 10 must be zero padded to two characters')) + } + this.state.result += '-' + this.state.buf + this.state.buf = '' + return this.next(this.parseStartTimeHour) + } else if (this.atEndOfWord()) { + return this.returnNow(createDate(this.state.result + '-' + this.state.buf)) + } else if (isDigit(this.char)) { + this.consume() + } else { + throw this.error(new TomlError('Incomplete datetime')) + } + } + parseStartTimeHour () { + if (this.atEndOfWord()) { + return this.returnNow(createDate(this.state.result)) + } else { + return this.goto(this.parseTimeHour) + } + } + parseTimeHour () { + if (this.char === CHAR_COLON) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Hours less than 10 must be zero padded to two characters')) + } + this.state.result += 'T' + this.state.buf + this.state.buf = '' + return this.next(this.parseTimeMin) + } else if (isDigit(this.char)) { + this.consume() + } else { + throw this.error(new TomlError('Incomplete datetime')) + } + } + parseTimeMin () { + if (this.state.buf.length < 2 && isDigit(this.char)) { + this.consume() + } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) { + this.state.result += ':' + this.state.buf + this.state.buf = '' + return this.next(this.parseTimeSec) + } else { + throw this.error(new TomlError('Incomplete datetime')) + } + } + parseTimeSec () { + if (isDigit(this.char)) { + this.consume() + if (this.state.buf.length === 2) { + this.state.result += ':' + this.state.buf + this.state.buf = '' + return this.next(this.parseTimeZoneOrFraction) + } + } else { + throw this.error(new TomlError('Incomplete datetime')) + } + } + + parseOnlyTimeHour () { + /* istanbul ignore else */ + if (this.char === CHAR_COLON) { + if (this.state.buf.length < 2) { + throw this.error(new TomlError('Hours less than 10 must be zero padded to two characters')) + } + this.state.result = this.state.buf + this.state.buf = '' + return this.next(this.parseOnlyTimeMin) + } else { + throw this.error(new TomlError('Incomplete time')) + } + } + parseOnlyTimeMin () { + if (this.state.buf.length < 2 && isDigit(this.char)) { + this.consume() + } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) { + this.state.result += ':' + this.state.buf + this.state.buf = '' + return this.next(this.parseOnlyTimeSec) + } else { + throw this.error(new TomlError('Incomplete time')) + } + } + parseOnlyTimeSec () { + if (isDigit(this.char)) { + this.consume() + if (this.state.buf.length === 2) { + return this.next(this.parseOnlyTimeFractionMaybe) + } + } else { + throw this.error(new TomlError('Incomplete time')) + } + } + parseOnlyTimeFractionMaybe () { + this.state.result += ':' + this.state.buf + if (this.char === CHAR_PERIOD) { + this.state.buf = '' + this.next(this.parseOnlyTimeFraction) + } else { + return this.return(createTime(this.state.result)) + } + } + parseOnlyTimeFraction () { + if (isDigit(this.char)) { + this.consume() + } else if (this.atEndOfWord()) { + if (this.state.buf.length === 0) throw this.error(new TomlError('Expected digit in milliseconds')) + return this.returnNow(createTime(this.state.result + '.' + this.state.buf)) + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z')) + } + } + + parseTimeZoneOrFraction () { + if (this.char === CHAR_PERIOD) { + this.consume() + this.next(this.parseDateTimeFraction) + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + this.consume() + this.next(this.parseTimeZoneHour) + } else if (this.char === CHAR_Z) { + this.consume() + return this.return(createDateTime(this.state.result + this.state.buf)) + } else if (this.atEndOfWord()) { + return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf)) + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z')) + } + } + parseDateTimeFraction () { + if (isDigit(this.char)) { + this.consume() + } else if (this.state.buf.length === 1) { + throw this.error(new TomlError('Expected digit in milliseconds')) + } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) { + this.consume() + this.next(this.parseTimeZoneHour) + } else if (this.char === CHAR_Z) { + this.consume() + return this.return(createDateTime(this.state.result + this.state.buf)) + } else if (this.atEndOfWord()) { + return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf)) + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z')) + } + } + parseTimeZoneHour () { + if (isDigit(this.char)) { + this.consume() + // FIXME: No more regexps + if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep) + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected digit')) + } + } + parseTimeZoneSep () { + if (this.char === CHAR_COLON) { + this.consume() + this.next(this.parseTimeZoneMin) + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected colon')) + } + } + parseTimeZoneMin () { + if (isDigit(this.char)) { + this.consume() + if (/\d\d$/.test(this.state.buf)) return this.return(createDateTime(this.state.result + this.state.buf)) + } else { + throw this.error(new TomlError('Unexpected character in datetime, expected digit')) + } + } + + /* BOOLEAN */ + parseBoolean () { + /* istanbul ignore else */ + if (this.char === CHAR_t) { + this.consume() + return this.next(this.parseTrue_r) + } else if (this.char === CHAR_f) { + this.consume() + return this.next(this.parseFalse_a) + } + } + parseTrue_r () { + if (this.char === CHAR_r) { + this.consume() + return this.next(this.parseTrue_u) + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')) + } + } + parseTrue_u () { + if (this.char === CHAR_u) { + this.consume() + return this.next(this.parseTrue_e) + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')) + } + } + parseTrue_e () { + if (this.char === CHAR_e) { + return this.return(true) + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')) + } + } + + parseFalse_a () { + if (this.char === CHAR_a) { + this.consume() + return this.next(this.parseFalse_l) + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')) + } + } + + parseFalse_l () { + if (this.char === CHAR_l) { + this.consume() + return this.next(this.parseFalse_s) + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')) + } + } + + parseFalse_s () { + if (this.char === CHAR_s) { + this.consume() + return this.next(this.parseFalse_e) + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')) + } + } + + parseFalse_e () { + if (this.char === CHAR_e) { + return this.return(false) + } else { + throw this.error(new TomlError('Invalid boolean, expected true or false')) + } + } + + /* INLINE LISTS */ + parseInlineList () { + if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) { + return null + } else if (this.char === Parser.END) { + throw this.error(new TomlError('Unterminated inline array')) + } else if (this.char === CHAR_NUM) { + return this.call(this.parseComment) + } else if (this.char === CHAR_RSQB) { + return this.return(this.state.resultArr || InlineList()) + } else { + return this.callNow(this.parseValue, this.recordInlineListValue) + } + } + recordInlineListValue (value) { + if (this.state.resultArr) { + const listType = this.state.resultArr[_contentType] + const valueType = tomlType(value) + if (listType !== valueType) { + throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`)) + } + } else { + this.state.resultArr = InlineList(tomlType(value)) + } + if (isFloat(value) || isInteger(value)) { + // unbox now that we've verified they're ok + this.state.resultArr.push(value.valueOf()) + } else { + this.state.resultArr.push(value) + } + return this.goto(this.parseInlineListNext) + } + parseInlineListNext () { + if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) { + return null + } else if (this.char === CHAR_NUM) { + return this.call(this.parseComment) + } else if (this.char === CHAR_COMMA) { + return this.next(this.parseInlineList) + } else if (this.char === CHAR_RSQB) { + return this.goto(this.parseInlineList) + } else { + throw this.error(new TomlError('Invalid character, expected whitespace, comma (,) or close bracket (])')) + } + } + + /* INLINE TABLE */ + parseInlineTable () { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { + throw this.error(new TomlError('Unterminated inline array')) + } else if (this.char === CHAR_RCUB) { + return this.return(this.state.resultTable || InlineTable()) + } else { + if (!this.state.resultTable) this.state.resultTable = InlineTable() + return this.callNow(this.parseAssign, this.recordInlineTableValue) + } + } + recordInlineTableValue (kv) { + let target = this.state.resultTable + let finalKey = kv.key.pop() + for (let kw of kv.key) { + if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) { + throw this.error(new TomlError("Can't redefine existing key")) + } + target = target[kw] = target[kw] || Table() + } + if (hasKey(target, finalKey)) { + throw this.error(new TomlError("Can't redefine existing key")) + } + if (isInteger(kv.value) || isFloat(kv.value)) { + target[finalKey] = kv.value.valueOf() + } else { + target[finalKey] = kv.value + } + return this.goto(this.parseInlineTableNext) + } + parseInlineTableNext () { + if (this.char === CHAR_SP || this.char === CTRL_I) { + return null + } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) { + throw this.error(new TomlError('Unterminated inline array')) + } else if (this.char === CHAR_COMMA) { + return this.next(this.parseInlineTable) + } else if (this.char === CHAR_RCUB) { + return this.goto(this.parseInlineTable) + } else { + throw this.error(new TomlError('Invalid character, expected whitespace, comma (,) or close bracket (])')) + } + } + } + return TOMLParser +} diff --git a/node_modules/@iarna/toml/package.json b/node_modules/@iarna/toml/package.json new file mode 100755 index 0000000..1dbd4e7 --- /dev/null +++ b/node_modules/@iarna/toml/package.json @@ -0,0 +1,86 @@ +{ + "name": "@iarna/toml", + "version": "2.2.5", + "main": "toml.js", + "scripts": { + "test": "tap -J --100 test/*.js test/toml-stream/*.js", + "benchmark": "node benchmark.js && node benchmark-per-file.js && node results2table.js", + "prerelease": "npm t", + "prepack": "rm -f *~", + "postpublish": "git push --follow-tags", + "pretest": "iarna-standard", + "update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'", + "update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'", + "setup-burntsushi-toml-suite": "[ -d test/burntsushi-toml-test ] || (git clone https://github.com/BurntSushi/toml-test test/burntsushi-toml-test; rimraf test/burntsushi-toml-test/.git/hooks/*); cd test/burntsushi-toml-test; git pull", + "setup-iarna-toml-suite": "[ -d test/spec-test ] || (git clone https://github.com/iarna/toml-spec-tests -b 0.5.0 test/spec-test; rimraf test/spec-test/.git/hooks/*); cd test/spec-test; git pull", + "prepare": "npm run setup-burntsushi-toml-suite && npm run setup-iarna-toml-suite" + }, + "keywords": [ + "toml", + "toml-parser", + "toml-stringifier", + "parser", + "stringifer", + "emitter", + "ini", + "tomlify", + "encoder", + "decoder" + ], + "author": "Rebecca Turner (http://re-becca.org/)", + "license": "ISC", + "description": "Better TOML parsing and stringifying all in that familiar JSON interface.", + "dependencies": {}, + "devDependencies": { + "@iarna/standard": "^2.0.2", + "@ltd/j-toml": "^0.5.107", + "@perl/qx": "^1.1.0", + "@sgarciac/bombadil": "^2.3.0", + "ansi": "^0.3.1", + "approximate-number": "^2.0.0", + "benchmark": "^2.1.4", + "fast-toml": "^0.5.4", + "funstream": "^4.2.0", + "glob": "^7.1.6", + "js-yaml": "^3.13.1", + "rimraf": "^3.0.2", + "tap": "^12.0.1", + "toml": "^3.0.0", + "toml-j0.4": "^1.1.1", + "weallbehave": "*", + "weallcontribute": "*" + }, + "files": [ + "toml.js", + "stringify.js", + "parse.js", + "parse-string.js", + "parse-stream.js", + "parse-async.js", + "parse-pretty-error.js", + "lib/parser.js", + "lib/parser-debug.js", + "lib/toml-parser.js", + "lib/create-datetime.js", + "lib/create-date.js", + "lib/create-datetime-float.js", + "lib/create-time.js", + "lib/format-num.js", + "index.d.ts" + ], + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/iarna/iarna-toml.git" + }, + "bugs": { + "url": "https://github.com/iarna/iarna-toml/issues" + }, + "homepage": "https://github.com/iarna/iarna-toml#readme" + +,"_resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz" +,"_integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==" +,"_from": "@iarna/toml@2.2.5" +} \ No newline at end of file diff --git a/node_modules/@iarna/toml/parse-async.js b/node_modules/@iarna/toml/parse-async.js new file mode 100755 index 0000000..e5ff090 --- /dev/null +++ b/node_modules/@iarna/toml/parse-async.js @@ -0,0 +1,30 @@ +'use strict' +module.exports = parseAsync + +const TOMLParser = require('./lib/toml-parser.js') +const prettyError = require('./parse-pretty-error.js') + +function parseAsync (str, opts) { + if (!opts) opts = {} + const index = 0 + const blocksize = opts.blocksize || 40960 + const parser = new TOMLParser() + return new Promise((resolve, reject) => { + setImmediate(parseAsyncNext, index, blocksize, resolve, reject) + }) + function parseAsyncNext (index, blocksize, resolve, reject) { + if (index >= str.length) { + try { + return resolve(parser.finish()) + } catch (err) { + return reject(prettyError(err, str)) + } + } + try { + parser.parse(str.slice(index, index + blocksize)) + setImmediate(parseAsyncNext, index + blocksize, blocksize, resolve, reject) + } catch (err) { + reject(prettyError(err, str)) + } + } +} diff --git a/node_modules/@iarna/toml/parse-pretty-error.js b/node_modules/@iarna/toml/parse-pretty-error.js new file mode 100755 index 0000000..fc0d31f --- /dev/null +++ b/node_modules/@iarna/toml/parse-pretty-error.js @@ -0,0 +1,33 @@ +'use strict' +module.exports = prettyError + +function prettyError (err, buf) { + /* istanbul ignore if */ + if (err.pos == null || err.line == null) return err + let msg = err.message + msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:\n` + + /* istanbul ignore else */ + if (buf && buf.split) { + const lines = buf.split(/\n/) + const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length + let linePadding = ' ' + while (linePadding.length < lineNumWidth) linePadding += ' ' + for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) { + let lineNum = String(ii + 1) + if (lineNum.length < lineNumWidth) lineNum = ' ' + lineNum + if (err.line === ii) { + msg += lineNum + '> ' + lines[ii] + '\n' + msg += linePadding + ' ' + for (let hh = 0; hh < err.col; ++hh) { + msg += ' ' + } + msg += '^\n' + } else { + msg += lineNum + ': ' + lines[ii] + '\n' + } + } + } + err.message = msg + '\n' + return err +} diff --git a/node_modules/@iarna/toml/parse-stream.js b/node_modules/@iarna/toml/parse-stream.js new file mode 100755 index 0000000..fb9a644 --- /dev/null +++ b/node_modules/@iarna/toml/parse-stream.js @@ -0,0 +1,80 @@ +'use strict' +module.exports = parseStream + +const stream = require('stream') +const TOMLParser = require('./lib/toml-parser.js') + +function parseStream (stm) { + if (stm) { + return parseReadable(stm) + } else { + return parseTransform(stm) + } +} + +function parseReadable (stm) { + const parser = new TOMLParser() + stm.setEncoding('utf8') + return new Promise((resolve, reject) => { + let readable + let ended = false + let errored = false + function finish () { + ended = true + if (readable) return + try { + resolve(parser.finish()) + } catch (err) { + reject(err) + } + } + function error (err) { + errored = true + reject(err) + } + stm.once('end', finish) + stm.once('error', error) + readNext() + + function readNext () { + readable = true + let data + while ((data = stm.read()) !== null) { + try { + parser.parse(data) + } catch (err) { + return error(err) + } + } + readable = false + /* istanbul ignore if */ + if (ended) return finish() + /* istanbul ignore if */ + if (errored) return + stm.once('readable', readNext) + } + }) +} + +function parseTransform () { + const parser = new TOMLParser() + return new stream.Transform({ + objectMode: true, + transform (chunk, encoding, cb) { + try { + parser.parse(chunk.toString(encoding)) + } catch (err) { + this.emit('error', err) + } + cb() + }, + flush (cb) { + try { + this.push(parser.finish()) + } catch (err) { + this.emit('error', err) + } + cb() + } + }) +} diff --git a/node_modules/@iarna/toml/parse-string.js b/node_modules/@iarna/toml/parse-string.js new file mode 100755 index 0000000..84ff7d4 --- /dev/null +++ b/node_modules/@iarna/toml/parse-string.js @@ -0,0 +1,18 @@ +'use strict' +module.exports = parseString + +const TOMLParser = require('./lib/toml-parser.js') +const prettyError = require('./parse-pretty-error.js') + +function parseString (str) { + if (global.Buffer && global.Buffer.isBuffer(str)) { + str = str.toString('utf8') + } + const parser = new TOMLParser() + try { + parser.parse(str) + return parser.finish() + } catch (err) { + throw prettyError(err, str) + } +} diff --git a/node_modules/@iarna/toml/parse.js b/node_modules/@iarna/toml/parse.js new file mode 100755 index 0000000..923b9d3 --- /dev/null +++ b/node_modules/@iarna/toml/parse.js @@ -0,0 +1,5 @@ +'use strict' +module.exports = require('./parse-string.js') +module.exports.async = require('./parse-async.js') +module.exports.stream = require('./parse-stream.js') +module.exports.prettyError = require('./parse-pretty-error.js') diff --git a/node_modules/@iarna/toml/stringify.js b/node_modules/@iarna/toml/stringify.js new file mode 100755 index 0000000..958caae --- /dev/null +++ b/node_modules/@iarna/toml/stringify.js @@ -0,0 +1,296 @@ +'use strict' +module.exports = stringify +module.exports.value = stringifyInline + +function stringify (obj) { + if (obj === null) throw typeError('null') + if (obj === void (0)) throw typeError('undefined') + if (typeof obj !== 'object') throw typeError(typeof obj) + + if (typeof obj.toJSON === 'function') obj = obj.toJSON() + if (obj == null) return null + const type = tomlType(obj) + if (type !== 'table') throw typeError(type) + return stringifyObject('', '', obj) +} + +function typeError (type) { + return new Error('Can only stringify objects, not ' + type) +} + +function arrayOneTypeError () { + return new Error("Array values can't have mixed types") +} + +function getInlineKeys (obj) { + return Object.keys(obj).filter(key => isInline(obj[key])) +} +function getComplexKeys (obj) { + return Object.keys(obj).filter(key => !isInline(obj[key])) +} + +function toJSON (obj) { + let nobj = Array.isArray(obj) ? [] : Object.prototype.hasOwnProperty.call(obj, '__proto__') ? {['__proto__']: undefined} : {} + for (let prop of Object.keys(obj)) { + if (obj[prop] && typeof obj[prop].toJSON === 'function' && !('toISOString' in obj[prop])) { + nobj[prop] = obj[prop].toJSON() + } else { + nobj[prop] = obj[prop] + } + } + return nobj +} + +function stringifyObject (prefix, indent, obj) { + obj = toJSON(obj) + var inlineKeys + var complexKeys + inlineKeys = getInlineKeys(obj) + complexKeys = getComplexKeys(obj) + var result = [] + var inlineIndent = indent || '' + inlineKeys.forEach(key => { + var type = tomlType(obj[key]) + if (type !== 'undefined' && type !== 'null') { + result.push(inlineIndent + stringifyKey(key) + ' = ' + stringifyAnyInline(obj[key], true)) + } + }) + if (result.length > 0) result.push('') + var complexIndent = prefix && inlineKeys.length > 0 ? indent + ' ' : '' + complexKeys.forEach(key => { + result.push(stringifyComplex(prefix, complexIndent, key, obj[key])) + }) + return result.join('\n') +} + +function isInline (value) { + switch (tomlType(value)) { + case 'undefined': + case 'null': + case 'integer': + case 'nan': + case 'float': + case 'boolean': + case 'string': + case 'datetime': + return true + case 'array': + return value.length === 0 || tomlType(value[0]) !== 'table' + case 'table': + return Object.keys(value).length === 0 + /* istanbul ignore next */ + default: + return false + } +} + +function tomlType (value) { + if (value === undefined) { + return 'undefined' + } else if (value === null) { + return 'null' + /* eslint-disable valid-typeof */ + } else if (typeof value === 'bigint' || (Number.isInteger(value) && !Object.is(value, -0))) { + return 'integer' + } else if (typeof value === 'number') { + return 'float' + } else if (typeof value === 'boolean') { + return 'boolean' + } else if (typeof value === 'string') { + return 'string' + } else if ('toISOString' in value) { + return isNaN(value) ? 'undefined' : 'datetime' + } else if (Array.isArray(value)) { + return 'array' + } else { + return 'table' + } +} + +function stringifyKey (key) { + var keyStr = String(key) + if (/^[-A-Za-z0-9_]+$/.test(keyStr)) { + return keyStr + } else { + return stringifyBasicString(keyStr) + } +} + +function stringifyBasicString (str) { + return '"' + escapeString(str).replace(/"/g, '\\"') + '"' +} + +function stringifyLiteralString (str) { + return "'" + str + "'" +} + +function numpad (num, str) { + while (str.length < num) str = '0' + str + return str +} + +function escapeString (str) { + return str.replace(/\\/g, '\\\\') + .replace(/[\b]/g, '\\b') + .replace(/\t/g, '\\t') + .replace(/\n/g, '\\n') + .replace(/\f/g, '\\f') + .replace(/\r/g, '\\r') + /* eslint-disable no-control-regex */ + .replace(/([\u0000-\u001f\u007f])/, c => '\\u' + numpad(4, c.codePointAt(0).toString(16))) + /* eslint-enable no-control-regex */ +} + +function stringifyMultilineString (str) { + let escaped = str.split(/\n/).map(str => { + return escapeString(str).replace(/"(?="")/g, '\\"') + }).join('\n') + if (escaped.slice(-1) === '"') escaped += '\\\n' + return '"""\n' + escaped + '"""' +} + +function stringifyAnyInline (value, multilineOk) { + let type = tomlType(value) + if (type === 'string') { + if (multilineOk && /\n/.test(value)) { + type = 'string-multiline' + } else if (!/[\b\t\n\f\r']/.test(value) && /"/.test(value)) { + type = 'string-literal' + } + } + return stringifyInline(value, type) +} + +function stringifyInline (value, type) { + /* istanbul ignore if */ + if (!type) type = tomlType(value) + switch (type) { + case 'string-multiline': + return stringifyMultilineString(value) + case 'string': + return stringifyBasicString(value) + case 'string-literal': + return stringifyLiteralString(value) + case 'integer': + return stringifyInteger(value) + case 'float': + return stringifyFloat(value) + case 'boolean': + return stringifyBoolean(value) + case 'datetime': + return stringifyDatetime(value) + case 'array': + return stringifyInlineArray(value.filter(_ => tomlType(_) !== 'null' && tomlType(_) !== 'undefined' && tomlType(_) !== 'nan')) + case 'table': + return stringifyInlineTable(value) + /* istanbul ignore next */ + default: + throw typeError(type) + } +} + +function stringifyInteger (value) { + /* eslint-disable security/detect-unsafe-regex */ + return String(value).replace(/\B(?=(\d{3})+(?!\d))/g, '_') +} + +function stringifyFloat (value) { + if (value === Infinity) { + return 'inf' + } else if (value === -Infinity) { + return '-inf' + } else if (Object.is(value, NaN)) { + return 'nan' + } else if (Object.is(value, -0)) { + return '-0.0' + } + var chunks = String(value).split('.') + var int = chunks[0] + var dec = chunks[1] || 0 + return stringifyInteger(int) + '.' + dec +} + +function stringifyBoolean (value) { + return String(value) +} + +function stringifyDatetime (value) { + return value.toISOString() +} + +function isNumber (type) { + return type === 'float' || type === 'integer' +} +function arrayType (values) { + var contentType = tomlType(values[0]) + if (values.every(_ => tomlType(_) === contentType)) return contentType + // mixed integer/float, emit as floats + if (values.every(_ => isNumber(tomlType(_)))) return 'float' + return 'mixed' +} +function validateArray (values) { + const type = arrayType(values) + if (type === 'mixed') { + throw arrayOneTypeError() + } + return type +} + +function stringifyInlineArray (values) { + values = toJSON(values) + const type = validateArray(values) + var result = '[' + var stringified = values.map(_ => stringifyInline(_, type)) + if (stringified.join(', ').length > 60 || /\n/.test(stringified)) { + result += '\n ' + stringified.join(',\n ') + '\n' + } else { + result += ' ' + stringified.join(', ') + (stringified.length > 0 ? ' ' : '') + } + return result + ']' +} + +function stringifyInlineTable (value) { + value = toJSON(value) + var result = [] + Object.keys(value).forEach(key => { + result.push(stringifyKey(key) + ' = ' + stringifyAnyInline(value[key], false)) + }) + return '{ ' + result.join(', ') + (result.length > 0 ? ' ' : '') + '}' +} + +function stringifyComplex (prefix, indent, key, value) { + var valueType = tomlType(value) + /* istanbul ignore else */ + if (valueType === 'array') { + return stringifyArrayOfTables(prefix, indent, key, value) + } else if (valueType === 'table') { + return stringifyComplexTable(prefix, indent, key, value) + } else { + throw typeError(valueType) + } +} + +function stringifyArrayOfTables (prefix, indent, key, values) { + values = toJSON(values) + validateArray(values) + var firstValueType = tomlType(values[0]) + /* istanbul ignore if */ + if (firstValueType !== 'table') throw typeError(firstValueType) + var fullKey = prefix + stringifyKey(key) + var result = '' + values.forEach(table => { + if (result.length > 0) result += '\n' + result += indent + '[[' + fullKey + ']]\n' + result += stringifyObject(fullKey + '.', indent, table) + }) + return result +} + +function stringifyComplexTable (prefix, indent, key, value) { + var fullKey = prefix + stringifyKey(key) + var result = '' + if (getInlineKeys(value).length > 0) { + result += indent + '[' + fullKey + ']\n' + } + return result + stringifyObject(fullKey + '.', indent, value) +} diff --git a/node_modules/@iarna/toml/toml.js b/node_modules/@iarna/toml/toml.js new file mode 100755 index 0000000..edca17c --- /dev/null +++ b/node_modules/@iarna/toml/toml.js @@ -0,0 +1,3 @@ +'use strict' +exports.parse = require('./parse.js') +exports.stringify = require('./stringify.js') diff --git a/node_modules/toml/.jshintrc b/node_modules/toml/.jshintrc deleted file mode 100644 index 96747b1..0000000 --- a/node_modules/toml/.jshintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "node": true, - "browser": true, - "browserify": true, - "curly": true, - "eqeqeq": true, - "eqnull": false, - "latedef": "nofunc", - "newcap": true, - "noarg": true, - "undef": true, - "strict": true, - "trailing": true, - "smarttabs": true, - "indent": 2, - "quotmark": true, - "laxbreak": true -} diff --git a/node_modules/toml/.travis.yml b/node_modules/toml/.travis.yml deleted file mode 100644 index f46aeb8..0000000 --- a/node_modules/toml/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -sudo: false -node_js: - - "4.1" - - "4.0" - - "0.12" - - "0.10" diff --git a/node_modules/toml/CHANGELOG.md b/node_modules/toml/CHANGELOG.md deleted file mode 100644 index 65b4db6..0000000 --- a/node_modules/toml/CHANGELOG.md +++ /dev/null @@ -1,116 +0,0 @@ -2.3.0 - July 13 2015 -==================== - -* Correctly handle quoted keys ([#21](https://github.com/BinaryMuse/toml-node/issues/21)) - -2.2.3 - June 8 2015 -=================== - -* Support empty inline tables ([#24](https://github.com/BinaryMuse/toml-node/issues/24)) -* Do not allow implicit table definitions to replace value ([#23](https://github.com/BinaryMuse/toml-node/issues/23)) -* Don't allow tables to replace inline tables ([#25](https://github.com/BinaryMuse/toml-node/issues/25)) - -2.2.2 - April 3 2015 -==================== - -* Correctly handle newlines at beginning of string ([#22](https://github.com/BinaryMuse/toml-node/issues/22)) - -2.2.1 - March 17 2015 -===================== - -* Parse dates generated by Date#toISOString() ([#20](https://github.com/BinaryMuse/toml-node/issues/20)) - -2.2.0 - Feb 26 2015 -=================== - -* Support TOML spec v0.4.0 - -2.1.0 - Jan 7 2015 -================== - -* Support TOML spec v0.3.1 - -2.0.6 - May 23 2014 -=================== - -### Bug Fixes - -* Fix support for empty arrays with newlines ([#13](https://github.com/BinaryMuse/toml-node/issues/13)) - -2.0.5 - May 5 2014 -================== - -### Bug Fixes - -* Fix loop iteration leak, by [sebmck](https://github.com/sebmck) ([#12](https://github.com/BinaryMuse/toml-node/pull/12)) - -### Development - -* Tests now run JSHint on `lib/compiler.js` - -2.0.4 - Mar 9 2014 -================== - -### Bug Fixes - -* Fix failure on duplicate table name inside table array ([#11](https://github.com/BinaryMuse/toml-node/issues/11)) - -2.0.2 - Feb 23 2014 -=================== - -### Bug Fixes - -* Fix absence of errors when table path starts or ends with period - -2.0.1 - Feb 23 2014 -=================== - -### Bug Fixes - -* Fix incorrect messaging in array type errors -* Fix missing error when overwriting key with table array - -2.0.0 - Feb 23 2014 -=================== - -### Features - -* Add support for [version 0.2 of the TOML spec](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md) ([#9](https://github.com/BinaryMuse/toml-node/issues/9)) - -### Internals - -* Upgrade to PEG.js v0.8 and rewrite compiler; parser is now considerably faster (from ~7000ms to ~1000ms to parse `example.toml` 1000 times on Node.js v0.10) - -1.0.4 - Aug 17 2013 -=================== - -### Bug Fixes - -* Fix support for empty arrays - -1.0.3 - Aug 17 2013 -=================== - -### Bug Fixes - -* Fix typo in array type error message -* Fix single-element arrays with no trailing commas - -1.0.2 - Aug 17 2013 -=================== - -### Bug Fixes - -* Fix errors on lines that contain only whitespace ([#7](https://github.com/BinaryMuse/toml-node/issues/7)) - -1.0.1 - Aug 17 2013 -=================== - -### Internals - -* Remove old code remaining from the remove streaming API - -1.0.0 - Aug 17 2013 -=================== - -Initial stable release diff --git a/node_modules/toml/LICENSE b/node_modules/toml/LICENSE deleted file mode 100644 index 44ae2bf..0000000 --- a/node_modules/toml/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 Michelle Tilley - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/toml/README.md b/node_modules/toml/README.md deleted file mode 100644 index ff4dc58..0000000 --- a/node_modules/toml/README.md +++ /dev/null @@ -1,93 +0,0 @@ -TOML Parser for Node.js -======================= - -[![Build Status](https://travis-ci.org/BinaryMuse/toml-node.png?branch=master)](https://travis-ci.org/BinaryMuse/toml-node) - -[![NPM](https://nodei.co/npm/toml.png?downloads=true)](https://nodei.co/npm/toml/) - -If you haven't heard of TOML, well you're just missing out. [Go check it out now.](https://github.com/mojombo/toml) Back? Good. - -TOML Spec Support ------------------ - -toml-node supports version 0.4.0 the TOML spec as specified by [mojombo/toml@v0.4.0](https://github.com/mojombo/toml/blob/master/versions/en/toml-v0.4.0.md) - -Installation ------------- - -toml-node is available via npm. - - npm install toml - -toml-node also works with browser module bundlers like Browserify and webpack. - -Usage ------ - -### Standalone - -Say you have some awesome TOML in a variable called `someTomlString`. Maybe it came from the web; maybe it came from a file; wherever it came from, it came asynchronously! Let's turn that sucker into a JavaScript object. - -```javascript -var toml = require('toml'); -var data = toml.parse(someTomlString); -console.dir(data); -``` - -`toml.parse` throws an exception in the case of a parsing error; such exceptions have a `line` and `column` property on them to help identify the offending text. - -```javascript -try { - toml.parse(someCrazyKnuckleHeadedTrblToml); -} catch (e) { - console.error("Parsing error on line " + e.line + ", column " + e.column + - ": " + e.message); -} -``` - -### Streaming - -As of toml-node version 1.0, the streaming interface has been removed. Instead, use a module like [concat-stream](https://npmjs.org/package/concat-stream): - -```javascript -var toml = require('toml'); -var concat = require('concat-stream'); -var fs = require('fs'); - -fs.createReadStream('tomlFile.toml', 'utf8').pipe(concat(function(data) { - var parsed = toml.parse(data); -})); -``` - -Thanks [@ForbesLindesay](https://github.com/ForbesLindesay) for the suggestion. - -### Requiring with Node.js - -You can use the [toml-require package](https://github.com/BinaryMuse/toml-require) to `require()` your `.toml` files with Node.js - -Live Demo ---------- - -You can experiment with TOML online at http://binarymuse.github.io/toml-node/, which uses the latest version of this library. - -Building & Testing ------------------- - -toml-node uses [the PEG.js parser generator](http://pegjs.majda.cz/). - - npm install - npm run build - npm test - -Any changes to `src/toml.peg` requires a regeneration of the parser with `npm run build`. - -toml-node is tested on Travis CI and is tested against: - - * Node 0.10 - * Node 0.12 - * Latest stable io.js - -License -------- - -toml-node is licensed under the MIT license agreement. See the LICENSE file for more information. diff --git a/node_modules/toml/benchmark.js b/node_modules/toml/benchmark.js deleted file mode 100644 index 99fba1d..0000000 --- a/node_modules/toml/benchmark.js +++ /dev/null @@ -1,12 +0,0 @@ -var toml = require('./index'); -var fs = require('fs'); -var data = fs.readFileSync('./test/example.toml', 'utf8'); - -var iterations = 1000; - -var start = new Date(); -for(var i = 0; i < iterations; i++) { - toml.parse(data); -} -var end = new Date(); -console.log("%s iterations in %sms", iterations, end - start); diff --git a/node_modules/toml/index.d.ts b/node_modules/toml/index.d.ts deleted file mode 100644 index 7e9052b..0000000 --- a/node_modules/toml/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'toml' { - export function parse(input: string): any; -} diff --git a/node_modules/toml/index.js b/node_modules/toml/index.js deleted file mode 100644 index 6caf44a..0000000 --- a/node_modules/toml/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var parser = require('./lib/parser'); -var compiler = require('./lib/compiler'); - -module.exports = { - parse: function(input) { - var nodes = parser.parse(input.toString()); - return compiler.compile(nodes); - } -}; diff --git a/node_modules/toml/lib/compiler.js b/node_modules/toml/lib/compiler.js deleted file mode 100644 index ba5312e..0000000 --- a/node_modules/toml/lib/compiler.js +++ /dev/null @@ -1,195 +0,0 @@ -"use strict"; -function compile(nodes) { - var assignedPaths = []; - var valueAssignments = []; - var currentPath = ""; - var data = Object.create(null); - var context = data; - var arrayMode = false; - - return reduce(nodes); - - function reduce(nodes) { - var node; - for (var i = 0; i < nodes.length; i++) { - node = nodes[i]; - switch (node.type) { - case "Assign": - assign(node); - break; - case "ObjectPath": - setPath(node); - break; - case "ArrayPath": - addTableArray(node); - break; - } - } - - return data; - } - - function genError(err, line, col) { - var ex = new Error(err); - ex.line = line; - ex.column = col; - throw ex; - } - - function assign(node) { - var key = node.key; - var value = node.value; - var line = node.line; - var column = node.column; - - var fullPath; - if (currentPath) { - fullPath = currentPath + "." + key; - } else { - fullPath = key; - } - if (typeof context[key] !== "undefined") { - genError("Cannot redefine existing key '" + fullPath + "'.", line, column); - } - - context[key] = reduceValueNode(value); - - if (!pathAssigned(fullPath)) { - assignedPaths.push(fullPath); - valueAssignments.push(fullPath); - } - } - - - function pathAssigned(path) { - return assignedPaths.indexOf(path) !== -1; - } - - function reduceValueNode(node) { - if (node.type === "Array") { - return reduceArrayWithTypeChecking(node.value); - } else if (node.type === "InlineTable") { - return reduceInlineTableNode(node.value); - } else { - return node.value; - } - } - - function reduceInlineTableNode(values) { - var obj = Object.create(null); - for (var i = 0; i < values.length; i++) { - var val = values[i]; - if (val.value.type === "InlineTable") { - obj[val.key] = reduceInlineTableNode(val.value.value); - } else if (val.type === "InlineTableValue") { - obj[val.key] = reduceValueNode(val.value); - } - } - - return obj; - } - - function setPath(node) { - var path = node.value; - var quotedPath = path.map(quoteDottedString).join("."); - var line = node.line; - var column = node.column; - - if (pathAssigned(quotedPath)) { - genError("Cannot redefine existing key '" + path + "'.", line, column); - } - assignedPaths.push(quotedPath); - context = deepRef(data, path, Object.create(null), line, column); - currentPath = path; - } - - function addTableArray(node) { - var path = node.value; - var quotedPath = path.map(quoteDottedString).join("."); - var line = node.line; - var column = node.column; - - if (!pathAssigned(quotedPath)) { - assignedPaths.push(quotedPath); - } - assignedPaths = assignedPaths.filter(function(p) { - return p.indexOf(quotedPath) !== 0; - }); - assignedPaths.push(quotedPath); - context = deepRef(data, path, [], line, column); - currentPath = quotedPath; - - if (context instanceof Array) { - var newObj = Object.create(null); - context.push(newObj); - context = newObj; - } else { - genError("Cannot redefine existing key '" + path + "'.", line, column); - } - } - - // Given a path 'a.b.c', create (as necessary) `start.a`, - // `start.a.b`, and `start.a.b.c`, assigning `value` to `start.a.b.c`. - // If `a` or `b` are arrays and have items in them, the last item in the - // array is used as the context for the next sub-path. - function deepRef(start, keys, value, line, column) { - var traversed = []; - var traversedPath = ""; - var path = keys.join("."); - var ctx = start; - - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - traversed.push(key); - traversedPath = traversed.join("."); - if (typeof ctx[key] === "undefined") { - if (i === keys.length - 1) { - ctx[key] = value; - } else { - ctx[key] = Object.create(null); - } - } else if (i !== keys.length - 1 && valueAssignments.indexOf(traversedPath) > -1) { - // already a non-object value at key, can't be used as part of a new path - genError("Cannot redefine existing key '" + traversedPath + "'.", line, column); - } - - ctx = ctx[key]; - if (ctx instanceof Array && ctx.length && i < keys.length - 1) { - ctx = ctx[ctx.length - 1]; - } - } - - return ctx; - } - - function reduceArrayWithTypeChecking(array) { - // Ensure that all items in the array are of the same type - var firstType = null; - for (var i = 0; i < array.length; i++) { - var node = array[i]; - if (firstType === null) { - firstType = node.type; - } else { - if (node.type !== firstType) { - genError("Cannot add value of type " + node.type + " to array of type " + - firstType + ".", node.line, node.column); - } - } - } - - // Recursively reduce array of nodes into array of the nodes' values - return array.map(reduceValueNode); - } - - function quoteDottedString(str) { - if (str.indexOf(".") > -1) { - return "\"" + str + "\""; - } else { - return str; - } - } -} - -module.exports = { - compile: compile -}; diff --git a/node_modules/toml/lib/parser.js b/node_modules/toml/lib/parser.js deleted file mode 100644 index 69cbd6f..0000000 --- a/node_modules/toml/lib/parser.js +++ /dev/null @@ -1,3841 +0,0 @@ -module.exports = (function() { - /* - * Generated by PEG.js 0.8.0. - * - * http://pegjs.majda.cz/ - */ - - function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); - } - - function SyntaxError(message, expected, found, offset, line, column) { - this.message = message; - this.expected = expected; - this.found = found; - this.offset = offset; - this.line = line; - this.column = column; - - this.name = "SyntaxError"; - } - - peg$subclass(SyntaxError, Error); - - function parse(input) { - var options = arguments.length > 1 ? arguments[1] : {}, - - peg$FAILED = {}, - - peg$startRuleFunctions = { start: peg$parsestart }, - peg$startRuleFunction = peg$parsestart, - - peg$c0 = [], - peg$c1 = function() { return nodes }, - peg$c2 = peg$FAILED, - peg$c3 = "#", - peg$c4 = { type: "literal", value: "#", description: "\"#\"" }, - peg$c5 = void 0, - peg$c6 = { type: "any", description: "any character" }, - peg$c7 = "[", - peg$c8 = { type: "literal", value: "[", description: "\"[\"" }, - peg$c9 = "]", - peg$c10 = { type: "literal", value: "]", description: "\"]\"" }, - peg$c11 = function(name) { addNode(node('ObjectPath', name, line, column)) }, - peg$c12 = function(name) { addNode(node('ArrayPath', name, line, column)) }, - peg$c13 = function(parts, name) { return parts.concat(name) }, - peg$c14 = function(name) { return [name] }, - peg$c15 = function(name) { return name }, - peg$c16 = ".", - peg$c17 = { type: "literal", value: ".", description: "\".\"" }, - peg$c18 = "=", - peg$c19 = { type: "literal", value: "=", description: "\"=\"" }, - peg$c20 = function(key, value) { addNode(node('Assign', value, line, column, key)) }, - peg$c21 = function(chars) { return chars.join('') }, - peg$c22 = function(node) { return node.value }, - peg$c23 = "\"\"\"", - peg$c24 = { type: "literal", value: "\"\"\"", description: "\"\\\"\\\"\\\"\"" }, - peg$c25 = null, - peg$c26 = function(chars) { return node('String', chars.join(''), line, column) }, - peg$c27 = "\"", - peg$c28 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c29 = "'''", - peg$c30 = { type: "literal", value: "'''", description: "\"'''\"" }, - peg$c31 = "'", - peg$c32 = { type: "literal", value: "'", description: "\"'\"" }, - peg$c33 = function(char) { return char }, - peg$c34 = function(char) { return char}, - peg$c35 = "\\", - peg$c36 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c37 = function() { return '' }, - peg$c38 = "e", - peg$c39 = { type: "literal", value: "e", description: "\"e\"" }, - peg$c40 = "E", - peg$c41 = { type: "literal", value: "E", description: "\"E\"" }, - peg$c42 = function(left, right) { return node('Float', parseFloat(left + 'e' + right), line, column) }, - peg$c43 = function(text) { return node('Float', parseFloat(text), line, column) }, - peg$c44 = "+", - peg$c45 = { type: "literal", value: "+", description: "\"+\"" }, - peg$c46 = function(digits) { return digits.join('') }, - peg$c47 = "-", - peg$c48 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c49 = function(digits) { return '-' + digits.join('') }, - peg$c50 = function(text) { return node('Integer', parseInt(text, 10), line, column) }, - peg$c51 = "true", - peg$c52 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c53 = function() { return node('Boolean', true, line, column) }, - peg$c54 = "false", - peg$c55 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c56 = function() { return node('Boolean', false, line, column) }, - peg$c57 = function() { return node('Array', [], line, column) }, - peg$c58 = function(value) { return node('Array', value ? [value] : [], line, column) }, - peg$c59 = function(values) { return node('Array', values, line, column) }, - peg$c60 = function(values, value) { return node('Array', values.concat(value), line, column) }, - peg$c61 = function(value) { return value }, - peg$c62 = ",", - peg$c63 = { type: "literal", value: ",", description: "\",\"" }, - peg$c64 = "{", - peg$c65 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c66 = "}", - peg$c67 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c68 = function(values) { return node('InlineTable', values, line, column) }, - peg$c69 = function(key, value) { return node('InlineTableValue', value, line, column, key) }, - peg$c70 = function(digits) { return "." + digits }, - peg$c71 = function(date) { return date.join('') }, - peg$c72 = ":", - peg$c73 = { type: "literal", value: ":", description: "\":\"" }, - peg$c74 = function(time) { return time.join('') }, - peg$c75 = "T", - peg$c76 = { type: "literal", value: "T", description: "\"T\"" }, - peg$c77 = "Z", - peg$c78 = { type: "literal", value: "Z", description: "\"Z\"" }, - peg$c79 = function(date, time) { return node('Date', new Date(date + "T" + time + "Z"), line, column) }, - peg$c80 = function(date, time) { return node('Date', new Date(date + "T" + time), line, column) }, - peg$c81 = /^[ \t]/, - peg$c82 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, - peg$c83 = "\n", - peg$c84 = { type: "literal", value: "\n", description: "\"\\n\"" }, - peg$c85 = "\r", - peg$c86 = { type: "literal", value: "\r", description: "\"\\r\"" }, - peg$c87 = /^[0-9a-f]/i, - peg$c88 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, - peg$c89 = /^[0-9]/, - peg$c90 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c91 = "_", - peg$c92 = { type: "literal", value: "_", description: "\"_\"" }, - peg$c93 = function() { return "" }, - peg$c94 = /^[A-Za-z0-9_\-]/, - peg$c95 = { type: "class", value: "[A-Za-z0-9_\\-]", description: "[A-Za-z0-9_\\-]" }, - peg$c96 = function(d) { return d.join('') }, - peg$c97 = "\\\"", - peg$c98 = { type: "literal", value: "\\\"", description: "\"\\\\\\\"\"" }, - peg$c99 = function() { return '"' }, - peg$c100 = "\\\\", - peg$c101 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" }, - peg$c102 = function() { return '\\' }, - peg$c103 = "\\b", - peg$c104 = { type: "literal", value: "\\b", description: "\"\\\\b\"" }, - peg$c105 = function() { return '\b' }, - peg$c106 = "\\t", - peg$c107 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, - peg$c108 = function() { return '\t' }, - peg$c109 = "\\n", - peg$c110 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, - peg$c111 = function() { return '\n' }, - peg$c112 = "\\f", - peg$c113 = { type: "literal", value: "\\f", description: "\"\\\\f\"" }, - peg$c114 = function() { return '\f' }, - peg$c115 = "\\r", - peg$c116 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, - peg$c117 = function() { return '\r' }, - peg$c118 = "\\U", - peg$c119 = { type: "literal", value: "\\U", description: "\"\\\\U\"" }, - peg$c120 = function(digits) { return convertCodePoint(digits.join('')) }, - peg$c121 = "\\u", - peg$c122 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, - - peg$currPos = 0, - peg$reportedPos = 0, - peg$cachedPos = 0, - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }, - peg$maxFailPos = 0, - peg$maxFailExpected = [], - peg$silentFails = 0, - - peg$cache = {}, - peg$result; - - if ("startRule" in options) { - if (!(options.startRule in peg$startRuleFunctions)) { - throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); - } - - peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; - } - - function text() { - return input.substring(peg$reportedPos, peg$currPos); - } - - function offset() { - return peg$reportedPos; - } - - function line() { - return peg$computePosDetails(peg$reportedPos).line; - } - - function column() { - return peg$computePosDetails(peg$reportedPos).column; - } - - function expected(description) { - throw peg$buildException( - null, - [{ type: "other", description: description }], - peg$reportedPos - ); - } - - function error(message) { - throw peg$buildException(message, null, peg$reportedPos); - } - - function peg$computePosDetails(pos) { - function advance(details, startPos, endPos) { - var p, ch; - - for (p = startPos; p < endPos; p++) { - ch = input.charAt(p); - if (ch === "\n") { - if (!details.seenCR) { details.line++; } - details.column = 1; - details.seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { - details.line++; - details.column = 1; - details.seenCR = true; - } else { - details.column++; - details.seenCR = false; - } - } - } - - if (peg$cachedPos !== pos) { - if (peg$cachedPos > pos) { - peg$cachedPos = 0; - peg$cachedPosDetails = { line: 1, column: 1, seenCR: false }; - } - advance(peg$cachedPosDetails, peg$cachedPos, pos); - peg$cachedPos = pos; - } - - return peg$cachedPosDetails; - } - - function peg$fail(expected) { - if (peg$currPos < peg$maxFailPos) { return; } - - if (peg$currPos > peg$maxFailPos) { - peg$maxFailPos = peg$currPos; - peg$maxFailExpected = []; - } - - peg$maxFailExpected.push(expected); - } - - function peg$buildException(message, expected, pos) { - function cleanupExpected(expected) { - var i = 1; - - expected.sort(function(a, b) { - if (a.description < b.description) { - return -1; - } else if (a.description > b.description) { - return 1; - } else { - return 0; - } - }); - - while (i < expected.length) { - if (expected[i - 1] === expected[i]) { - expected.splice(i, 1); - } else { - i++; - } - } - } - - function buildMessage(expected, found) { - function stringEscape(s) { - function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } - - return s - .replace(/\\/g, '\\\\') - .replace(/"/g, '\\"') - .replace(/\x08/g, '\\b') - .replace(/\t/g, '\\t') - .replace(/\n/g, '\\n') - .replace(/\f/g, '\\f') - .replace(/\r/g, '\\r') - .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) - .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) - .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) - .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); - } - - var expectedDescs = new Array(expected.length), - expectedDesc, foundDesc, i; - - for (i = 0; i < expected.length; i++) { - expectedDescs[i] = expected[i].description; - } - - expectedDesc = expected.length > 1 - ? expectedDescs.slice(0, -1).join(", ") - + " or " - + expectedDescs[expected.length - 1] - : expectedDescs[0]; - - foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; - - return "Expected " + expectedDesc + " but " + foundDesc + " found."; - } - - var posDetails = peg$computePosDetails(pos), - found = pos < input.length ? input.charAt(pos) : null; - - if (expected !== null) { - cleanupExpected(expected); - } - - return new SyntaxError( - message !== null ? message : buildMessage(expected, found), - expected, - found, - pos, - posDetails.line, - posDetails.column - ); - } - - function peg$parsestart() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 0, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseline(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseline(); - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c1(); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseline() { - var s0, s1, s2, s3, s4, s5, s6; - - var key = peg$currPos * 49 + 1, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parseexpression(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parsecomment(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parsecomment(); - } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseNL(); - if (s6 !== peg$FAILED) { - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseNL(); - } - } else { - s5 = peg$c2; - } - if (s5 === peg$FAILED) { - s5 = peg$parseEOF(); - } - if (s5 !== peg$FAILED) { - s1 = [s1, s2, s3, s4, s5]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - } else { - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseNL(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseNL(); - } - } else { - s2 = peg$c2; - } - if (s2 === peg$FAILED) { - s2 = peg$parseEOF(); - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$parseNL(); - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseexpression() { - var s0; - - var key = peg$currPos * 49 + 2, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parsecomment(); - if (s0 === peg$FAILED) { - s0 = peg$parsepath(); - if (s0 === peg$FAILED) { - s0 = peg$parsetablearray(); - if (s0 === peg$FAILED) { - s0 = peg$parseassignment(); - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsecomment() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 49 + 3, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c3; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c4); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$currPos; - s4 = peg$currPos; - peg$silentFails++; - s5 = peg$parseNL(); - if (s5 === peg$FAILED) { - s5 = peg$parseEOF(); - } - peg$silentFails--; - if (s5 === peg$FAILED) { - s4 = peg$c5; - } else { - peg$currPos = s4; - s4 = peg$c2; - } - if (s4 !== peg$FAILED) { - if (input.length > peg$currPos) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s5 !== peg$FAILED) { - s4 = [s4, s5]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$c2; - } - } else { - peg$currPos = s3; - s3 = peg$c2; - } - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$currPos; - s4 = peg$currPos; - peg$silentFails++; - s5 = peg$parseNL(); - if (s5 === peg$FAILED) { - s5 = peg$parseEOF(); - } - peg$silentFails--; - if (s5 === peg$FAILED) { - s4 = peg$c5; - } else { - peg$currPos = s4; - s4 = peg$c2; - } - if (s4 !== peg$FAILED) { - if (input.length > peg$currPos) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s5 !== peg$FAILED) { - s4 = [s4, s5]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$c2; - } - } else { - peg$currPos = s3; - s3 = peg$c2; - } - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsepath() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 49 + 4, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parsetable_key(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s5 = peg$c9; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c11(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsetablearray() { - var s0, s1, s2, s3, s4, s5, s6, s7; - - var key = peg$currPos * 49 + 5, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 91) { - s2 = peg$c7; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - s4 = peg$parsetable_key(); - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s6 = peg$c9; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s6 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s7 = peg$c9; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s7 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c12(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsetable_key() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 6, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parsedot_ended_table_key_part(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parsedot_ended_table_key_part(); - } - } else { - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - s2 = peg$parsetable_key_part(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c13(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsetable_key_part(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c14(s1); - } - s0 = s1; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsetable_key_part() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 7, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsequoted_key(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsedot_ended_table_key_part() { - var s0, s1, s2, s3, s4, s5, s6; - - var key = peg$currPos * 49 + 8, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsequoted_key(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseassignment() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 49 + 9, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parsekey(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c18; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parsevalue(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c20(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsequoted_key(); - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c18; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parsevalue(); - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c20(s1, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsekey() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 10, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseASCII_BASIC(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseASCII_BASIC(); - } - } else { - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c21(s1); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsequoted_key() { - var s0, s1; - - var key = peg$currPos * 49 + 11, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parsedouble_quoted_single_line_string(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c22(s1); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsesingle_quoted_single_line_string(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c22(s1); - } - s0 = s1; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsevalue() { - var s0; - - var key = peg$currPos * 49 + 12, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parsestring(); - if (s0 === peg$FAILED) { - s0 = peg$parsedatetime(); - if (s0 === peg$FAILED) { - s0 = peg$parsefloat(); - if (s0 === peg$FAILED) { - s0 = peg$parseinteger(); - if (s0 === peg$FAILED) { - s0 = peg$parseboolean(); - if (s0 === peg$FAILED) { - s0 = peg$parsearray(); - if (s0 === peg$FAILED) { - s0 = peg$parseinline_table(); - } - } - } - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsestring() { - var s0; - - var key = peg$currPos * 49 + 13, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parsedouble_quoted_multiline_string(); - if (s0 === peg$FAILED) { - s0 = peg$parsedouble_quoted_single_line_string(); - if (s0 === peg$FAILED) { - s0 = peg$parsesingle_quoted_multiline_string(); - if (s0 === peg$FAILED) { - s0 = peg$parsesingle_quoted_single_line_string(); - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsedouble_quoted_multiline_string() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 14, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c23) { - s1 = peg$c23; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseNL(); - if (s2 === peg$FAILED) { - s2 = peg$c25; - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsemultiline_string_char(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsemultiline_string_char(); - } - if (s3 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c23) { - s4 = peg$c23; - peg$currPos += 3; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c26(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsedouble_quoted_single_line_string() { - var s0, s1, s2, s3; - - var key = peg$currPos * 49 + 15, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c27; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsestring_char(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsestring_char(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c27; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c26(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsesingle_quoted_multiline_string() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 16, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c29) { - s1 = peg$c29; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseNL(); - if (s2 === peg$FAILED) { - s2 = peg$c25; - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsemultiline_literal_char(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsemultiline_literal_char(); - } - if (s3 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c29) { - s4 = peg$c29; - peg$currPos += 3; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c26(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsesingle_quoted_single_line_string() { - var s0, s1, s2, s3; - - var key = peg$currPos * 49 + 17, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 39) { - s1 = peg$c31; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseliteral_char(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseliteral_char(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 39) { - s3 = peg$c31; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c26(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsestring_char() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 18, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parseESCAPED(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c27; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } - } - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseliteral_char() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 19, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - if (input.charCodeAt(peg$currPos) === 39) { - s2 = peg$c31; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } - } - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsemultiline_string_char() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 20, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parseESCAPED(); - if (s0 === peg$FAILED) { - s0 = peg$parsemultiline_string_delim(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - if (input.substr(peg$currPos, 3) === peg$c23) { - s2 = peg$c23; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsemultiline_string_delim() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 21, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c35; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseNL(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseNLS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseNLS(); - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c37(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsemultiline_literal_char() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 22, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - if (input.substr(peg$currPos, 3) === peg$c29) { - s2 = peg$c29; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } - } - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsefloat() { - var s0, s1, s2, s3; - - var key = peg$currPos * 49 + 23, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parsefloat_text(); - if (s1 === peg$FAILED) { - s1 = peg$parseinteger_text(); - } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 101) { - s2 = peg$c38; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } - } - if (s2 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 69) { - s2 = peg$c40; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } - } - } - if (s2 !== peg$FAILED) { - s3 = peg$parseinteger_text(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c42(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsefloat_text(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c43(s1); - } - s0 = s1; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsefloat_text() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 49 + 24, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 43) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } - } - if (s1 === peg$FAILED) { - s1 = peg$c25; - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parseDIGITS(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - if (s4 !== peg$FAILED) { - s5 = peg$parseDIGITS(); - if (s5 !== peg$FAILED) { - s3 = [s3, s4, s5]; - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c46(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c47; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parseDIGITS(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - if (s4 !== peg$FAILED) { - s5 = peg$parseDIGITS(); - if (s5 !== peg$FAILED) { - s3 = [s3, s4, s5]; - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c49(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseinteger() { - var s0, s1; - - var key = peg$currPos * 49 + 25, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parseinteger_text(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c50(s1); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseinteger_text() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 26, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 43) { - s1 = peg$c44; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } - } - if (s1 === peg$FAILED) { - s1 = peg$c25; - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseDIGIT_OR_UNDER(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseDIGIT_OR_UNDER(); - } - } else { - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - peg$silentFails++; - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - peg$silentFails--; - if (s4 === peg$FAILED) { - s3 = peg$c5; - } else { - peg$currPos = s3; - s3 = peg$c2; - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c46(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c47; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseDIGIT_OR_UNDER(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseDIGIT_OR_UNDER(); - } - } else { - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - s3 = peg$currPos; - peg$silentFails++; - if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - peg$silentFails--; - if (s4 === peg$FAILED) { - s3 = peg$c5; - } else { - peg$currPos = s3; - s3 = peg$c2; - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c49(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseboolean() { - var s0, s1; - - var key = peg$currPos * 49 + 27, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c51) { - s1 = peg$c51; - peg$currPos += 4; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c53(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c54) { - s1 = peg$c54; - peg$currPos += 5; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c56(); - } - s0 = s1; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsearray() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 28, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsearray_sep(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsearray_sep(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s3 = peg$c9; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c57(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parsearray_value(); - if (s2 === peg$FAILED) { - s2 = peg$c25; - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s3 = peg$c9; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c58(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsearray_value_list(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsearray_value_list(); - } - } else { - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s3 = peg$c9; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c59(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsearray_value_list(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsearray_value_list(); - } - } else { - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - s3 = peg$parsearray_value(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c9; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c60(s2, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsearray_value() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 29, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parsearray_sep(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parsearray_sep(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsevalue(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsearray_sep(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsearray_sep(); - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c61(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsearray_value_list() { - var s0, s1, s2, s3, s4, s5, s6; - - var key = peg$currPos * 49 + 30, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parsearray_sep(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parsearray_sep(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsevalue(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsearray_sep(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsearray_sep(); - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s4 = peg$c62; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } - } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parsearray_sep(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parsearray_sep(); - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c61(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsearray_sep() { - var s0; - - var key = peg$currPos * 49 + 31, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parseS(); - if (s0 === peg$FAILED) { - s0 = peg$parseNL(); - if (s0 === peg$FAILED) { - s0 = peg$parsecomment(); - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseinline_table() { - var s0, s1, s2, s3, s4, s5; - - var key = peg$currPos * 49 + 32, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c64; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c65); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseinline_table_assignment(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseinline_table_assignment(); - } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s5 = peg$c66; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c68(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseinline_table_assignment() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; - - var key = peg$currPos * 49 + 33, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s4 = peg$c18; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - s6 = peg$parsevalue(); - if (s6 !== peg$FAILED) { - s7 = []; - s8 = peg$parseS(); - while (s8 !== peg$FAILED) { - s7.push(s8); - s8 = peg$parseS(); - } - if (s7 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s8 = peg$c62; - peg$currPos++; - } else { - s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } - } - if (s8 !== peg$FAILED) { - s9 = []; - s10 = peg$parseS(); - while (s10 !== peg$FAILED) { - s9.push(s10); - s10 = peg$parseS(); - } - if (s9 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c69(s2, s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 61) { - s4 = peg$c18; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } - } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - s6 = peg$parsevalue(); - if (s6 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c69(s2, s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsesecfragment() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 34, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 46) { - s1 = peg$c16; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseDIGITS(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c70(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsedate() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; - - var key = peg$currPos * 49 + 35, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$parseDIGIT_OR_UNDER(); - if (s2 !== peg$FAILED) { - s3 = peg$parseDIGIT_OR_UNDER(); - if (s3 !== peg$FAILED) { - s4 = peg$parseDIGIT_OR_UNDER(); - if (s4 !== peg$FAILED) { - s5 = peg$parseDIGIT_OR_UNDER(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 45) { - s6 = peg$c47; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } - } - if (s6 !== peg$FAILED) { - s7 = peg$parseDIGIT_OR_UNDER(); - if (s7 !== peg$FAILED) { - s8 = peg$parseDIGIT_OR_UNDER(); - if (s8 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 45) { - s9 = peg$c47; - peg$currPos++; - } else { - s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } - } - if (s9 !== peg$FAILED) { - s10 = peg$parseDIGIT_OR_UNDER(); - if (s10 !== peg$FAILED) { - s11 = peg$parseDIGIT_OR_UNDER(); - if (s11 !== peg$FAILED) { - s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10, s11]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c71(s1); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsetime() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; - - var key = peg$currPos * 49 + 36, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$parseDIGIT_OR_UNDER(); - if (s2 !== peg$FAILED) { - s3 = peg$parseDIGIT_OR_UNDER(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c72; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } - } - if (s4 !== peg$FAILED) { - s5 = peg$parseDIGIT_OR_UNDER(); - if (s5 !== peg$FAILED) { - s6 = peg$parseDIGIT_OR_UNDER(); - if (s6 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s7 = peg$c72; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } - } - if (s7 !== peg$FAILED) { - s8 = peg$parseDIGIT_OR_UNDER(); - if (s8 !== peg$FAILED) { - s9 = peg$parseDIGIT_OR_UNDER(); - if (s9 !== peg$FAILED) { - s10 = peg$parsesecfragment(); - if (s10 === peg$FAILED) { - s10 = peg$c25; - } - if (s10 !== peg$FAILED) { - s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c74(s1); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsetime_with_offset() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16; - - var key = peg$currPos * 49 + 37, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$currPos; - s2 = peg$parseDIGIT_OR_UNDER(); - if (s2 !== peg$FAILED) { - s3 = peg$parseDIGIT_OR_UNDER(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c72; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } - } - if (s4 !== peg$FAILED) { - s5 = peg$parseDIGIT_OR_UNDER(); - if (s5 !== peg$FAILED) { - s6 = peg$parseDIGIT_OR_UNDER(); - if (s6 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s7 = peg$c72; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } - } - if (s7 !== peg$FAILED) { - s8 = peg$parseDIGIT_OR_UNDER(); - if (s8 !== peg$FAILED) { - s9 = peg$parseDIGIT_OR_UNDER(); - if (s9 !== peg$FAILED) { - s10 = peg$parsesecfragment(); - if (s10 === peg$FAILED) { - s10 = peg$c25; - } - if (s10 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 45) { - s11 = peg$c47; - peg$currPos++; - } else { - s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } - } - if (s11 === peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 43) { - s11 = peg$c44; - peg$currPos++; - } else { - s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } - } - } - if (s11 !== peg$FAILED) { - s12 = peg$parseDIGIT_OR_UNDER(); - if (s12 !== peg$FAILED) { - s13 = peg$parseDIGIT_OR_UNDER(); - if (s13 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s14 = peg$c72; - peg$currPos++; - } else { - s14 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } - } - if (s14 !== peg$FAILED) { - s15 = peg$parseDIGIT_OR_UNDER(); - if (s15 !== peg$FAILED) { - s16 = peg$parseDIGIT_OR_UNDER(); - if (s16 !== peg$FAILED) { - s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16]; - s1 = s2; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c74(s1); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsedatetime() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 38, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = peg$parsedate(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 84) { - s2 = peg$c75; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsetime(); - if (s3 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 90) { - s4 = peg$c77; - peg$currPos++; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c79(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsedate(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 84) { - s2 = peg$c75; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsetime_with_offset(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c80(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseS() { - var s0; - - var key = peg$currPos * 49 + 39, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - if (peg$c81.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNL() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 40, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 10) { - s0 = peg$c83; - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 13) { - s1 = peg$c85; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } - } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 10) { - s2 = peg$c83; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNLS() { - var s0; - - var key = peg$currPos * 49 + 41, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parseNL(); - if (s0 === peg$FAILED) { - s0 = peg$parseS(); - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEOF() { - var s0, s1; - - var key = peg$currPos * 49 + 42, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - peg$silentFails++; - if (input.length > peg$currPos) { - s1 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - peg$silentFails--; - if (s1 === peg$FAILED) { - s0 = peg$c5; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseHEX() { - var s0; - - var key = peg$currPos * 49 + 43, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - if (peg$c87.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseDIGIT_OR_UNDER() { - var s0, s1; - - var key = peg$currPos * 49 + 44, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - if (peg$c89.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 95) { - s1 = peg$c91; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c92); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c93(); - } - s0 = s1; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseASCII_BASIC() { - var s0; - - var key = peg$currPos * 49 + 45, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - if (peg$c94.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseDIGITS() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 46, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseDIGIT_OR_UNDER(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseDIGIT_OR_UNDER(); - } - } else { - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c96(s1); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseESCAPED() { - var s0, s1; - - var key = peg$currPos * 49 + 47, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c97) { - s1 = peg$c97; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c98); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c99(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c100) { - s1 = peg$c100; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c101); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c102(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c103) { - s1 = peg$c103; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c104); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c105(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c106) { - s1 = peg$c106; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c107); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c108(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c109) { - s1 = peg$c109; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c111(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c112) { - s1 = peg$c112; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c114(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c115) { - s1 = peg$c115; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c116); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c117(); - } - s0 = s1; - if (s0 === peg$FAILED) { - s0 = peg$parseESCAPED_UNICODE(); - } - } - } - } - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseESCAPED_UNICODE() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; - - var key = peg$currPos * 49 + 48, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c118) { - s1 = peg$c118; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parseHEX(); - if (s3 !== peg$FAILED) { - s4 = peg$parseHEX(); - if (s4 !== peg$FAILED) { - s5 = peg$parseHEX(); - if (s5 !== peg$FAILED) { - s6 = peg$parseHEX(); - if (s6 !== peg$FAILED) { - s7 = peg$parseHEX(); - if (s7 !== peg$FAILED) { - s8 = peg$parseHEX(); - if (s8 !== peg$FAILED) { - s9 = peg$parseHEX(); - if (s9 !== peg$FAILED) { - s10 = peg$parseHEX(); - if (s10 !== peg$FAILED) { - s3 = [s3, s4, s5, s6, s7, s8, s9, s10]; - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c120(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c121) { - s1 = peg$c121; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c122); } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parseHEX(); - if (s3 !== peg$FAILED) { - s4 = peg$parseHEX(); - if (s4 !== peg$FAILED) { - s5 = peg$parseHEX(); - if (s5 !== peg$FAILED) { - s6 = peg$parseHEX(); - if (s6 !== peg$FAILED) { - s3 = [s3, s4, s5, s6]; - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c120(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - - var nodes = []; - - function genError(err, line, col) { - var ex = new Error(err); - ex.line = line; - ex.column = col; - throw ex; - } - - function addNode(node) { - nodes.push(node); - } - - function node(type, value, line, column, key) { - var obj = { type: type, value: value, line: line(), column: column() }; - if (key) obj.key = key; - return obj; - } - - function convertCodePoint(str, line, col) { - var num = parseInt("0x" + str); - - if ( - !isFinite(num) || - Math.floor(num) != num || - num < 0 || - num > 0x10FFFF || - (num > 0xD7FF && num < 0xE000) - ) { - genError("Invalid Unicode escape code: " + str, line, col); - } else { - return fromCodePoint(num); - } - } - - function fromCodePoint() { - var MAX_SIZE = 0x4000; - var codeUnits = []; - var highSurrogate; - var lowSurrogate; - var index = -1; - var length = arguments.length; - if (!length) { - return ''; - } - var result = ''; - while (++index < length) { - var codePoint = Number(arguments[index]); - if (codePoint <= 0xFFFF) { // BMP code point - codeUnits.push(codePoint); - } else { // Astral code point; split in surrogate halves - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - codePoint -= 0x10000; - highSurrogate = (codePoint >> 10) + 0xD800; - lowSurrogate = (codePoint % 0x400) + 0xDC00; - codeUnits.push(highSurrogate, lowSurrogate); - } - if (index + 1 == length || codeUnits.length > MAX_SIZE) { - result += String.fromCharCode.apply(null, codeUnits); - codeUnits.length = 0; - } - } - return result; - } - - - peg$result = peg$startRuleFunction(); - - if (peg$result !== peg$FAILED && peg$currPos === input.length) { - return peg$result; - } else { - if (peg$result !== peg$FAILED && peg$currPos < input.length) { - peg$fail({ type: "end", description: "end of input" }); - } - - throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos); - } - } - - return { - SyntaxError: SyntaxError, - parse: parse - }; -})(); diff --git a/node_modules/toml/package.json b/node_modules/toml/package.json deleted file mode 100644 index d9a134e..0000000 --- a/node_modules/toml/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "toml", - "version": "3.0.0", - "description": "TOML parser for Node.js (parses TOML spec v0.4.0)", - "main": "index.js", - "types": "index.d.ts", - "scripts": { - "build": "pegjs --cache src/toml.pegjs lib/parser.js", - "test": "jshint lib/compiler.js && nodeunit test/test_*.js", - "prepublish": "npm run build" - }, - "repository": "git://github.com/BinaryMuse/toml-node.git", - "keywords": [ - "toml", - "parser" - ], - "author": "Michelle Tilley ", - "license": "MIT", - "devDependencies": { - "jshint": "*", - "nodeunit": "~0.9.0", - "pegjs": "~0.8.0" - } - -,"_resolved": "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz" -,"_integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==" -,"_from": "toml@3.0.0" -} \ No newline at end of file diff --git a/node_modules/toml/src/toml.pegjs b/node_modules/toml/src/toml.pegjs deleted file mode 100644 index 7051707..0000000 --- a/node_modules/toml/src/toml.pegjs +++ /dev/null @@ -1,231 +0,0 @@ -{ - var nodes = []; - - function genError(err, line, col) { - var ex = new Error(err); - ex.line = line; - ex.column = col; - throw ex; - } - - function addNode(node) { - nodes.push(node); - } - - function node(type, value, line, column, key) { - var obj = { type: type, value: value, line: line(), column: column() }; - if (key) obj.key = key; - return obj; - } - - function convertCodePoint(str, line, col) { - var num = parseInt("0x" + str); - - if ( - !isFinite(num) || - Math.floor(num) != num || - num < 0 || - num > 0x10FFFF || - (num > 0xD7FF && num < 0xE000) - ) { - genError("Invalid Unicode escape code: " + str, line, col); - } else { - return fromCodePoint(num); - } - } - - function fromCodePoint() { - var MAX_SIZE = 0x4000; - var codeUnits = []; - var highSurrogate; - var lowSurrogate; - var index = -1; - var length = arguments.length; - if (!length) { - return ''; - } - var result = ''; - while (++index < length) { - var codePoint = Number(arguments[index]); - if (codePoint <= 0xFFFF) { // BMP code point - codeUnits.push(codePoint); - } else { // Astral code point; split in surrogate halves - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - codePoint -= 0x10000; - highSurrogate = (codePoint >> 10) + 0xD800; - lowSurrogate = (codePoint % 0x400) + 0xDC00; - codeUnits.push(highSurrogate, lowSurrogate); - } - if (index + 1 == length || codeUnits.length > MAX_SIZE) { - result += String.fromCharCode.apply(null, codeUnits); - codeUnits.length = 0; - } - } - return result; - } -} - -start - = line* { return nodes } - -line - = S* expr:expression S* comment* (NL+ / EOF) - / S+ (NL+ / EOF) - / NL - -expression - = comment / path / tablearray / assignment - -comment - = '#' (!(NL / EOF) .)* - -path - = '[' S* name:table_key S* ']' { addNode(node('ObjectPath', name, line, column)) } - -tablearray - = '[' '[' S* name:table_key S* ']' ']' { addNode(node('ArrayPath', name, line, column)) } - -table_key - = parts:dot_ended_table_key_part+ name:table_key_part { return parts.concat(name) } - / name:table_key_part { return [name] } - -table_key_part - = S* name:key S* { return name } - / S* name:quoted_key S* { return name } - -dot_ended_table_key_part - = S* name:key S* '.' S* { return name } - / S* name:quoted_key S* '.' S* { return name } - -assignment - = key:key S* '=' S* value:value { addNode(node('Assign', value, line, column, key)) } - / key:quoted_key S* '=' S* value:value { addNode(node('Assign', value, line, column, key)) } - -key - = chars:ASCII_BASIC+ { return chars.join('') } - -quoted_key - = node:double_quoted_single_line_string { return node.value } - / node:single_quoted_single_line_string { return node.value } - -value - = string / datetime / float / integer / boolean / array / inline_table - -string - = double_quoted_multiline_string - / double_quoted_single_line_string - / single_quoted_multiline_string - / single_quoted_single_line_string - -double_quoted_multiline_string - = '"""' NL? chars:multiline_string_char* '"""' { return node('String', chars.join(''), line, column) } -double_quoted_single_line_string - = '"' chars:string_char* '"' { return node('String', chars.join(''), line, column) } -single_quoted_multiline_string - = "'''" NL? chars:multiline_literal_char* "'''" { return node('String', chars.join(''), line, column) } -single_quoted_single_line_string - = "'" chars:literal_char* "'" { return node('String', chars.join(''), line, column) } - -string_char - = ESCAPED / (!'"' char:. { return char }) - -literal_char - = (!"'" char:. { return char }) - -multiline_string_char - = ESCAPED / multiline_string_delim / (!'"""' char:. { return char}) - -multiline_string_delim - = '\\' NL NLS* { return '' } - -multiline_literal_char - = (!"'''" char:. { return char }) - -float - = left:(float_text / integer_text) ('e' / 'E') right:integer_text { return node('Float', parseFloat(left + 'e' + right), line, column) } - / text:float_text { return node('Float', parseFloat(text), line, column) } - -float_text - = '+'? digits:(DIGITS '.' DIGITS) { return digits.join('') } - / '-' digits:(DIGITS '.' DIGITS) { return '-' + digits.join('') } - -integer - = text:integer_text { return node('Integer', parseInt(text, 10), line, column) } - -integer_text - = '+'? digits:DIGIT+ !'.' { return digits.join('') } - / '-' digits:DIGIT+ !'.' { return '-' + digits.join('') } - -boolean - = 'true' { return node('Boolean', true, line, column) } - / 'false' { return node('Boolean', false, line, column) } - -array - = '[' array_sep* ']' { return node('Array', [], line, column) } - / '[' value:array_value? ']' { return node('Array', value ? [value] : [], line, column) } - / '[' values:array_value_list+ ']' { return node('Array', values, line, column) } - / '[' values:array_value_list+ value:array_value ']' { return node('Array', values.concat(value), line, column) } - -array_value - = array_sep* value:value array_sep* { return value } - -array_value_list - = array_sep* value:value array_sep* ',' array_sep* { return value } - -array_sep - = S / NL / comment - -inline_table - = '{' S* values:inline_table_assignment* S* '}' { return node('InlineTable', values, line, column) } - -inline_table_assignment - = S* key:key S* '=' S* value:value S* ',' S* { return node('InlineTableValue', value, line, column, key) } - / S* key:key S* '=' S* value:value { return node('InlineTableValue', value, line, column, key) } - -secfragment - = '.' digits:DIGITS { return "." + digits } - -date - = date:( - DIGIT DIGIT DIGIT DIGIT - '-' - DIGIT DIGIT - '-' - DIGIT DIGIT - ) { return date.join('') } - -time - = time:(DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT secfragment?) { return time.join('') } - -time_with_offset - = time:( - DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT secfragment? - ('-' / '+') - DIGIT DIGIT ':' DIGIT DIGIT - ) { return time.join('') } - -datetime - = date:date 'T' time:time 'Z' { return node('Date', new Date(date + "T" + time + "Z"), line, column) } - / date:date 'T' time:time_with_offset { return node('Date', new Date(date + "T" + time), line, column) } - - -S = [ \t] -NL = "\n" / "\r" "\n" -NLS = NL / S -EOF = !. -HEX = [0-9a-f]i -DIGIT = DIGIT_OR_UNDER -DIGIT_OR_UNDER = [0-9] - / '_' { return "" } -ASCII_BASIC = [A-Za-z0-9_\-] -DIGITS = d:DIGIT_OR_UNDER+ { return d.join('') } -ESCAPED = '\\"' { return '"' } - / '\\\\' { return '\\' } - / '\\b' { return '\b' } - / '\\t' { return '\t' } - / '\\n' { return '\n' } - / '\\f' { return '\f' } - / '\\r' { return '\r' } - / ESCAPED_UNICODE -ESCAPED_UNICODE = "\\U" digits:(HEX HEX HEX HEX HEX HEX HEX HEX) { return convertCodePoint(digits.join('')) } - / "\\u" digits:(HEX HEX HEX HEX) { return convertCodePoint(digits.join('')) } diff --git a/node_modules/toml/test/bad.toml b/node_modules/toml/test/bad.toml deleted file mode 100644 index d51c3f3..0000000 --- a/node_modules/toml/test/bad.toml +++ /dev/null @@ -1,5 +0,0 @@ -[something] -awesome = "this is" - -[something.awesome] -this = "isn't" diff --git a/node_modules/toml/test/example.toml b/node_modules/toml/test/example.toml deleted file mode 100644 index ea9dc35..0000000 --- a/node_modules/toml/test/example.toml +++ /dev/null @@ -1,32 +0,0 @@ -# This is a TOML document. Boom. - -title = "TOML Example" - -[owner] -name = "Tom Preston-Werner" -organization = "GitHub" -bio = "GitHub Cofounder & CEO\n\tLikes \"tater tots\" and beer and backslashes: \\" -dob = 1979-05-27T07:32:00Z # First class dates? Why not? - -[database] -server = "192.168.1.1" -ports = [ 8001, 8001, 8003 ] -connection_max = 5000 -connection_min = -2 # Don't ask me how -max_temp = 87.1 # It's a float -min_temp = -17.76 -enabled = true - -[servers] - - # You can indent as you please. Tabs or spaces. TOML don't care. - [servers.alpha] - ip = "10.0.0.1" - dc = "eqdc10" - - [servers.beta] - ip = "10.0.0.2" - dc = "eqdc10" - -[clients] -data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it diff --git a/node_modules/toml/test/hard_example.toml b/node_modules/toml/test/hard_example.toml deleted file mode 100644 index 38856c8..0000000 --- a/node_modules/toml/test/hard_example.toml +++ /dev/null @@ -1,33 +0,0 @@ -# Test file for TOML -# Only this one tries to emulate a TOML file written by a user of the kind of parser writers probably hate -# This part you'll really hate - -[the] -test_string = "You'll hate me after this - #" # " Annoying, isn't it? - - [the.hard] - test_array = [ "] ", " # "] # ] There you go, parse this! - test_array2 = [ "Test #11 ]proved that", "Experiment #9 was a success" ] - # You didn't think it'd as easy as chucking out the last #, did you? - another_test_string = " Same thing, but with a string #" - harder_test_string = " And when \"'s are in the string, along with # \"" # "and comments are there too" - # Things will get harder - - [the.hard."bit#"] - "what?" = "You don't think some user won't do that?" - multi_line_array = [ - "]", - # ] Oh yes I did - ] - -# Each of the following keygroups/key value pairs should produce an error. Uncomment to them to test - -#[error] if you didn't catch this, your parser is broken -#string = "Anything other than tabs, spaces and newline after a keygroup or key value pair has ended should produce an error unless it is a comment" like this -#array = [ -# "This might most likely happen in multiline arrays", -# Like here, -# "or here, -# and here" -# ] End of array comment, forgot the # -#number = 3.14 pi <--again forgot the # diff --git a/node_modules/toml/test/inline_tables.toml b/node_modules/toml/test/inline_tables.toml deleted file mode 100644 index c91088e..0000000 --- a/node_modules/toml/test/inline_tables.toml +++ /dev/null @@ -1,10 +0,0 @@ -name = { first = "Tom", last = "Preston-Werner" } -point = { x = 1, y = 2 } -nested = { x = { a = { b = 3 } } } - -points = [ { x = 1, y = 2, z = 3 }, - { x = 7, y = 8, z = 9 }, - { x = 2, y = 4, z = 8 } ] - -arrays = [ { x = [1, 2, 3], y = [4, 5, 6] }, - { x = [7, 8, 9], y = [0, 1, 2] } ] diff --git a/node_modules/toml/test/literal_strings.toml b/node_modules/toml/test/literal_strings.toml deleted file mode 100644 index 36772bb..0000000 --- a/node_modules/toml/test/literal_strings.toml +++ /dev/null @@ -1,5 +0,0 @@ -# What you see is what you get. -winpath = 'C:\Users\nodejs\templates' -winpath2 = '\\ServerX\admin$\system32\' -quoted = 'Tom "Dubs" Preston-Werner' -regex = '<\i\c*\s*>' diff --git a/node_modules/toml/test/multiline_eat_whitespace.toml b/node_modules/toml/test/multiline_eat_whitespace.toml deleted file mode 100644 index 904c170..0000000 --- a/node_modules/toml/test/multiline_eat_whitespace.toml +++ /dev/null @@ -1,15 +0,0 @@ -# The following strings are byte-for-byte equivalent: -key1 = "The quick brown fox jumps over the lazy dog." - -key2 = """ -The quick brown \ - - - fox jumps over \ - the lazy dog.""" - -key3 = """\ - The quick brown \ - fox jumps over \ - the lazy dog.\ - """ diff --git a/node_modules/toml/test/multiline_literal_strings.toml b/node_modules/toml/test/multiline_literal_strings.toml deleted file mode 100644 index bc88494..0000000 --- a/node_modules/toml/test/multiline_literal_strings.toml +++ /dev/null @@ -1,7 +0,0 @@ -regex2 = '''I [dw]on't need \d{2} apples''' -lines = ''' -The first newline is -trimmed in raw strings. - All other whitespace - is preserved. -''' diff --git a/node_modules/toml/test/multiline_strings.toml b/node_modules/toml/test/multiline_strings.toml deleted file mode 100644 index 6eb8c45..0000000 --- a/node_modules/toml/test/multiline_strings.toml +++ /dev/null @@ -1,6 +0,0 @@ -# The following strings are byte-for-byte equivalent: -key1 = "One\nTwo" -key2 = """One\nTwo""" -key3 = """ -One -Two""" diff --git a/node_modules/toml/test/smoke.js b/node_modules/toml/test/smoke.js deleted file mode 100644 index 7769f9c..0000000 --- a/node_modules/toml/test/smoke.js +++ /dev/null @@ -1,22 +0,0 @@ -var fs = require('fs'); -var parser = require('../index'); - -var codes = [ - "# test\n my.key=\"value\"\nother = 101\nthird = -37", - "first = 1.2\nsecond = -56.02\nth = true\nfth = false", - "time = 1979-05-27T07:32:00Z", - "test = [\"one\", ]", - "test = [[1, 2,], [true, false,],]", - "[my.sub.path]\nkey = true\nother = -15.3\n[my.sub]\nkey=false", - "arry = [\"one\", \"two\",\"thr\nee\", \"\\u03EA\"]", - fs.readFileSync(__dirname + '/example.toml', 'utf8'), - fs.readFileSync(__dirname + '/hard_example.toml', 'utf8') -] - -console.log("============================================="); -for(i in codes) { - var code = codes[i]; - console.log(code + "\n"); - console.log(JSON.stringify(parser.parse(code))); - console.log("============================================="); -} diff --git a/node_modules/toml/test/table_arrays_easy.toml b/node_modules/toml/test/table_arrays_easy.toml deleted file mode 100644 index ac3883b..0000000 --- a/node_modules/toml/test/table_arrays_easy.toml +++ /dev/null @@ -1,10 +0,0 @@ -[[products]] -name = "Hammer" -sku = 738594937 - -[[products]] - -[[products]] -name = "Nail" -sku = 284758393 -color = "gray" diff --git a/node_modules/toml/test/table_arrays_hard.toml b/node_modules/toml/test/table_arrays_hard.toml deleted file mode 100644 index 2ade540..0000000 --- a/node_modules/toml/test/table_arrays_hard.toml +++ /dev/null @@ -1,31 +0,0 @@ -[[fruit]] -name = "durian" -variety = [] - -[[fruit]] -name = "apple" - - [fruit.physical] - color = "red" - shape = "round" - - [[fruit.variety]] - name = "red delicious" - - [[fruit.variety]] - name = "granny smith" - -[[fruit]] - -[[fruit]] -name = "banana" - - [[fruit.variety]] - name = "plantain" - -[[fruit]] -name = "orange" - -[fruit.physical] -color = "orange" -shape = "round" diff --git a/node_modules/toml/test/test_toml.js b/node_modules/toml/test/test_toml.js deleted file mode 100644 index 1f654b3..0000000 --- a/node_modules/toml/test/test_toml.js +++ /dev/null @@ -1,596 +0,0 @@ -var toml = require('../'); -var fs = require('fs'); - -var assert = require("nodeunit").assert; - -assert.parsesToml = function(tomlStr, expected) { - try { - var actual = toml.parse(tomlStr); - } catch (e) { - var errInfo = "line: " + e.line + ", column: " + e.column; - return assert.fail("TOML parse error: " + e.message, errInfo, null, "at", assert.parsesToml); - } - return assert.deepEqual(actual, expected); -}; - -var exampleExpected = { - title: "TOML Example", - owner: { - name: "Tom Preston-Werner", - organization: "GitHub", - bio: "GitHub Cofounder & CEO\n\tLikes \"tater tots\" and beer and backslashes: \\", - dob: new Date("1979-05-27T07:32:00Z") - }, - database: { - server: "192.168.1.1", - ports: [8001, 8001, 8003], - connection_max: 5000, - connection_min: -2, - max_temp: 87.1, - min_temp: -17.76, - enabled: true - }, - servers: { - alpha: { - ip: "10.0.0.1", - dc: "eqdc10" - }, - beta: { - ip: "10.0.0.2", - dc: "eqdc10" - } - }, - clients: { - data: [ ["gamma", "delta"], [1, 2] ] - } -}; - -var hardExampleExpected = { - the: { - hard: { - another_test_string: ' Same thing, but with a string #', - 'bit#': { - multi_line_array: [']'], - 'what?': "You don't think some user won't do that?" - }, - harder_test_string: " And when \"'s are in the string, along with # \"", - test_array: ['] ', ' # '], - test_array2: ['Test #11 ]proved that', 'Experiment #9 was a success'] - }, - test_string: "You'll hate me after this - #" - } -}; - -var easyTableArrayExpected = { - "products": [ - { "name": "Hammer", "sku": 738594937 }, - { }, - { "name": "Nail", "sku": 284758393, "color": "gray" } - ] -}; - -var hardTableArrayExpected = { - "fruit": [ - { - "name": "durian", - "variety": [] - }, - { - "name": "apple", - "physical": { - "color": "red", - "shape": "round" - }, - "variety": [ - { "name": "red delicious" }, - { "name": "granny smith" } - ] - }, - {}, - { - "name": "banana", - "variety": [ - { "name": "plantain" } - ] - }, - { - "name": "orange", - "physical": { - "color": "orange", - "shape": "round" - } - } - ] -} - -var badInputs = [ - '[error] if you didn\'t catch this, your parser is broken', - 'string = "Anything other than tabs, spaces and newline after a table or key value pair has ended should produce an error unless it is a comment" like this', - 'array = [\n \"This might most likely happen in multiline arrays\",\n Like here,\n \"or here,\n and here\"\n ] End of array comment, forgot the #', - 'number = 3.14 pi <--again forgot the #' -]; - -exports.testParsesExample = function(test) { - var str = fs.readFileSync(__dirname + "/example.toml", 'utf-8') - test.parsesToml(str, exampleExpected); - test.done(); -}; - -exports.testParsesHardExample = function(test) { - var str = fs.readFileSync(__dirname + "/hard_example.toml", 'utf-8') - test.parsesToml(str, hardExampleExpected); - test.done(); -}; - -exports.testEasyTableArrays = function(test) { - var str = fs.readFileSync(__dirname + "/table_arrays_easy.toml", 'utf8') - test.parsesToml(str, easyTableArrayExpected); - test.done(); -}; - -exports.testHarderTableArrays = function(test) { - var str = fs.readFileSync(__dirname + "/table_arrays_hard.toml", 'utf8') - test.parsesToml(str, hardTableArrayExpected); - test.done(); -}; - -exports.testSupportsTrailingCommasInArrays = function(test) { - var str = 'arr = [1, 2, 3,]'; - var expected = { arr: [1, 2, 3] }; - test.parsesToml(str, expected); - test.done(); -}; - -exports.testSingleElementArrayWithNoTrailingComma = function(test) { - var str = "a = [1]"; - test.parsesToml(str, { - a: [1] - }); - test.done(); -}; - -exports.testEmptyArray = function(test) { - var str = "a = []"; - test.parsesToml(str, { - a: [] - }); - test.done(); -}; - -exports.testArrayWithWhitespace = function(test) { - var str = "[versions]\nfiles = [\n 3, \n 5 \n\n ]"; - test.parsesToml(str, { - versions: { - files: [3, 5] - } - }); - test.done(); -}; - -exports.testEmptyArrayWithWhitespace = function(test) { - var str = "[versions]\nfiles = [\n \n ]"; - test.parsesToml(str, { - versions: { - files: [] - } - }); - test.done(); -}; - -exports.testDefineOnSuperkey = function(test) { - var str = "[a.b]\nc = 1\n\n[a]\nd = 2"; - var expected = { - a: { - b: { - c: 1 - }, - d: 2 - } - }; - test.parsesToml(str, expected); - test.done(); -}; - -exports.testWhitespace = function(test) { - var str = "a = 1\n \n b = 2 "; - test.parsesToml(str, { - a: 1, b: 2 - }); - test.done(); -}; - -exports.testUnicode = function(test) { - var str = "str = \"My name is Jos\\u00E9\""; - test.parsesToml(str, { - str: "My name is Jos\u00E9" - }); - - var str = "str = \"My name is Jos\\U000000E9\""; - test.parsesToml(str, { - str: "My name is Jos\u00E9" - }); - test.done(); -}; - -exports.testMultilineStrings = function(test) { - var str = fs.readFileSync(__dirname + "/multiline_strings.toml", 'utf8'); - test.parsesToml(str, { - key1: "One\nTwo", - key2: "One\nTwo", - key3: "One\nTwo" - }); - test.done(); -}; - -exports.testMultilineEatWhitespace = function(test) { - var str = fs.readFileSync(__dirname + "/multiline_eat_whitespace.toml", 'utf8'); - test.parsesToml(str, { - key1: "The quick brown fox jumps over the lazy dog.", - key2: "The quick brown fox jumps over the lazy dog.", - key3: "The quick brown fox jumps over the lazy dog." - }); - test.done(); -}; - -exports.testLiteralStrings = function(test) { - var str = fs.readFileSync(__dirname + "/literal_strings.toml", 'utf8'); - test.parsesToml(str, { - winpath: "C:\\Users\\nodejs\\templates", - winpath2: "\\\\ServerX\\admin$\\system32\\", - quoted: "Tom \"Dubs\" Preston-Werner", - regex: "<\\i\\c*\\s*>" - }); - test.done(); -}; - -exports.testMultilineLiteralStrings = function(test) { - var str = fs.readFileSync(__dirname + "/multiline_literal_strings.toml", 'utf8'); - test.parsesToml(str, { - regex2: "I [dw]on't need \\d{2} apples", - lines: "The first newline is\ntrimmed in raw strings.\n All other whitespace\n is preserved.\n" - }); - test.done(); -}; - -exports.testIntegerFormats = function(test) { - var str = "a = +99\nb = 42\nc = 0\nd = -17\ne = 1_000_001\nf = 1_2_3_4_5 # why u do dis"; - test.parsesToml(str, { - a: 99, - b: 42, - c: 0, - d: -17, - e: 1000001, - f: 12345 - }); - test.done(); -}; - -exports.testFloatFormats = function(test) { - var str = "a = +1.0\nb = 3.1415\nc = -0.01\n" + - "d = 5e+22\ne = 1e6\nf = -2E-2\n" + - "g = 6.626e-34\n" + - "h = 9_224_617.445_991_228_313\n" + - "i = 1e1_000"; - test.parsesToml(str, { - a: 1.0, - b: 3.1415, - c: -0.01, - d: 5e22, - e: 1e6, - f: -2e-2, - g: 6.626e-34, - h: 9224617.445991228313, - i: 1e1000 - }); - test.done(); -}; - -exports.testDate = function(test) { - var date = new Date("1979-05-27T07:32:00Z"); - test.parsesToml("a = 1979-05-27T07:32:00Z", { - a: date - }); - test.done(); -}; - -exports.testDateWithOffset = function(test) { - var date1 = new Date("1979-05-27T07:32:00-07:00"), - date2 = new Date("1979-05-27T07:32:00+02:00"); - test.parsesToml("a = 1979-05-27T07:32:00-07:00\nb = 1979-05-27T07:32:00+02:00", { - a: date1, - b: date2 - }); - test.done(); -}; - -exports.testDateWithSecondFraction = function(test) { - var date = new Date("1979-05-27T00:32:00.999999-07:00"); - test.parsesToml("a = 1979-05-27T00:32:00.999999-07:00", { - a: date - }); - test.done(); -}; - -exports.testDateFromIsoString = function(test) { - // https://github.com/BinaryMuse/toml-node/issues/20 - var date = new Date(), - dateStr = date.toISOString(), - tomlStr = "a = " + dateStr; - - test.parsesToml(tomlStr, { - a: date - }); - test.done(); -}; - -exports.testLeadingNewlines = function(test) { - // https://github.com/BinaryMuse/toml-node/issues/22 - var str = "\ntest = \"ing\""; - test.parsesToml(str, { - test: "ing" - }); - test.done(); -}; - -exports.testInlineTables = function(test) { - var str = fs.readFileSync(__dirname + "/inline_tables.toml", 'utf8'); - test.parsesToml(str, { - name: { - first: "Tom", - last: "Preston-Werner" - }, - point: { - x: 1, - y: 2 - }, - nested: { - x: { - a: { - b: 3 - } - } - }, - points: [ - { x: 1, y: 2, z: 3 }, - { x: 7, y: 8, z: 9 }, - { x: 2, y: 4, z: 8 } - ], - arrays: [ - { x: [1, 2, 3], y: [4, 5, 6] }, - { x: [7, 8, 9], y: [0, 1, 2] } - ] - }); - test.done(); -}; - -exports.testEmptyInlineTables = function(test) { - // https://github.com/BinaryMuse/toml-node/issues/24 - var str = "a = { }"; - test.parsesToml(str, { - a: {} - }); - test.done(); -}; - -exports.testKeyNamesWithWhitespaceAroundStartAndFinish = function(test) { - var str = "[ a ]\nb = 1"; - test.parsesToml(str, { - a: { - b: 1 - } - }); - test.done(); -}; - -exports.testKeyNamesWithWhitespaceAroundDots = function(test) { - var str = "[ a . b . c]\nd = 1"; - test.parsesToml(str, { - a: { - b: { - c: { - d: 1 - } - } - } - }); - test.done(); -}; - -exports.testSimpleQuotedKeyNames = function(test) { - var str = "[\"ʞ\"]\na = 1"; - test.parsesToml(str, { - "ʞ": { - a: 1 - } - }); - test.done(); -}; - -exports.testComplexQuotedKeyNames = function(test) { - var str = "[ a . \"ʞ\" . c ]\nd = 1"; - test.parsesToml(str, { - a: { - "ʞ": { - c: { - d: 1 - } - } - } - }); - test.done(); -}; - -exports.testEscapedQuotesInQuotedKeyNames = function(test) { - test.parsesToml("[\"the \\\"thing\\\"\"]\na = true", { - 'the "thing"': { - a: true - } - }); - test.done(); -}; - -exports.testMoreComplexQuotedKeyNames = function(test) { - // https://github.com/BinaryMuse/toml-node/issues/21 - test.parsesToml('["the\\ key"]\n\none = "one"\ntwo = 2\nthree = false', { - "the\\ key": { - one: "one", - two: 2, - three: false - } - }); - test.parsesToml('[a."the\\ key"]\n\none = "one"\ntwo = 2\nthree = false', { - a: { - "the\\ key": { - one: "one", - two: 2, - three: false - } - } - }); - test.parsesToml('[a."the-key"]\n\none = "one"\ntwo = 2\nthree = false', { - a: { - "the-key": { - one: "one", - two: 2, - three: false - } - } - }); - test.parsesToml('[a."the.key"]\n\none = "one"\ntwo = 2\nthree = false', { - a: { - "the.key": { - one: "one", - two: 2, - three: false - } - } - }); - // https://github.com/BinaryMuse/toml-node/issues/34 - test.parsesToml('[table]\n\'a "quoted value"\' = "value"', { - table: { - 'a "quoted value"': "value" - } - }); - // https://github.com/BinaryMuse/toml-node/issues/33 - test.parsesToml('[module]\n"foo=bar" = "zzz"', { - module: { - "foo=bar": "zzz" - } - }); - - test.done(); -}; - -exports.testErrorOnBadUnicode = function(test) { - var str = "str = \"My name is Jos\\uD800\""; - test.throws(function() { - toml.parse(str); - }); - test.done(); -}; - -exports.testErrorOnDotAtStartOfKey = function(test) { - test.throws(function() { - var str = "[.a]\nb = 1"; - toml.parse(str); - }); - test.done() -}; - -exports.testErrorOnDotAtEndOfKey = function(test) { - test.throws(function() { - var str = "[.a]\nb = 1"; - toml.parse(str); - }); - test.done() -}; - -exports.testErrorOnTableOverride = function(test) { - test.throws(function() { - var str = "[a]\nb = 1\n\n[a]\nc = 2"; - toml.parse(str); - }); - test.done() -}; - -exports.testErrorOnKeyOverride = function(test) { - test.throws(function() { - var str = "[a]\nb = 1\n[a.b]\nc = 2"; - toml.parse(str); - }); - test.done() -}; - -exports.testErrorOnKeyOverrideWithNested = function(test) { - // https://github.com/BinaryMuse/toml-node/issues/23 - test.throws(function() { - var str = "[a]\nb = \"a\"\n[a.b.c]"; - toml.parse(str); - }, "existing key 'a.b'"); - test.done(); -}; - -exports.testErrorOnKeyOverrideWithArrayTable = function(test) { - test.throws(function() { - var str = "[a]\nb = 1\n[[a]]\nc = 2"; - toml.parse(str); - }); - test.done() -}; - -exports.testErrorOnKeyReplace = function(test) { - test.throws(function() { - var str = "[a]\nb = 1\nb = 2"; - toml.parse(str); - }); - test.done() -}; - -exports.testErrorOnInlineTableReplace = function(test) { - // https://github.com/BinaryMuse/toml-node/issues/25 - test.throws(function() { - var str = "a = { b = 1 }\n[a]\nc = 2"; - toml.parse(str); - }, "existing key 'a'"); - test.done(); -}; - -exports.testErrorOnArrayMismatch = function(test) { - test.throws(function() { - var str = 'data = [1, 2, "test"]' - toml.parse(str); - }); - test.done(); -}; - -exports.testErrorOnBadInputs = function(test) { - var count = 0; - for (i in badInputs) { - (function(num) { - test.throws(function() { - toml.parse(badInputs[num]); - }); - })(i); - } - test.done(); -}; - -exports.testErrorsHaveCorrectLineAndColumn = function(test) { - var str = "[a]\nb = 1\n [a.b]\nc = 2"; - try { toml.parse(str); } - catch (e) { - test.equal(e.line, 3); - test.equal(e.column, 2); - test.done(); - } -}; - -exports.testUsingConstructorAsKey = function(test) { - test.parsesToml("[empty]\n[emptier]\n[constructor]\nconstructor = 1\n[emptiest]", { - "empty": {}, - "emptier": {}, - "constructor": { "constructor": 1 }, - "emptiest": {} - }); - test.done(); -}; diff --git a/package.json b/package.json index 2d92fdc..6d0b988 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "conventional-changelog-action", - "version": "3.2.0", + "version": "3.3.0", "description": "Github Action that generates a changelog with the Conventional Changelog CLI", "keywords": [ "actions",