Slightly shorter
This commit is contained in:
parent
a031927dde
commit
35bd7ac4f4
37
zscan.go
37
zscan.go
|
@ -602,8 +602,6 @@ func zlexer(s scanner.Scanner, c chan lex) {
|
||||||
space = false
|
space = false
|
||||||
// send previous gathered text and the quote
|
// send previous gathered text and the quote
|
||||||
if stri != 0 {
|
if stri != 0 {
|
||||||
//komt best vaak langs
|
|
||||||
//println("DEBUG: SENDING PREV TEXT", string(str[:stri]))
|
|
||||||
l.value = _STRING
|
l.value = _STRING
|
||||||
l.token = string(str[:stri])
|
l.token = string(str[:stri])
|
||||||
c <- l
|
c <- l
|
||||||
|
@ -613,7 +611,7 @@ func zlexer(s scanner.Scanner, c chan lex) {
|
||||||
l.token = "\""
|
l.token = "\""
|
||||||
c <- l
|
c <- l
|
||||||
quote = !quote
|
quote = !quote
|
||||||
case '(':
|
case '(', ')':
|
||||||
if quote {
|
if quote {
|
||||||
str[stri] = byte(x[0])
|
str[stri] = byte(x[0])
|
||||||
stri++
|
stri++
|
||||||
|
@ -628,28 +626,17 @@ func zlexer(s scanner.Scanner, c chan lex) {
|
||||||
escape = false
|
escape = false
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
brace++
|
switch x[0] {
|
||||||
case ')':
|
case ')':
|
||||||
if quote {
|
brace--
|
||||||
str[stri] = byte(x[0])
|
if brace < 0 {
|
||||||
stri++
|
l.err = "extra closing brace"
|
||||||
break
|
c <- l
|
||||||
}
|
return
|
||||||
if commt {
|
}
|
||||||
break
|
case '(':
|
||||||
}
|
brace++
|
||||||
if escape {
|
}
|
||||||
str[stri] = byte(x[0])
|
|
||||||
stri++
|
|
||||||
escape = false
|
|
||||||
break
|
|
||||||
}
|
|
||||||
brace--
|
|
||||||
if brace < 0 {
|
|
||||||
l.err = "extra closing brace"
|
|
||||||
c <- l
|
|
||||||
return
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
if commt {
|
if commt {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue