Fix off-by-one on the maxTok and maxCom check
This commit is contained in:
parent
8bcf792243
commit
6dfba2f623
5
zscan.go
5
zscan.go
|
@ -500,14 +500,14 @@ func zlexer(s *scan, c chan lex) {
|
|||
for err == nil {
|
||||
l.column = s.position.Column
|
||||
l.line = s.position.Line
|
||||
if stri > maxTok {
|
||||
if stri >= maxTok {
|
||||
l.token = "token length insufficient for parsing"
|
||||
l.err = true
|
||||
debug.Printf("[%+v]", l.token)
|
||||
c <- l
|
||||
return
|
||||
}
|
||||
if comi > maxTok {
|
||||
if comi >= maxTok {
|
||||
l.token = "comment length insufficient for parsing"
|
||||
l.err = true
|
||||
debug.Printf("[%+v]", l.token)
|
||||
|
@ -788,7 +788,6 @@ func zlexer(s *scan, c chan lex) {
|
|||
comi++
|
||||
break
|
||||
}
|
||||
println(stri)
|
||||
str[stri] = x
|
||||
stri++
|
||||
space = false
|
||||
|
|
Loading…
Reference in New Issue