We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 431305f commit acd7411Copy full SHA for acd7411
parser/lexer.go
@@ -650,6 +650,11 @@ func (x *yyLex) Error(s string) {
650
log.Printf("State %#v", x)
651
}
652
653
+// Set the debug level 0 = off, 4 = max
654
+func SetDebug(level int) {
655
+ yyDebug = level
656
+}
657
+
658
// Parse a file
659
func Parse(in io.Reader) {
660
yyParse(NewLex(in))
parser/testparser/testparser.go
@@ -10,11 +10,13 @@ import (
10
)
11
12
var (
13
- lex = flag.Bool("l", false, "Lex the file only")
+ lex = flag.Bool("l", false, "Lex the file only")
14
+ debugLevel = flag.Int("d", 0, "Debug level 0-4")
15
16
17
func main() {
18
flag.Parse()
19
+ parser.SetDebug(*debugLevel)
20
for _, path := range flag.Args() {
21
if *lex {
22
fmt.Printf("Lexing %q\n", path)
0 commit comments