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 CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ 0.2.3 / 2011-12-05
3
+ ==================
4
+
5
+ * Added a "null.yaml" test case in the examples.
6
+ * Added support for NULL values.
7
+ * Fixed a global leak
8
+
2
9
  0.2.2 / 2011-08-31
3
10
  ==================
4
11
 
@@ -0,0 +1,8 @@
1
+ ---
2
+ test: A test for null values
3
+ thisis: null
4
+ thistoo: NULL
5
+ notnull: yes
6
+ tildeis: ~
7
+ capitalized: Null
8
+ end: test passed?
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.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
@@ -1,5 +1,5 @@
1
1
  { "name": "yaml",
2
- "version": "0.2.2",
2
+ "version": "0.2.3",
3
3
  "description": "Yaml parser",
4
4
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
5
5
  "main": "./lib/yaml.js"