more parsing stuff
This commit is contained in:
parent
0c6b29aabd
commit
2b4ac48354
|
@ -5,6 +5,5 @@ xx YYY 2011: 0.0.1 Miek Gieben <miek@miek.nl>
|
|||
* Private key file parsing from BIND9
|
||||
* TSIG
|
||||
* EDNS0
|
||||
* Parsng from strings
|
||||
* Cherry picked GRONG for server side ideas
|
||||
|
||||
|
|
6
Makefile
6
Makefile
|
@ -15,12 +15,12 @@ GOFILES=\
|
|||
dnssec.go\
|
||||
keygen.go\
|
||||
string.go\
|
||||
y.go\
|
||||
# y.go\
|
||||
|
||||
include $(GOROOT)/src/Make.pkg
|
||||
|
||||
y.go: dns.y
|
||||
goyacc dns.y
|
||||
#y.go: dns.y
|
||||
# goyacc dns.y
|
||||
|
||||
|
||||
all: package
|
||||
|
|
37
dns.y
37
dns.y
|
@ -51,45 +51,12 @@ rrtype:
|
|||
|
||||
type DnsLex int
|
||||
|
||||
func (DnsLex) Lex(yylval *yySymType) int {
|
||||
func (DnsLex) Lex(lval *yySymType) int {
|
||||
|
||||
// yylval.rrtype = Str_rr($XX) //give back TypeA, TypeNS
|
||||
// return Y_A this should be the token, another map?
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
func isSeparator(c byte) bool {
|
||||
switch c {
|
||||
case '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func isSpace(c byte) bool {
|
||||
switch c {
|
||||
case ' ', '\t', '\r', '\n':
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func isCtl(c byte) bool { return (0 <= c && c <= 31) || c == 127 }
|
||||
|
||||
func isChar(c byte) bool { return 0 <= c && c <= 127 }
|
||||
|
||||
func isAnyText(c byte) bool { return !isCtl(c) }
|
||||
|
||||
func isQdText(c byte) bool { return isAnyText(c) && c != '"' }
|
||||
|
||||
func isToken(c byte) bool { return isChar(c) && !isCtl(c) && !isSeparator(c) }
|
||||
|
||||
// This is a best effort parse, so errors are not returned, instead not all of
|
||||
// the input string might be parsed. result is always non-nil.
|
||||
// must never begin with a string
|
||||
func scan(s string) (string, int) {
|
||||
//func scan(s string) (string, int) {
|
||||
if len(s) == 0 {
|
||||
println("a bit short")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue