Skip to content

Commit d60c23c

Browse files
committed
dist/speg.js updated for Release 1.0.4
1 parent 2546b66 commit d60c23c

File tree

1 file changed

+46
-5
lines changed

1 file changed

+46
-5
lines changed

dist/speg.js

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ return /******/ (function(modules) { // webpackBootstrap
5757
var SPEG_actions_visitor = __webpack_require__(1).SPEG_actions_visitor;
5858
var SPEG_parser = __webpack_require__(2);
5959
var rd = __webpack_require__(3);
60+
var ex = __webpack_require__(4);
6061

6162
function SPEG() {
6263
this.parser = new SPEG_parser();
@@ -70,7 +71,7 @@ return /******/ (function(modules) { // webpackBootstrap
7071
if (speg_ast) {
7172
this.speg_parser = this.visitor.visit(speg_ast);
7273
} else {
73-
throw Error('Failed to parse grammar: \n\n' + this.parser.get_last_error());
74+
throw new ex.GrammarParseError('Failed to parse grammar: \n\n' + this.parser.get_last_error());
7475
}
7576
};
7677

@@ -84,7 +85,7 @@ return /******/ (function(modules) { // webpackBootstrap
8485
if (ast) {
8586
return ast;
8687
} else {
87-
throw Error('Failed to parse text: \n\n' + rd.get_last_error(state))
88+
throw new ex.TextParseError('Failed to parse text: \n\n' + rd.get_last_error(state))
8889
}
8990
} else {
9091
throw Error('You need grammar to parse text. Call parseGrammar first');
@@ -103,10 +104,10 @@ return /******/ (function(modules) { // webpackBootstrap
103104
if (ast) {
104105
return ast;
105106
} else {
106-
throw Error('Failed to parse text: \n\n' + rd.get_last_error(state))
107+
throw new ex.TextParseError('Failed to parse text: \n\n' + rd.get_last_error(state))
107108
}
108109
} else {
109-
throw Error('Failed to parse grammar: \n\n' + this.parser.get_last_error())
110+
throw new ex.GrammarParseError('Failed to parse grammar: \n\n' + this.parser.get_last_error())
110111
}
111112
};
112113

@@ -117,7 +118,7 @@ return /******/ (function(modules) { // webpackBootstrap
117118
};
118119

119120
SPEG_actions.prototype.peg = function(node) {
120-
return node.children[2];
121+
return node.children[3];
121122
};
122123

123124
SPEG_actions.prototype.parsing_body = function(node) {
@@ -277,6 +278,7 @@ return /******/ (function(modules) { // webpackBootstrap
277278

278279
function peg() {
279280
return rd.action('peg', rd.sequence([
281+
rd.zero_or_more(_()),
280282
parsing_header(),
281283
rd.one_or_more(_()),
282284
parsing_body(),
@@ -834,6 +836,45 @@ return /******/ (function(modules) { // webpackBootstrap
834836
};
835837

836838

839+
/***/ },
840+
/* 4 */
841+
/***/ function(module, exports) {
842+
843+
function GrammarParseError() {
844+
var temp = Error.apply(this, arguments);
845+
temp.name = this.name = 'GrammarParseError';
846+
this.stack = temp.stack;
847+
this.message = temp.message;
848+
}
849+
GrammarParseError.prototype = Object.create(Error.prototype, {
850+
constructor: {
851+
value: GrammarParseError,
852+
writable: true,
853+
configurable: true
854+
}
855+
});
856+
857+
function TextParseError() {
858+
var temp = Error.apply(this, arguments);
859+
temp.name = this.name = 'TextParseError';
860+
this.stack = temp.stack;
861+
this.message = temp.message;
862+
}
863+
TextParseError.prototype = Object.create(Error.prototype, {
864+
constructor: {
865+
value: TextParseError,
866+
writable: true,
867+
configurable: true
868+
}
869+
});
870+
871+
872+
module.exports = {
873+
GrammarParseError: GrammarParseError,
874+
TextParseError: TextParseError
875+
}
876+
877+
837878
/***/ }
838879
/******/ ])
839880
});

0 commit comments

Comments
 (0)