Skip to content
This repository
Browse code

Removed debugger

  • Loading branch information...
commit c68665e10a534813f9366e7d1e9eb2a1376b0038 1 parent ddced67
Aleksey V. Zapparov authored October 31, 2011
9  lib/js-yaml/composer.js
@@ -3,8 +3,7 @@
3 3
 
4 4
 var JS = global.JS,
5 5
     exports = module.exports = {},
6  
-    __ = require('./core').import('error', 'events', 'nodes'),
7  
-    debug = require('./debug');
  6
+    __ = require('./core').import('error', 'events', 'nodes');
8 7
 
9 8
 
10 9
 JS.require('JS.Class');
@@ -49,15 +48,9 @@ exports.Composer = new JS.Class('Composer', {
49 48
     // Drop the STREAM-START event.
50 49
     this.getEvent();
51 50
 
52  
-    debug('composer#getSingleNode');
53  
-
54 51
     // Compose a document if the stream is not empty.
55 52
     if (!this.checkEvent(__.StreamEndEvent)) {
56 53
       document = this.composeDocument();
57  
-
58  
-      if (debug.ENABLED) {
59  
-        debug('composer#getSingleNode -- composed document', {document: document});
60  
-      }
61 54
     }
62 55
 
63 56
     // Ensure that the stream contains no more documents.
32  lib/js-yaml/constructor.js
@@ -4,8 +4,7 @@
4 4
 var JS = global.JS,
5 5
     exports = module.exports = {},
6 6
     $$ = require('./core'),
7  
-    __ = $$.import('types', 'error', 'nodes'),
8  
-    debug = require('./debug');
  7
+    __ = $$.import('types', 'error', 'nodes');
9 8
 
10 9
 
11 10
 JS.require('JS.Class');
@@ -84,9 +83,6 @@ var BaseConstructor = exports.BaseConstructor = new JS.Class('BaseConstructor',
84 83
   constructObject: function (node, deep) {
85 84
     var data, old_deep, constructor, populator;
86 85
 
87  
-    if (debug.ENABLED) {
88  
-      debug('constructor#constructObject', {node: node});
89  
-    }
90 86
 
91 87
     if (this.constructedObjects.hasKey(node)) {
92 88
       return this.constructedObjects.get(node);
@@ -162,17 +158,9 @@ var BaseConstructor = exports.BaseConstructor = new JS.Class('BaseConstructor',
162 158
 
163 159
     mapping = {};
164 160
 
165  
-    if (debug.ENABLED) {
166  
-      debug('constructor#constructMapping -- constructing', {value: node.value});
167  
-    }
168  
-
169 161
     $$.each(node.value, function (pair) {
170 162
       var key_node = pair[0], value_node = pair[1], key, value;
171 163
 
172  
-      if (debug.ENABLED) {
173  
-        debug('constructor#constructMapping -- got pair', {pair: pair});
174  
-      }
175  
-      
176 164
       key = this.constructObject(key_node, deep);
177 165
       // TODO: Replace with interface test???
178 166
       if (!node.isA(__.Hashable)) {
@@ -181,10 +169,6 @@ var BaseConstructor = exports.BaseConstructor = new JS.Class('BaseConstructor',
181 169
       }
182 170
       value = this.constructObject(value_node, deep);
183 171
 
184  
-      if (debug.ENABLED) {
185  
-        debug('constructor#constructMapping -- constructed', {key: key, value: value});
186  
-      }
187  
-
188 172
       mapping[key] = value;
189 173
     }, this);
190 174
 
@@ -224,10 +208,6 @@ var SafeConstructor = exports.SafeConstructor = new JS.Class('SafeConstructor',
224 208
   constructScalar: function (node) {
225 209
     var result;
226 210
 
227  
-    if (debug.ENABLED) {
228  
-      debug('constructor#constructScalar', {node: node});
229  
-    }
230  
-
231 211
     if (node.isA(__.MappingNode)) {
232 212
       $$.each(node.value, function (pair) {
233 213
         var key_node = pair[0], value_node = pair[1], value;
@@ -248,16 +228,10 @@ var SafeConstructor = exports.SafeConstructor = new JS.Class('SafeConstructor',
248 228
   flattenMapping: function (node) {
249 229
     var merge = [], index = 0, keyNode, valueNode, submerge;
250 230
 
251  
-    if (debug.ENABLED) {
252  
-      debug('constructor#flattenMapping -- start', {value: node.value});
253  
-    }
254  
-
255 231
     while (index < node.value.length) {
256 232
       keyNode = node.value[index][0];
257 233
       valueNode = node.value[index][1];
258 234
 
259  
-      debug('constructor#flattenMapping -- pair', {index: index, key: keyNode, val: valueNode});
260  
-
261 235
       if ('tag:yaml.org,2002:merge' === keyNode.tag) {
262 236
         delete node.value[index];
263 237
 
@@ -426,10 +400,6 @@ var SafeConstructor = exports.SafeConstructor = new JS.Class('SafeConstructor',
426 400
 
427 401
 
428 402
   constructUndefined: function (node) {
429  
-    if (debug.ENABLED) {
430  
-      debug('constructor#constructUndefined', {node: node});
431  
-    }
432  
-
433 403
     throw new ConstructorError(null, null,
434 404
                 "could not determine constructor for the tag " + node.tag,
435 405
                 node.startMark);
40  lib/js-yaml/debug.js
... ...
@@ -1,40 +0,0 @@
1  
-'use strict';
2  
-
3  
-
4  
-var DEBUG_ENABLED = (1 === +process.env.JSYAML_DEBUG);
5  
-var MAX_CALLS = +process.env.JSYAML_MAX_CALLS;
6  
-var i = 1;
7  
-
8  
-
9  
-var debug = function debug(msg, params) {
10  
-  console.log('*** ' + msg + ' [' + i + ']');
11  
-
12  
-  if ('object' === typeof params) {
13  
-    Object.getOwnPropertyNames(params).forEach(function (k) {
14  
-      var v = params[k], t = typeof v;
15  
-      console.log('    ' + k + ': <' + t + '> ' + v);
16  
-    });
17  
-  }
18  
-
19  
-  console.log('------------------------------------------------------------');
20  
-
21  
-  if (0 < MAX_CALLS && i >= MAX_CALLS) {
22  
-    throw new Error('JSYAML_MAX_CALLS reached');
23  
-  }
24  
-
25  
-  i++;
26  
-};
27  
-
28  
-
29  
-module.exports = DEBUG_ENABLED ? debug : function () {};
30  
-Object.defineProperty(module.exports, 'ENABLED', {
31  
-  value: DEBUG_ENABLED,
32  
-  writable: false,
33  
-  enumerable: false,
34  
-  configurable: false
35  
-});
36  
-
37  
-
38  
-////////////////////////////////////////////////////////////////////////////////
39  
-// vim:ts=2:sw=2
40  
-////////////////////////////////////////////////////////////////////////////////
11  lib/js-yaml/parser.js
@@ -65,8 +65,7 @@
65 65
 var JS = global.JS,
66 66
     exports = module.exports = {},
67 67
     assert = require('assert'),
68  
-    __ = require('./core').import('error', 'tokens', 'events', 'scanner'),
69  
-    debug = require('./debug');
  68
+    __ = require('./core').import('error', 'tokens', 'events', 'scanner');
70 69
 
71 70
 
72 71
 JS.require('JS.Class');
@@ -106,17 +105,9 @@ exports.Parser = new JS.Class('Parser', {
106 105
   checkEvent: function () {
107 106
     var i;
108 107
 
109  
-    if (debug.ENABLED) {
110  
-      debug('parser#checkEvent -- start', {event: this.currentEvent, argn: arguments.length});
111  
-    }
112  
-
113 108
     // Check the type of the next event.
114 109
     if (null === this.currentEvent && !!this.state) {
115 110
       this.currentEvent = this.state();
116  
-
117  
-      if (debug.ENABLED) {
118  
-        debug('parser#checkEvent -- change event', {event: this.currentEvent});
119  
-      }
120 111
     }
121 112
 
122 113
     if (null !== this.currentEvent) {
7  lib/js-yaml/reader.js
@@ -4,8 +4,7 @@
4 4
 var JS = global.JS,
5 5
     exports = module.exports = {},
6 6
     fs = require('fs'),
7  
-    __ = require('./core').import('error'),
8  
-    debug = require('./debug');
  7
+    __ = require('./core').import('error');
9 8
 
10 9
 
11 10
 JS.require('JS.Class');
@@ -78,10 +77,6 @@ exports.Reader = new JS.Class('Reader', {
78 77
       data = this.buffer[this.pointer + index];
79 78
     }
80 79
 
81  
-    if (debug.ENABLED) {
82  
-      debug('reader#peek', {index: index, data:data});
83  
-    }
84  
-
85 80
     return data;
86 81
   },
87 82
 
19  lib/js-yaml/resolver.js
@@ -3,8 +3,7 @@
3 3
 
4 4
 var JS = global.JS,
5 5
     exports = module.exports = {},
6  
-    __ = require('./core').import('nodes'),
7  
-    debug = require('./debug');
  6
+    __ = require('./core').import('nodes');
8 7
 
9 8
 
10 9
 JS.require('JS.Class');
@@ -30,10 +29,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
30 29
         first = [null];
31 30
       }
32 31
 
33  
-      if (debug.ENABLED) {
34  
-        debug('resolver#addImplicitResolver', {tag: tag, regexp: regexp, first: first});
35  
-      }
36  
-
37 32
       first.forEach(function (ch) {
38 33
         if (undefined === cls.yamlImplicitResolvers[ch]) {
39 34
           cls.yamlImplicitResolvers[ch] = [];
@@ -61,10 +56,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
61 56
   resolve: function (kind, value, implicit) {
62 57
     var resolvers, i, tag, regexp;
63 58
 
64  
-    if (debug.ENABLED) {
65  
-      debug('resolver#resolve', {kind: kind, value: value, implicit: implicit});
66  
-    }
67  
-
68 59
     if (kind === __.ScalarNode && implicit[0]) {
69 60
       if (value === '') {
70 61
         resolvers = this.yamlImplicitResolvers[''] || [];
@@ -74,10 +65,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
74 65
 
75 66
       resolvers = resolvers.concat(this.yamlImplicitResolvers[null] || []);
76 67
 
77  
-      if (debug.ENABLED) {
78  
-        debug('resolver#resolve -- resolving scalar tag', {resolvers: resolvers});
79  
-      }
80  
-
81 68
       for (i = 0; i < resolvers.length; i++) {
82 69
         tag = resolvers[i][0];
83 70
         regexp = resolvers[i][1];
@@ -99,10 +86,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
99 86
       tag = null;
100 87
     }
101 88
 
102  
-    if (debug.ENABLED) {
103  
-      debug('resolver#resolve -- tried default tags', {tag: tag});
104  
-    }
105  
-
106 89
     return tag;
107 90
   }
108 91
 });
13  lib/js-yaml/scanner.js
@@ -31,8 +31,7 @@ var JS = global.JS,
31 31
     exports = module.exports = {},
32 32
     assert = require('assert'),
33 33
     $$ = require('./core'),
34  
-    __ = $$.import('error', 'tokens'),
35  
-    debug = require('./debug');
  34
+    __ = $$.import('error', 'tokens');
36 35
 
37 36
 
38 37
 JS.require('JS.Class');
@@ -206,23 +205,13 @@ exports.Scanner = new JS.Class('Scanner', {
206 205
 
207 206
     // Return the next token.
208 207
 
209  
-    debug('scanner#getToken -- start');
210  
-
211 208
     while (this.needMoreTokens()) {
212 209
       this.fetchMoreTokens();
213 210
     }
214 211
 
215  
-    if (debug.ENABLED) {
216  
-      debug('scanner#getToken -- getting token', {tokens: this.tokens.length});
217  
-    }
218  
-
219 212
     if (this.tokens.length) {
220 213
       this.tokensTaken += 1;
221 214
       token = this.tokens.shift();
222  
-
223  
-      if (debug.ENABLED) {
224  
-        debug('scanner#getToken -- got token', {token: token});
225  
-      }
226 215
     }
227 216
 
228 217
     return token;

0 notes on commit c68665e

Please sign in to comment.
Something went wrong with that request. Please try again.