yaml 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/History.md +7 -0
- package/examples/null.yaml +8 -0
- package/lib/yaml.js +6 -3
- package/package.json +1 -1
package/History.md
CHANGED
package/lib/yaml.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
1
|
// YAML - Core - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Version triplet.
|
|
6
5
|
*/
|
|
7
6
|
|
|
8
|
-
exports.version = '0.2.
|
|
7
|
+
exports.version = '0.2.3'
|
|
9
8
|
|
|
10
9
|
// --- Helpers
|
|
11
10
|
|
|
@@ -39,6 +38,7 @@ var tokens = [
|
|
|
39
38
|
['space', /^ +/],
|
|
40
39
|
['true', /^\b(enabled|true|yes|on)\b/],
|
|
41
40
|
['false', /^\b(disabled|false|no|off)\b/],
|
|
41
|
+
['null', /^\b(null|Null|NULL|~)\b/],
|
|
42
42
|
['string', /^"(.*?)"/],
|
|
43
43
|
['string', /^'(.*?)'/],
|
|
44
44
|
['timestamp', /^((\d{4})-(\d\d?)-(\d\d?)(?:(?:[ \t]+)(\d\d?):(\d\d)(?::(\d\d))?)?)/],
|
|
@@ -66,7 +66,7 @@ var tokens = [
|
|
|
66
66
|
|
|
67
67
|
exports.tokenize = function (str) {
|
|
68
68
|
var token, captures, ignore, input,
|
|
69
|
-
indents = lastIndents = 0,
|
|
69
|
+
indents = 0, lastIndents = 0,
|
|
70
70
|
stack = [], indentAmount = -1
|
|
71
71
|
while (str.length) {
|
|
72
72
|
for (var i = 0, len = tokens.length; i < len; ++i)
|
|
@@ -223,6 +223,7 @@ Parser.prototype.ignoreWhitespace = function() {
|
|
|
223
223
|
* | int
|
|
224
224
|
* | true
|
|
225
225
|
* | false
|
|
226
|
+
* | null
|
|
226
227
|
*/
|
|
227
228
|
|
|
228
229
|
Parser.prototype.parse = function() {
|
|
@@ -249,6 +250,8 @@ Parser.prototype.parse = function() {
|
|
|
249
250
|
this.advanceValue(); return true
|
|
250
251
|
case 'false':
|
|
251
252
|
this.advanceValue(); return false
|
|
253
|
+
case 'null':
|
|
254
|
+
this.advanceValue(); return null
|
|
252
255
|
}
|
|
253
256
|
}
|
|
254
257
|
|
package/package.json
CHANGED