aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ast/parser.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-05-10 17:15:29 +0200
committerDmitry Vyukov <dvyukov@google.com>2019-05-14 19:28:01 +0200
commit1886b2a4811a4d9adbfc509505a095848cc655eb (patch)
tree8ab666c6f9ea59912d911abd5639480eae534eda /pkg/ast/parser.go
parent354b388e08761dabb99236aa73a24e9b861b6e5f (diff)
pkg/ast: refactor COLON handling
This prepared for handling of bytesize[parent:foo:bar] expressions by allowing multiple identifiers after colon. No functional changes for now, just preparation for storing more than one identifier after colon.
Diffstat (limited to 'pkg/ast/parser.go')
-rw-r--r--pkg/ast/parser.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/ast/parser.go b/pkg/ast/parser.go
index bd9d33657..b68a1a8a2 100644
--- a/pkg/ast/parser.go
+++ b/pkg/ast/parser.go
@@ -425,16 +425,18 @@ func (p *parser) parseType() *Type {
}
p.next()
if allowColon && p.tryConsume(tokColon) {
- arg.HasColon = true
- arg.Pos2 = p.pos
+ col := &Type{
+ Pos: p.pos,
+ }
switch p.tok {
case tokInt:
- arg.Value2, arg.Value2Fmt = p.parseIntValue()
+ col.Value, col.ValueFmt = p.parseIntValue()
case tokIdent:
- arg.Ident2 = p.lit
+ col.Ident = p.lit
default:
p.expect(tokInt, tokIdent)
}
+ arg.Colon = append(arg.Colon, col)
p.next()
}
arg.Args = p.parseTypeList()