Add privatekey parser that does not use Ragel
This commit is contained in:
parent
94ec863ffc
commit
643ee5f5f2
1
Makefile
1
Makefile
|
@ -14,6 +14,7 @@ GOFILES=\
|
|||
dnssec.go\
|
||||
edns.go\
|
||||
keygen.go\
|
||||
kscan.go\
|
||||
msg.go\
|
||||
nsec3.go \
|
||||
qnamestring.go\
|
||||
|
|
11
zscan.go
11
zscan.go
|
@ -15,6 +15,7 @@ import (
|
|||
// * Handle comments: ;
|
||||
// * Handle braces.
|
||||
const (
|
||||
// Zonefile
|
||||
_EOF = iota // Don't let it start with zero
|
||||
_STRING
|
||||
_BLANK
|
||||
|
@ -23,6 +24,10 @@ const (
|
|||
_OWNER
|
||||
_CLASS
|
||||
|
||||
// Privatekey file
|
||||
_VALUE
|
||||
_KEY
|
||||
|
||||
_EXPECT_OWNER // Ownername
|
||||
_EXPECT_OWNER_BL // Whitespace after the ownername
|
||||
_EXPECT_ANY // Expect rrtype, ttl or class
|
||||
|
@ -82,7 +87,7 @@ func ParseZone(r io.Reader, cr chan RR) {
|
|||
s.Mode = 0
|
||||
s.Whitespace = 0
|
||||
// Start the lexer
|
||||
go lexer(s, c)
|
||||
go zlexer(s, c)
|
||||
// 5 possible beginnings of a line, _ is a space
|
||||
// 1. _OWNER _ _RRTYPE -> class/ttl omitted
|
||||
// 2. _OWNER _ _STRING _ _RRTYPE -> class omitted
|
||||
|
@ -216,8 +221,8 @@ func (l Lex) String() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// lexer scans the sourcefile and returns tokens on the channel c.
|
||||
func lexer(s scanner.Scanner, c chan Lex) {
|
||||
// zlexer scans the sourcefile and returns tokens on the channel c.
|
||||
func zlexer(s scanner.Scanner, c chan Lex) {
|
||||
var l Lex
|
||||
str := "" // Hold the current read text
|
||||
quote := false
|
||||
|
|
Loading…
Reference in New Issue