parent
662ab3dac9
commit
e2ecf8b80a
37
zscan.go
37
zscan.go
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Only used when debugging the parser itself.
|
// Only used when debugging the parser itself.
|
||||||
var _DEBUG = false
|
var _DEBUG = true
|
||||||
|
|
||||||
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
|
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
|
||||||
// * Add ownernames if they are left blank;
|
// * Add ownernames if they are left blank;
|
||||||
|
@ -315,6 +315,7 @@ func zlexer(r io.Reader, c chan lex) {
|
||||||
} else if owner {
|
} else if owner {
|
||||||
// If we have a string and its the first, make it an owner
|
// If we have a string and its the first, make it an owner
|
||||||
l.value = _OWNER
|
l.value = _OWNER
|
||||||
|
println(p, q)
|
||||||
l.token = string(buf[p:q])
|
l.token = string(buf[p:q])
|
||||||
// escape $... start with a \ not a $, so this will work
|
// escape $... start with a \ not a $, so this will work
|
||||||
if l.token == "$TTL" {
|
if l.token == "$TTL" {
|
||||||
|
@ -352,6 +353,7 @@ func zlexer(r io.Reader, c chan lex) {
|
||||||
}
|
}
|
||||||
owner = false
|
owner = false
|
||||||
space = true
|
space = true
|
||||||
|
println("upping", p, q)
|
||||||
case ';':
|
case ';':
|
||||||
if escape {
|
if escape {
|
||||||
escape = false
|
escape = false
|
||||||
|
@ -411,6 +413,7 @@ func zlexer(r io.Reader, c chan lex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p = q + 1
|
p = q + 1
|
||||||
|
println("hallo")
|
||||||
commt = false
|
commt = false
|
||||||
rrtype = false
|
rrtype = false
|
||||||
owner = true
|
owner = true
|
||||||
|
@ -443,7 +446,6 @@ func zlexer(r io.Reader, c chan lex) {
|
||||||
escape = false
|
escape = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
p++
|
|
||||||
brace++
|
brace++
|
||||||
case ')':
|
case ')':
|
||||||
if commt {
|
if commt {
|
||||||
|
@ -461,7 +463,6 @@ func zlexer(r io.Reader, c chan lex) {
|
||||||
p = q + 1
|
p = q + 1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
p++
|
|
||||||
default:
|
default:
|
||||||
if commt {
|
if commt {
|
||||||
p++
|
p++
|
||||||
|
@ -472,26 +473,20 @@ func zlexer(r io.Reader, c chan lex) {
|
||||||
}
|
}
|
||||||
// tok, err = r.ReadByte() read extra bytes
|
// tok, err = r.ReadByte() read extra bytes
|
||||||
q++
|
q++
|
||||||
if q > n-1 { // Funny, 'cause q starts at zero
|
if q > n {
|
||||||
// Read in a new chunk. Every thing before p
|
break
|
||||||
// can be discarded.
|
|
||||||
n1 := copy(buf, buf[p:])
|
|
||||||
// Reset the indices
|
|
||||||
q = q - p
|
|
||||||
p = 0
|
|
||||||
// Read a new chunk
|
|
||||||
n, err = r.Read(buf[n1:])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// It this need anymore???
|
println("We crashen gewoon hier", p, q)
|
||||||
/*
|
// It this need anymore???
|
||||||
if p != q {
|
/*
|
||||||
// Send remainder
|
if p != q {
|
||||||
l.token = string(buf[p:q])
|
// Send remainder
|
||||||
l.value = _STRING
|
l.token = string(buf[p:q])
|
||||||
c <- l
|
l.value = _STRING
|
||||||
}
|
c <- l
|
||||||
*/
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func stringToTtl(l lex, t chan Token) (uint32, bool) {
|
func stringToTtl(l lex, t chan Token) (uint32, bool) {
|
||||||
|
|
Loading…
Reference in New Issue