summaryrefslogtreecommitdiff
path: root/androidmk/parser/parser.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2022-03-16 13:42:34 -0700
committer Cole Faust <colefaust@google.com> 2022-03-17 17:15:12 -0700
commite309a91ca8d088a60bc7335f4688cc6e8a81b04f (patch)
tree7ef9e3523858ea769b7ee8f9919aee3db3acdf29 /androidmk/parser/parser.go
parent23162405475f5b5d1facce9f9f7d22ba39066ff0 (diff)
Parse variable references with #s
Inside a variable reference, a # does not start a comment. Fixes: 218742602 Test: go test Change-Id: I16cf04c74a8aa30482fd9293175f893e4efb60f1
Diffstat (limited to 'androidmk/parser/parser.go')
-rw-r--r--androidmk/parser/parser.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/androidmk/parser/parser.go b/androidmk/parser/parser.go
index d24efc10d..fb6be38e9 100644
--- a/androidmk/parser/parser.go
+++ b/androidmk/parser/parser.go
@@ -222,7 +222,7 @@ func (p *parser) parseDirective() bool {
if d == "ifdef" || d == "ifndef" || d == "ifeq" || d == "ifneq" {
d = "el" + d
p.ignoreSpaces()
- expression = p.parseExpression()
+ expression = p.parseExpression('#')
expression.TrimRightSpaces()
} else {
p.errorf("expected ifdef/ifndef/ifeq/ifneq, found %s", d)
@@ -232,7 +232,7 @@ func (p *parser) parseDirective() bool {
expression, endPos = p.parseDefine()
default:
p.ignoreSpaces()
- expression = p.parseExpression()
+ expression = p.parseExpression('#')
}
p.nodes = append(p.nodes, &Directive{
@@ -338,9 +338,6 @@ loop:
value.appendString(`\` + string(p.tok))
}
p.accept(p.tok)
- case '#':
- p.parseComment()
- break loop
case '$':
var variable Variable
variable = p.parseVariable()
@@ -522,7 +519,7 @@ func (p *parser) parseAssignment(t string, target *MakeString, ident *MakeString
// non-whitespace character after the = until the end of the logical line,
// which may included escaped newlines
p.accept('=')
- value := p.parseExpression()
+ value := p.parseExpression('#')
value.TrimLeftSpaces()
if ident.EndsWith('+') && t == "=" {
ident.TrimRightOne()