Parser verbose mode
This commit is contained in:
parent
bda13e01db
commit
23577d7274
|
@ -16,6 +16,7 @@ type (
|
|||
ctx *context
|
||||
sels map[string]*context
|
||||
res chan Match
|
||||
verbose bool
|
||||
}
|
||||
Match struct {
|
||||
Sel string
|
||||
|
@ -35,6 +36,10 @@ func New(buf buffer.Bufferer, sels []string) *Parser {
|
|||
}
|
||||
}
|
||||
|
||||
func (p *Parser) Debug() {
|
||||
p.verbose = true
|
||||
}
|
||||
|
||||
// Parse all and return matches
|
||||
func (p *Parser) Parse() map[string][]interface{} {
|
||||
p.ParseStream()
|
||||
|
@ -166,7 +171,9 @@ func (p *Parser) next() lexer.Item {
|
|||
panic(item)
|
||||
}
|
||||
|
||||
if p.verbose {
|
||||
fmt.Println(item)
|
||||
}
|
||||
return item
|
||||
} else {
|
||||
panic("EOF reached")
|
||||
|
|
Loading…
Reference in New Issue