Permalink
Browse files

Removed debugger

  • Loading branch information...
1 parent ddced67 commit c68665e10a534813f9366e7d1e9eb2a1376b0038 @ixti ixti committed Oct 31, 2011
Showing with 6 additions and 125 deletions.
  1. +1 −8 lib/js-yaml/composer.js
  2. +1 −31 lib/js-yaml/constructor.js
  3. +0 −40 lib/js-yaml/debug.js
  4. +1 −10 lib/js-yaml/parser.js
  5. +1 −6 lib/js-yaml/reader.js
  6. +1 −18 lib/js-yaml/resolver.js
  7. +1 −12 lib/js-yaml/scanner.js
View
@@ -3,8 +3,7 @@
var JS = global.JS,
exports = module.exports = {},
- __ = require('./core').import('error', 'events', 'nodes'),
- debug = require('./debug');
+ __ = require('./core').import('error', 'events', 'nodes');
JS.require('JS.Class');
@@ -49,15 +48,9 @@ exports.Composer = new JS.Class('Composer', {
// Drop the STREAM-START event.
this.getEvent();
- debug('composer#getSingleNode');
-
// Compose a document if the stream is not empty.
if (!this.checkEvent(__.StreamEndEvent)) {
document = this.composeDocument();
-
- if (debug.ENABLED) {
- debug('composer#getSingleNode -- composed document', {document: document});
- }
}
// Ensure that the stream contains no more documents.
View
@@ -4,8 +4,7 @@
var JS = global.JS,
exports = module.exports = {},
$$ = require('./core'),
- __ = $$.import('types', 'error', 'nodes'),
- debug = require('./debug');
+ __ = $$.import('types', 'error', 'nodes');
JS.require('JS.Class');
@@ -84,9 +83,6 @@ var BaseConstructor = exports.BaseConstructor = new JS.Class('BaseConstructor',
constructObject: function (node, deep) {
var data, old_deep, constructor, populator;
- if (debug.ENABLED) {
- debug('constructor#constructObject', {node: node});
- }
if (this.constructedObjects.hasKey(node)) {
return this.constructedObjects.get(node);
@@ -162,17 +158,9 @@ var BaseConstructor = exports.BaseConstructor = new JS.Class('BaseConstructor',
mapping = {};
- if (debug.ENABLED) {
- debug('constructor#constructMapping -- constructing', {value: node.value});
- }
-
$$.each(node.value, function (pair) {
var key_node = pair[0], value_node = pair[1], key, value;
- if (debug.ENABLED) {
- debug('constructor#constructMapping -- got pair', {pair: pair});
- }
-
key = this.constructObject(key_node, deep);
// TODO: Replace with interface test???
if (!node.isA(__.Hashable)) {
@@ -181,10 +169,6 @@ var BaseConstructor = exports.BaseConstructor = new JS.Class('BaseConstructor',
}
value = this.constructObject(value_node, deep);
- if (debug.ENABLED) {
- debug('constructor#constructMapping -- constructed', {key: key, value: value});
- }
-
mapping[key] = value;
}, this);
@@ -224,10 +208,6 @@ var SafeConstructor = exports.SafeConstructor = new JS.Class('SafeConstructor',
constructScalar: function (node) {
var result;
- if (debug.ENABLED) {
- debug('constructor#constructScalar', {node: node});
- }
-
if (node.isA(__.MappingNode)) {
$$.each(node.value, function (pair) {
var key_node = pair[0], value_node = pair[1], value;
@@ -248,16 +228,10 @@ var SafeConstructor = exports.SafeConstructor = new JS.Class('SafeConstructor',
flattenMapping: function (node) {
var merge = [], index = 0, keyNode, valueNode, submerge;
- if (debug.ENABLED) {
- debug('constructor#flattenMapping -- start', {value: node.value});
- }
-
while (index < node.value.length) {
keyNode = node.value[index][0];
valueNode = node.value[index][1];
- debug('constructor#flattenMapping -- pair', {index: index, key: keyNode, val: valueNode});
-
if ('tag:yaml.org,2002:merge' === keyNode.tag) {
delete node.value[index];
@@ -426,10 +400,6 @@ var SafeConstructor = exports.SafeConstructor = new JS.Class('SafeConstructor',
constructUndefined: function (node) {
- if (debug.ENABLED) {
- debug('constructor#constructUndefined', {node: node});
- }
-
throw new ConstructorError(null, null,
"could not determine constructor for the tag " + node.tag,
node.startMark);
View
@@ -1,40 +0,0 @@
-'use strict';
-
-
-var DEBUG_ENABLED = (1 === +process.env.JSYAML_DEBUG);
-var MAX_CALLS = +process.env.JSYAML_MAX_CALLS;
-var i = 1;
-
-
-var debug = function debug(msg, params) {
- console.log('*** ' + msg + ' [' + i + ']');
-
- if ('object' === typeof params) {
- Object.getOwnPropertyNames(params).forEach(function (k) {
- var v = params[k], t = typeof v;
- console.log(' ' + k + ': <' + t + '> ' + v);
- });
- }
-
- console.log('------------------------------------------------------------');
-
- if (0 < MAX_CALLS && i >= MAX_CALLS) {
- throw new Error('JSYAML_MAX_CALLS reached');
- }
-
- i++;
-};
-
-
-module.exports = DEBUG_ENABLED ? debug : function () {};
-Object.defineProperty(module.exports, 'ENABLED', {
- value: DEBUG_ENABLED,
- writable: false,
- enumerable: false,
- configurable: false
-});
-
-
-////////////////////////////////////////////////////////////////////////////////
-// vim:ts=2:sw=2
-////////////////////////////////////////////////////////////////////////////////
View
@@ -65,8 +65,7 @@
var JS = global.JS,
exports = module.exports = {},
assert = require('assert'),
- __ = require('./core').import('error', 'tokens', 'events', 'scanner'),
- debug = require('./debug');
+ __ = require('./core').import('error', 'tokens', 'events', 'scanner');
JS.require('JS.Class');
@@ -106,17 +105,9 @@ exports.Parser = new JS.Class('Parser', {
checkEvent: function () {
var i;
- if (debug.ENABLED) {
- debug('parser#checkEvent -- start', {event: this.currentEvent, argn: arguments.length});
- }
-
// Check the type of the next event.
if (null === this.currentEvent && !!this.state) {
this.currentEvent = this.state();
-
- if (debug.ENABLED) {
- debug('parser#checkEvent -- change event', {event: this.currentEvent});
- }
}
if (null !== this.currentEvent) {
View
@@ -4,8 +4,7 @@
var JS = global.JS,
exports = module.exports = {},
fs = require('fs'),
- __ = require('./core').import('error'),
- debug = require('./debug');
+ __ = require('./core').import('error');
JS.require('JS.Class');
@@ -78,10 +77,6 @@ exports.Reader = new JS.Class('Reader', {
data = this.buffer[this.pointer + index];
}
- if (debug.ENABLED) {
- debug('reader#peek', {index: index, data:data});
- }
-
return data;
},
View
@@ -3,8 +3,7 @@
var JS = global.JS,
exports = module.exports = {},
- __ = require('./core').import('nodes'),
- debug = require('./debug');
+ __ = require('./core').import('nodes');
JS.require('JS.Class');
@@ -30,10 +29,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
first = [null];
}
- if (debug.ENABLED) {
- debug('resolver#addImplicitResolver', {tag: tag, regexp: regexp, first: first});
- }
-
first.forEach(function (ch) {
if (undefined === cls.yamlImplicitResolvers[ch]) {
cls.yamlImplicitResolvers[ch] = [];
@@ -61,10 +56,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
resolve: function (kind, value, implicit) {
var resolvers, i, tag, regexp;
- if (debug.ENABLED) {
- debug('resolver#resolve', {kind: kind, value: value, implicit: implicit});
- }
-
if (kind === __.ScalarNode && implicit[0]) {
if (value === '') {
resolvers = this.yamlImplicitResolvers[''] || [];
@@ -74,10 +65,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
resolvers = resolvers.concat(this.yamlImplicitResolvers[null] || []);
- if (debug.ENABLED) {
- debug('resolver#resolve -- resolving scalar tag', {resolvers: resolvers});
- }
-
for (i = 0; i < resolvers.length; i++) {
tag = resolvers[i][0];
regexp = resolvers[i][1];
@@ -99,10 +86,6 @@ exports.BaseResolver = new JS.Class('BaseResolver', {
tag = null;
}
- if (debug.ENABLED) {
- debug('resolver#resolve -- tried default tags', {tag: tag});
- }
-
return tag;
}
});
View
@@ -31,8 +31,7 @@ var JS = global.JS,
exports = module.exports = {},
assert = require('assert'),
$$ = require('./core'),
- __ = $$.import('error', 'tokens'),
- debug = require('./debug');
+ __ = $$.import('error', 'tokens');
JS.require('JS.Class');
@@ -206,23 +205,13 @@ exports.Scanner = new JS.Class('Scanner', {
// Return the next token.
- debug('scanner#getToken -- start');
-
while (this.needMoreTokens()) {
this.fetchMoreTokens();
}
- if (debug.ENABLED) {
- debug('scanner#getToken -- getting token', {tokens: this.tokens.length});
- }
-
if (this.tokens.length) {
this.tokensTaken += 1;
token = this.tokens.shift();
-
- if (debug.ENABLED) {
- debug('scanner#getToken -- got token', {token: token});
- }
}
return token;

0 comments on commit c68665e

Please sign in to comment.