Parse else ifxxx statement
More recent versions of make provide "else ifdef/ifndef/ifeq/ifneq" directive: ifdef FOO ... else ifdef BAR ... endif Fix the parser to handle it. It returns the same Directive as the respective ifxxx counterpart, only that the Name is set to "elifdef/elifndef/elifeq/elifneq". Test: treehugger Change-Id: I74c6a2c7224bce1dd3465012fa84880fae21349b
This commit is contained in:
parent
9240f955cb
commit
9c35d8bfde
1 changed files with 14 additions and 1 deletions
|
@ -212,8 +212,21 @@ func (p *parser) parseDirective() bool {
|
||||||
expression := SimpleMakeString("", pos)
|
expression := SimpleMakeString("", pos)
|
||||||
|
|
||||||
switch d {
|
switch d {
|
||||||
case "endif", "endef", "else":
|
case "endif", "endef":
|
||||||
// Nothing
|
// Nothing
|
||||||
|
case "else":
|
||||||
|
p.ignoreSpaces()
|
||||||
|
if p.tok != '\n' {
|
||||||
|
d = p.scanner.TokenText()
|
||||||
|
p.accept(scanner.Ident)
|
||||||
|
if d == "ifdef" || d == "ifndef" || d == "ifeq" || d == "ifneq" {
|
||||||
|
d = "el" + d
|
||||||
|
p.ignoreSpaces()
|
||||||
|
expression = p.parseExpression()
|
||||||
|
} else {
|
||||||
|
p.errorf("expected ifdef/ifndef/ifeq/ifneq, found %s", d)
|
||||||
|
}
|
||||||
|
}
|
||||||
case "define":
|
case "define":
|
||||||
expression, endPos = p.parseDefine()
|
expression, endPos = p.parseDefine()
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue