/bower_components/yaml.js/lib/Parser.js |
@@ -1,5 +1,5 @@ |
// Generated by CoffeeScript 1.10.0 |
var Inline, ParseException, Parser, Pattern, Utils; |
// Generated by CoffeeScript 1.12.4 |
var Inline, ParseException, ParseMore, Parser, Pattern, Utils; |
|
Inline = require('./Inline'); |
|
@@ -9,6 +9,8 @@ |
|
ParseException = require('./Exception/ParseException'); |
|
ParseMore = require('./Exception/ParseMore'); |
|
Parser = (function() { |
Parser.prototype.PATTERN_FOLDED_SCALAR_ALL = new Pattern('^(?:(?<type>![^\\|>]*)\\s+)?(?<separator>\\||>)(?<modifiers>\\+|\\-|\\d+|\\+\\d+|\\-\\d+|\\d+\\+|\\d+\\-)?(?<comments> +#.*)?$'); |
|
@@ -28,13 +30,13 @@ |
|
Parser.prototype.PATTERN_TRAILING_LINES = new Pattern('(\n*)$'); |
|
Parser.prototype.PATTERN_YAML_HEADER = new Pattern('^\\%YAML[: ][\\d\\.]+.*\n'); |
Parser.prototype.PATTERN_YAML_HEADER = new Pattern('^\\%YAML[: ][\\d\\.]+.*\n', 'm'); |
|
Parser.prototype.PATTERN_LEADING_COMMENTS = new Pattern('^(\\#.*?\n)+'); |
Parser.prototype.PATTERN_LEADING_COMMENTS = new Pattern('^(\\#.*?\n)+', 'm'); |
|
Parser.prototype.PATTERN_DOCUMENT_MARKER_START = new Pattern('^\\-\\-\\-.*?\n'); |
Parser.prototype.PATTERN_DOCUMENT_MARKER_START = new Pattern('^\\-\\-\\-.*?\n', 'm'); |
|
Parser.prototype.PATTERN_DOCUMENT_MARKER_END = new Pattern('^\\.\\.\\.\\s*$'); |
Parser.prototype.PATTERN_DOCUMENT_MARKER_END = new Pattern('^\\.\\.\\.\\s*$', 'm'); |
|
Parser.prototype.PATTERN_FOLDED_SCALAR_BY_INDENTATION = {}; |
|
@@ -53,7 +55,7 @@ |
} |
|
Parser.prototype.parse = function(value, exceptionOnInvalidType, objectDecoder) { |
var alias, allowOverwrite, block, c, context, data, e, error, error1, error2, first, i, indent, isRef, j, k, key, l, lastKey, len, len1, len2, len3, lineCount, m, matches, mergeNode, n, name, parsed, parsedItem, parser, ref, ref1, ref2, refName, refValue, val, values; |
var alias, allowOverwrite, block, c, context, data, e, first, i, indent, isRef, j, k, key, l, lastKey, len, len1, len2, len3, lineCount, m, matches, mergeNode, n, name, parsed, parsedItem, parser, ref, ref1, ref2, refName, refValue, val, values; |
if (exceptionOnInvalidType == null) { |
exceptionOnInvalidType = false; |
} |
@@ -230,8 +232,8 @@ |
if (1 === lineCount || (2 === lineCount && Utils.isEmpty(this.lines[1]))) { |
try { |
value = Inline.parse(this.lines[0], exceptionOnInvalidType, objectDecoder); |
} catch (error1) { |
e = error1; |
} catch (error) { |
e = error; |
e.parsedLine = this.getRealCurrentLineNb() + 1; |
e.snippet = this.currentLine; |
throw e; |
@@ -258,8 +260,8 @@ |
} else if ((ref2 = Utils.ltrim(value).charAt(0)) === '[' || ref2 === '{') { |
try { |
return Inline.parse(value, exceptionOnInvalidType, objectDecoder); |
} catch (error2) { |
e = error2; |
} catch (error) { |
e = error; |
e.parsedLine = this.getRealCurrentLineNb() + 1; |
e.snippet = this.currentLine; |
throw e; |
@@ -323,18 +325,16 @@ |
if (indent === newIndent) { |
removeComments = !removeCommentsPattern.test(this.currentLine); |
} |
if (isItUnindentedCollection && !this.isStringUnIndentedCollectionItem(this.currentLine) && indent === newIndent) { |
this.moveToPreviousLine(); |
break; |
if (removeComments && this.isCurrentLineComment()) { |
continue; |
} |
if (this.isCurrentLineBlank()) { |
data.push(this.currentLine.slice(newIndent)); |
continue; |
} |
if (removeComments && this.isCurrentLineComment()) { |
if (indent === newIndent) { |
continue; |
} |
if (isItUnindentedCollection && !this.isStringUnIndentedCollectionItem(this.currentLine) && indent === newIndent) { |
this.moveToPreviousLine(); |
break; |
} |
if (indent >= newIndent) { |
data.push(this.currentLine.slice(newIndent)); |
@@ -363,7 +363,7 @@ |
}; |
|
Parser.prototype.parseValue = function(value, exceptionOnInvalidType, objectDecoder) { |
var e, error, error1, foldedIndent, matches, modifiers, pos, ref, ref1, val; |
var e, foldedIndent, matches, modifiers, pos, ref, ref1, val; |
if (0 === value.indexOf('*')) { |
pos = value.indexOf('#'); |
if (pos !== -1) { |
@@ -390,25 +390,26 @@ |
return val; |
} |
} |
try { |
return Inline.parse(value, exceptionOnInvalidType, objectDecoder); |
} catch (error) { |
e = error; |
if (((ref1 = value.charAt(0)) === '[' || ref1 === '{') && e instanceof ParseException && this.isNextLineIndented()) { |
value += "\n" + this.getNextEmbedBlock(); |
if ((ref1 = value.charAt(0)) === '[' || ref1 === '{' || ref1 === '"' || ref1 === "'") { |
while (true) { |
try { |
return Inline.parse(value, exceptionOnInvalidType, objectDecoder); |
} catch (error1) { |
e = error1; |
e.parsedLine = this.getRealCurrentLineNb() + 1; |
e.snippet = this.currentLine; |
throw e; |
} catch (error) { |
e = error; |
if (e instanceof ParseMore && this.moveToNextLine()) { |
value += "\n" + Utils.trim(this.currentLine, ' '); |
} else { |
e.parsedLine = this.getRealCurrentLineNb() + 1; |
e.snippet = this.currentLine; |
throw e; |
} |
} |
} else { |
e.parsedLine = this.getRealCurrentLineNb() + 1; |
e.snippet = this.currentLine; |
throw e; |
} |
} else { |
if (this.isNextLineIndented()) { |
value += "\n" + this.getNextEmbedBlock(); |
} |
return Inline.parse(value, exceptionOnInvalidType, objectDecoder); |
} |
}; |
|