summaryrefslogtreecommitdiff
path: root/tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js')
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js76
1 files changed, 0 insertions, 76 deletions
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js
deleted file mode 100644
index 47b265c20c..0000000000
--- a/tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js
+++ /dev/null
@@ -1,76 +0,0 @@
-'use strict';
-
-
-var common = require('./common');
-
-
-function Mark(name, buffer, position, line, column) {
- this.name = name;
- this.buffer = buffer;
- this.position = position;
- this.line = line;
- this.column = column;
-}
-
-
-Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
- var head, start, tail, end, snippet;
-
- if (!this.buffer) return null;
-
- indent = indent || 4;
- maxLength = maxLength || 75;
-
- head = '';
- start = this.position;
-
- while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
- start -= 1;
- if (this.position - start > (maxLength / 2 - 1)) {
- head = ' ... ';
- start += 5;
- break;
- }
- }
-
- tail = '';
- end = this.position;
-
- while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
- end += 1;
- if (end - this.position > (maxLength / 2 - 1)) {
- tail = ' ... ';
- end -= 5;
- break;
- }
- }
-
- snippet = this.buffer.slice(start, end);
-
- return common.repeat(' ', indent) + head + snippet + tail + '\n' +
- common.repeat(' ', indent + this.position - start + head.length) + '^';
-};
-
-
-Mark.prototype.toString = function toString(compact) {
- var snippet, where = '';
-
- if (this.name) {
- where += 'in "' + this.name + '" ';
- }
-
- where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
-
- if (!compact) {
- snippet = this.getSnippet();
-
- if (snippet) {
- where += ':\n' + snippet;
- }
- }
-
- return where;
-};
-
-
-module.exports = Mark;