Addressed cases when tokenUpper makes sense to be used.

This commit is contained in:
Alex Sergeyev 2014-08-28 13:34:00 -04:00
parent 1959cc8421
commit 05bec3968a
2 changed files with 12 additions and 10 deletions

View File

@ -671,9 +671,11 @@ func zlexer(s *scan, c chan lex) {
if stri != 0 {
l.value = _STRING
l.token = string(str[:stri])
l.tokenUpper = strings.ToUpper(l.token)
l.length = stri
if !rrtype {
if t, ok := StringToType[strings.ToUpper(l.token)]; ok {
if t, ok := StringToType[l.tokenUpper]; ok {
l.value = _RRTYPE
l.torc = t
rrtype = true

View File

@ -1147,7 +1147,7 @@ func setRRSIG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
l := <-c
if t, ok := StringToType[l.tokenUpper]; !ok {
if strings.HasPrefix(l.tokenUpper, "TYPE") {
if t, ok = typeToInt(l.token); !ok {
if t, ok = typeToInt(l.tokenUpper); !ok {
return nil, &ParseError{f, "bad RRSIG Typecovered", l}, ""
} else {
rr.TypeCovered = t
@ -1261,8 +1261,8 @@ func setNSEC(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
case _BLANK:
// Ok
case _STRING:
if k, ok = StringToType[strings.ToUpper(l.token)]; !ok {
if k, ok = typeToInt(l.token); !ok {
if k, ok = StringToType[l.tokenUpper]; !ok {
if k, ok = typeToInt(l.tokenUpper); !ok {
return nil, &ParseError{f, "bad NSEC TypeBitMap", l}, ""
}
}
@ -1323,8 +1323,8 @@ func setNSEC3(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) {
case _BLANK:
// Ok
case _STRING:
if k, ok = StringToType[strings.ToUpper(l.token)]; !ok {
if k, ok = typeToInt(l.token); !ok {
if k, ok = StringToType[l.tokenUpper]; !ok {
if k, ok = typeToInt(l.tokenUpper); !ok {
return nil, &ParseError{f, "bad NSEC3 TypeBitMap", l}, ""
}
}
@ -1580,7 +1580,7 @@ func setDS(h RR_Header, c chan lex, f string) (RR, *ParseError, string) {
<-c // _BLANK
l = <-c
if i, e := strconv.Atoi(l.token); e != nil {
if i, ok := StringToAlgorithm[strings.ToUpper(l.token)]; !ok {
if i, ok := StringToAlgorithm[l.tokenUpper]; !ok {
return nil, &ParseError{f, "bad DS Algorithm", l}, ""
} else {
rr.Algorithm = i
@ -1681,7 +1681,7 @@ func setCDS(h RR_Header, c chan lex, f string) (RR, *ParseError, string) {
<-c // _BLANK
l = <-c
if i, e := strconv.Atoi(l.token); e != nil {
if i, ok := StringToAlgorithm[strings.ToUpper(l.token)]; !ok {
if i, ok := StringToAlgorithm[l.tokenUpper]; !ok {
return nil, &ParseError{f, "bad CDS Algorithm", l}, ""
} else {
rr.Algorithm = i
@ -1716,7 +1716,7 @@ func setDLV(h RR_Header, c chan lex, f string) (RR, *ParseError, string) {
<-c // _BLANK
l = <-c
if i, e := strconv.Atoi(l.token); e != nil {
if i, ok := StringToAlgorithm[strings.ToUpper(l.token)]; !ok {
if i, ok := StringToAlgorithm[l.tokenUpper]; !ok {
return nil, &ParseError{f, "bad DLV Algorithm", l}, ""
} else {
rr.Algorithm = i
@ -1751,7 +1751,7 @@ func setTA(h RR_Header, c chan lex, f string) (RR, *ParseError, string) {
<-c // _BLANK
l = <-c
if i, e := strconv.Atoi(l.token); e != nil {
if i, ok := StringToAlgorithm[strings.ToUpper(l.token)]; !ok {
if i, ok := StringToAlgorithm[l.tokenUpper]; !ok {
return nil, &ParseError{f, "bad TA Algorithm", l}, ""
} else {
rr.Algorithm = i