diff options
| author | Rob Pike <r@golang.org> | 2015-02-13 16:55:33 -0800 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2015-02-17 03:37:01 +0000 |
| commit | ae2b145da20b292b2a6349b5d19b67b6c82e10e0 (patch) | |
| tree | 09b0eb194a2c50cfcce30f422fec61b2e2154710 /src/cmd/asm/internal/lex/stack.go | |
| parent | 7fbfbca2c4bd35bf147465554209a0ff72945b63 (diff) | |
| download | go-git-ae2b145da20b292b2a6349b5d19b67b6c82e10e0.tar.gz | |
[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>
Diffstat (limited to 'src/cmd/asm/internal/lex/stack.go')
| -rw-r--r-- | src/cmd/asm/internal/lex/stack.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cmd/asm/internal/lex/stack.go b/src/cmd/asm/internal/lex/stack.go index 9766af51de..72d7f8a165 100644 --- a/src/cmd/asm/internal/lex/stack.go +++ b/src/cmd/asm/internal/lex/stack.go @@ -41,6 +41,10 @@ func (s *Stack) Line() int { return s.tr[len(s.tr)-1].Line() } +func (s *Stack) Col() int { + return s.tr[len(s.tr)-1].Col() +} + func (s *Stack) SetPos(line int, file string) { s.tr[len(s.tr)-1].SetPos(line, file) } |
