CheckRule checks if given rule should be traced
(rule string)
| 86 | |
| 87 | // CheckRule checks if given rule should be traced |
| 88 | func (pt *TraceOptions) CheckRule(rule string) bool { |
| 89 | if len(pt.RulesList) == 0 { |
| 90 | if pt.Rules != "" { |
| 91 | pt.Init() |
| 92 | if len(pt.RulesList) == 0 { |
| 93 | return true |
| 94 | } |
| 95 | } else { |
| 96 | return true |
| 97 | } |
| 98 | } |
| 99 | for _, rn := range pt.RulesList { |
| 100 | if rn == rule { |
| 101 | return true |
| 102 | } |
| 103 | } |
| 104 | return false |
| 105 | } |
| 106 | |
| 107 | // Out outputs a trace message -- returns true if actually output |
| 108 | func (pt *TraceOptions) Out(ps *State, pr *Rule, step Steps, pos lexer.Pos, scope lexer.Reg, ast *AST, msg string) bool { |