@@ -57,6 +57,7 @@ return /******/ (function(modules) { // webpackBootstrap
57
57
var SPEG_actions_visitor = __webpack_require__ ( 1 ) . SPEG_actions_visitor ;
58
58
var SPEG_parser = __webpack_require__ ( 2 ) ;
59
59
var rd = __webpack_require__ ( 3 ) ;
60
+ var ex = __webpack_require__ ( 4 ) ;
60
61
61
62
function SPEG ( ) {
62
63
this . parser = new SPEG_parser ( ) ;
@@ -70,7 +71,7 @@ return /******/ (function(modules) { // webpackBootstrap
70
71
if ( speg_ast ) {
71
72
this . speg_parser = this . visitor . visit ( speg_ast ) ;
72
73
} 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 ( ) ) ;
74
75
}
75
76
} ;
76
77
@@ -84,7 +85,7 @@ return /******/ (function(modules) { // webpackBootstrap
84
85
if ( ast ) {
85
86
return ast ;
86
87
} 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 ) )
88
89
}
89
90
} else {
90
91
throw Error ( 'You need grammar to parse text. Call parseGrammar first' ) ;
@@ -103,10 +104,10 @@ return /******/ (function(modules) { // webpackBootstrap
103
104
if ( ast ) {
104
105
return ast ;
105
106
} 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 ) )
107
108
}
108
109
} 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 ( ) )
110
111
}
111
112
} ;
112
113
@@ -117,7 +118,7 @@ return /******/ (function(modules) { // webpackBootstrap
117
118
} ;
118
119
119
120
SPEG_actions . prototype . peg = function ( node ) {
120
- return node . children [ 2 ] ;
121
+ return node . children [ 3 ] ;
121
122
} ;
122
123
123
124
SPEG_actions . prototype . parsing_body = function ( node ) {
@@ -277,6 +278,7 @@ return /******/ (function(modules) { // webpackBootstrap
277
278
278
279
function peg ( ) {
279
280
return rd . action ( 'peg' , rd . sequence ( [
281
+ rd . zero_or_more ( _ ( ) ) ,
280
282
parsing_header ( ) ,
281
283
rd . one_or_more ( _ ( ) ) ,
282
284
parsing_body ( ) ,
@@ -834,6 +836,45 @@ return /******/ (function(modules) { // webpackBootstrap
834
836
} ;
835
837
836
838
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
+
837
878
/***/ }
838
879
/******/ ] )
839
880
} ) ;
0 commit comments