From 35bd7ac4f45fcc455bbb9d9830d3f19238eff142 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Tue, 14 Feb 2012 13:57:12 +0100 Subject: [PATCH] Slightly shorter --- zscan.go | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/zscan.go b/zscan.go index 233473ff..5d8fa887 100644 --- a/zscan.go +++ b/zscan.go @@ -602,8 +602,6 @@ func zlexer(s scanner.Scanner, c chan lex) { space = false // send previous gathered text and the quote if stri != 0 { - //komt best vaak langs - //println("DEBUG: SENDING PREV TEXT", string(str[:stri])) l.value = _STRING l.token = string(str[:stri]) c <- l @@ -613,7 +611,7 @@ func zlexer(s scanner.Scanner, c chan lex) { l.token = "\"" c <- l quote = !quote - case '(': + case '(', ')': if quote { str[stri] = byte(x[0]) stri++ @@ -628,28 +626,17 @@ func zlexer(s scanner.Scanner, c chan lex) { escape = false break } - brace++ - case ')': - if quote { - str[stri] = byte(x[0]) - stri++ - break - } - if commt { - break - } - if escape { - str[stri] = byte(x[0]) - stri++ - escape = false - break - } - brace-- - if brace < 0 { - l.err = "extra closing brace" - c <- l - return - } + switch x[0] { + case ')': + brace-- + if brace < 0 { + l.err = "extra closing brace" + c <- l + return + } + case '(': + brace++ + } default: if commt { break