From a7206b24cac96c08aecf2f3b4cc3c2e555eec708 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 28 Aug 2017 15:59:22 +0200 Subject: pkg/compiler: check and generate types Move most of the logic from sysgen to pkg/compiler. Update #217 --- pkg/ast/scanner.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'pkg/ast/scanner.go') diff --git a/pkg/ast/scanner.go b/pkg/ast/scanner.go index f1573350b..6dab16183 100644 --- a/pkg/ast/scanner.go +++ b/pkg/ast/scanner.go @@ -134,19 +134,19 @@ func (s *scanner) Scan() (tok token, lit string, pos Pos) { s.next() case s.ch == '`': tok = tokCExpr - for s.next(); s.ch != '`'; s.next() { - if s.ch == 0 || s.ch == '\n' { - s.Error(pos, "C expression is not terminated") - break - } + for s.next(); s.ch != '`' && s.ch != '\n'; s.next() { + } + if s.ch == '\n' { + s.Error(pos, "C expression is not terminated") + } else { + lit = string(s.data[pos.Off+1 : s.off]) + s.next() } - lit = string(s.data[pos.Off+1 : s.off]) - s.next() case s.prev2 == tokDefine && s.prev1 == tokIdent: // Note: the old form for C expressions, not really lexable. // TODO(dvyukov): get rid of this eventually. tok = tokCExpr - for s.next(); s.ch != '\n'; s.next() { + for ; s.ch != '\n'; s.next() { } lit = string(s.data[pos.Off:s.off]) case s.ch == '#': -- cgit mrf-deployment