| 79 | } |
| 80 | function l(n, l, u, t, r) { |
| 81 | function e(n, l) { |
| 82 | function u(n) { |
| 83 | function l(n) { |
| 84 | return n.charCodeAt(0).toString(16).toUpperCase(); |
| 85 | } |
| 86 | return n.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\x08/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(n) { |
| 87 | return "\\x0" + l(n); |
| 88 | }).replace(/[\x10-\x1F\x80-\xFF]/g, function(n) { |
| 89 | return "\\x" + l(n); |
| 90 | }).replace(/[\u0180-\u0FFF]/g, function(n) { |
| 91 | return "\\u0" + l(n); |
| 92 | }).replace(/[\u1080-\uFFFF]/g, function(n) { |
| 93 | return "\\u" + l(n); |
| 94 | }); |
| 95 | } |
| 96 | var t, r; |
| 97 | switch (n.length) { |
| 98 | case 0: |
| 99 | t = "end of input"; |
| 100 | break; |
| 101 | |
| 102 | case 1: |
| 103 | t = n[0]; |
| 104 | break; |
| 105 | |
| 106 | default: |
| 107 | t = n.slice(0, -1).join(", ") + " or " + n[n.length - 1]; |
| 108 | } |
| 109 | return r = l ? '"' + u(l) + '"' : "end of input", "Expected " + t + " but " + r + " found."; |
| 110 | } |
| 111 | this.expected = n, this.found = l, this.offset = u, this.line = t, this.column = r, |
| 112 | this.name = "SyntaxError", this.message = e(n, l); |
| 113 | } |