File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -34,12 +34,31 @@ SPEG_actions.prototype.parsing_body = function(node) {
3434
3535SPEG_actions . prototype . parsing_rule = function ( node ) {
3636 var rule = node . children [ 4 ] ;
37+ var ruleName = node . children [ 0 ] . match ;
3738 return {
38- name : node . children [ 0 ] . match ,
39+ name : ruleName ,
3940 parser : function ( state ) {
41+ var start = state . position ;
4042 var ast = rule ( state ) ;
4143 if ( ast ) {
42- ast . rule = node . children [ 0 ] . match ;
44+ ast . rule = ruleName ;
45+ if ( ! state . succesfullRules ) {
46+ state . succesfullRules = [ ] ;
47+ }
48+ state . succesfullRules . push ( {
49+ rule : ast . rule ,
50+ match : ast . match ,
51+ start_position : ast . start_position ,
52+ end_position : ast . end_position
53+ } ) ;
54+ } else {
55+ if ( ! state . failedRules ) {
56+ state . failedRules = [ ] ;
57+ }
58+ state . failedRules . push ( {
59+ rule : ruleName ,
60+ start_position : start
61+ } ) ;
4362 }
4463 return ast ;
4564 }
You can’t perform that action at this time.
0 commit comments