]> Cypherpunks repositories - gostls13.git/commit
[dev.cc] cmd/asm: fix macro definition bug in the lexer
authorRob Pike <r@golang.org>
Sat, 14 Feb 2015 00:55:33 +0000 (16:55 -0800)
committerRob Pike <r@golang.org>
Tue, 17 Feb 2015 03:37:01 +0000 (03:37 +0000)
commitae2b145da20b292b2a6349b5d19b67b6c82e10e0
tree09b0eb194a2c50cfcce30f422fec61b2e2154710
parent7fbfbca2c4bd35bf147465554209a0ff72945b63
[dev.cc] cmd/asm: fix macro definition bug in the lexer

Because text/scanner hides the spaces, the lexer treated
#define A(x)
and
#define A (x)
the same, but they are not: the first is an argument with macros, the
second is a simple one-word macro whose definition contains parentheses.
Fix this by noticing the relative column number as we move from A to (.
Hacky but simple.

Also add a helper to recognize the peculiar ARM shifted register operators.

Change-Id: I2cad22f5f1e11d8dad40ad13955793d178afb3ae
Reviewed-on: https://go-review.googlesource.com/4872
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/asm/internal/lex/input.go
src/cmd/asm/internal/lex/lex.go
src/cmd/asm/internal/lex/lex_test.go
src/cmd/asm/internal/lex/slice.go
src/cmd/asm/internal/lex/stack.go
src/cmd/asm/internal/lex/tokenizer.go