Skip to content

Commit 9d1e26d

Browse files
authored
Merge pull request #12 from jamaks/speg-vis-exp
fix: skip parse state rule
2 parents 9d44a3f + 8ede2eb commit 9d1e26d

2 files changed

Lines changed: 15 additions & 17 deletions

File tree

rd/rd_parser.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ func NotPredicate(parser ParserFunc) ParserFunc {
429429

430430
return Ast{
431431
TypeData: "not_predicate",
432-
Children: []Ast{},
433432
StartPosition: state.Position,
434433
EndPosition: state.Position,
435434
}, true
@@ -442,7 +441,6 @@ func EndOfFile() ParserFunc {
442441
state.LastExpectations = []Expectation{}
443442
return Ast{
444443
TypeData: "end_of_file",
445-
Children: []Ast{},
446444
StartPosition: state.Position,
447445
EndPosition: state.Position,
448446
}, false

speg/speg_visitor.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,23 @@ func visitParsingRule(node *NodeVisit) rd.ParserFunc {
134134
var ruleName = node.Node.Children[0].Match
135135

136136
var parser = func(state *rd.State) (rd.Ast, bool) {
137-
var start = state.Position
137+
//var start = state.Position
138138
var ast, err = rule(state)
139139

140-
if !err {
141-
ast.Rule = ruleName
142-
state.SuccesfullRules = append(state.SuccesfullRules, rd.Ast{
143-
Rule: ast.Rule,
144-
Match: ast.Match,
145-
StartPosition: ast.StartPosition,
146-
EndPosition: ast.EndPosition,
147-
})
148-
} else {
149-
state.FailedRules = append(state.FailedRules, rd.Ast{
150-
Rule: ruleName,
151-
StartPosition: start,
152-
})
153-
}
140+
//if !err {
141+
// ast.Rule = ruleName
142+
// state.SuccesfullRules = append(state.SuccesfullRules, rd.Ast{
143+
// Rule: ast.Rule,
144+
// Match: ast.Match,
145+
// StartPosition: ast.StartPosition,
146+
// EndPosition: ast.EndPosition,
147+
// })
148+
//} else {
149+
// state.FailedRules = append(state.FailedRules, rd.Ast{
150+
// Rule: ruleName,
151+
// StartPosition: start,
152+
// })
153+
//}
154154

155155
return ast, err
156156
}

0 commit comments

Comments
 (0)