diff --git a/packages/moon/dist/moon.js b/packages/moon/dist/moon.js index e94c35f1..ba301ee6 100644 --- a/packages/moon/dist/moon.js +++ b/packages/moon/dist/moon.js @@ -428,19 +428,14 @@ var parseError = tree; do { - parseErrors += "".concat(parseError.message, "\n"); - var tokenStrings = ""; - var marks = ""; // Collect the tokens responsible for the error as well as the + parseErrors += "".concat(parseError.message, "\n"); // Collect the tokens responsible for the error as well as the // surrounding tokens. for (var i = Math.max(0, parseError.start - 1); i < Math.min(parseError.end + 1, tokens.length); i++) { - var currentTokenString = tokenString(tokens[i]); - tokenStrings += currentTokenString; // If the token was directly responsible for the error, mark it. - - marks += (i >= parseError.start && i < parseError.end ? "^" : " ").repeat(currentTokenString.length); + parseErrors += tokenString(tokens[i]); } - parseErrors += "".concat(tokenStrings, "\n").concat(marks, "\n\n"); + parseErrors += "\n\n"; } while ((parseError = parseError.next) !== undefined); error("Parser failed to process the view.\n\n".concat(parseErrors)); diff --git a/packages/moon/dist/moon.min.js b/packages/moon/dist/moon.min.js index c0302142..6200b433 100644 --- a/packages/moon/dist/moon.min.js +++ b/packages/moon/dist/moon.min.js @@ -4,4 +4,4 @@ * Released under the MIT License * https://kbrsh.github.io/moon */ -!function(e,t){"undefined"==typeof module?e.Moon=t():module.exports=t()}(this,function(){"use strict";var t={silent:!0};function a(){}function o(e,t){return void 0===e?t:e}function i(e){return'"'===e||"'"===e}function u(e){!1===t.silent&&console.error("[Moon] ERROR: "+e)}var w=/<([\w\d-_]+)([^>]*?)(\/?)>/g,O=/\s*([\w\d-_]*)(?:=(?:("[\w\d-_]*"|'[\w\d-_]*')|{([\w\d-_]*)}))?/g;function l(e){if("tagOpen"!==e.type)return"");if("Text"===e.value){var t=e.attributes[""];return i(t[0])?t.slice(1,-1):"{".concat(t,"}")}var n="<".concat(e.value);for(var r in e.attributes){var c=e.attributes[r];n+=" ".concat(r,"=").concat(i(c[0])?c:"{".concat(c,"}"))}return e.closed&&(n+="/"),n+">"}function n(e){e=e.trim();for(var t=[],n=0;n",n+2),o=e.slice(n+2,a);t.push({type:"tagClose",value:o}),n=a+1;continue}if("!"===c&&"-"===e[n+2]&&"-"===e[n+3]){n=e.indexOf("--\x3e",n+4)+3;continue}w.lastIndex=n;for(var i=w.exec(e),u=i[0],l=i[1],s=i[2],f=i[3],v={},m=void 0;null!==(m=O.exec(s));){var d=m[0],p=m[1],y=m[2],g=m[3];0===d.length?O.lastIndex+=1:v[p]=void 0===g?y:g}t.push({type:"tagOpen",value:l,attributes:v,closed:"/"===f}),n+=u.length}else if("{"===r){var h="";for(n+=1;n=r.start&&o]*?)(\/?)>/g,O=/\s*([\w\d-_]*)(?:=(?:("[\w\d-_]*"|'[\w\d-_]*')|{([\w\d-_]*)}))?/g;function l(e){if("tagOpen"!==e.type)return"");if("Text"===e.value){var t=e.attributes[""];return i(t[0])?t.slice(1,-1):"{".concat(t,"}")}var n="<".concat(e.value);for(var r in e.attributes){var c=e.attributes[r];n+=" ".concat(r,"=").concat(i(c[0])?c:"{".concat(c,"}"))}return e.closed&&(n+="/"),n+">"}function n(e){e=e.trim();for(var t=[],n=0;n",n+2),o=e.slice(n+2,a);t.push({type:"tagClose",value:o}),n=a+1;continue}if("!"===c&&"-"===e[n+2]&&"-"===e[n+3]){n=e.indexOf("--\x3e",n+4)+3;continue}w.lastIndex=n;for(var i=w.exec(e),u=i[0],l=i[1],s=i[2],f=i[3],v={},m=void 0;null!==(m=O.exec(s));){var d=m[0],p=m[1],y=m[2],g=m[3];0===d.length?O.lastIndex+=1:v[p]=void 0===g?y:g}t.push({type:"tagOpen",value:l,attributes:v,closed:"/"===f}),n+=u.length}else if("{"===r){var h="";for(n+=1;n= parseError.start && i < parseError.end) ? - "^" : - " " - ).repeat(currentTokenString.length); + parseErrors += tokenString(tokens[i]); } - parseErrors += `${tokenStrings}\n${marks}\n\n`; + parseErrors += "\n\n"; } while ((parseError = parseError.next) !== undefined); error(`Parser failed to process the view.\n\n${parseErrors}`);