Add privatekey parser that does not use Ragel

This commit is contained in:
Miek Gieben 2011-12-15 13:03:51 +01:00
parent 94ec863ffc
commit 643ee5f5f2
2 changed files with 9 additions and 3 deletions

View File

@ -14,6 +14,7 @@ GOFILES=\
dnssec.go\
edns.go\
keygen.go\
kscan.go\
msg.go\
nsec3.go \
qnamestring.go\

View File

@ -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