pegjs-util
Advanced tools
Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "pegjs-util", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Utility Class for PEG.js", | ||
@@ -5,0 +5,0 @@ "main": "PEGUtil.js", |
{ | ||
"name": "pegjs-util", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Utility Class for PEG.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ "pegjs", "parser", "AST", "unroll" ], |
@@ -155,13 +155,25 @@ /* | ||
result.ast = null; | ||
var definedOrElse = function (value, fallback) { | ||
return (typeof value !== "undefined" ? value : fallback); | ||
}; | ||
result.error = { | ||
line: definedOrElse(e.location.start.line, 0), | ||
column: definedOrElse(e.location.start.column, 0), | ||
message: e.message, | ||
found: definedOrElse(e.found, ""), | ||
expected: definedOrElse(e.expected, ""), | ||
location: excerpt(txt, definedOrElse(e.location.start.offset, 0)) | ||
}; | ||
if (e instanceof parser.SyntaxError) { | ||
var definedOrElse = function (value, fallback) { | ||
return (typeof value !== "undefined" ? value : fallback); | ||
}; | ||
result.error = { | ||
line: definedOrElse(e.location.start.line, 0), | ||
column: definedOrElse(e.location.start.column, 0), | ||
message: e.message, | ||
found: definedOrElse(e.found, ""), | ||
expected: definedOrElse(e.expected, ""), | ||
location: excerpt(txt, definedOrElse(e.location.start.offset, 0)) | ||
}; | ||
} | ||
else { | ||
result.error = { | ||
line: 0, | ||
column: 0, | ||
message: e.message, | ||
found: "", | ||
expected: "", | ||
location: excerpt("", 0) | ||
}; | ||
} | ||
} | ||
@@ -168,0 +180,0 @@ return result; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28126
483