Fix off-by-one on the maxTok and maxCom check

This commit is contained in:
Miek Gieben 2015-05-07 10:56:48 +01:00
parent 8bcf792243
commit 6dfba2f623
1 changed files with 2 additions and 3 deletions

View File

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