Merge pull request #1997 from mesonbuild/fixconditional

Fix conditional continuation bug
pull/1995/merge
Jussi Pakkanen 8 years ago committed by GitHub
commit ee8fcd5f67
  1. 7
      mesonbuild/mparser.py
  2. 7
      test cases/failing/57 or on new line/meson.build
  3. 1
      test cases/failing/57 or on new line/meson_options.txt

@ -475,12 +475,18 @@ class Parser:
def e2(self):
left = self.e3()
while self.accept('or'):
if isinstance(left, EmptyNode):
raise ParseException('Invalid or clause.',
self.getline(), left.lineno, left.colno)
left = OrNode(left, self.e3())
return left
def e3(self):
left = self.e4()
while self.accept('and'):
if isinstance(left, EmptyNode):
raise ParseException('Invalid and clause.',
self.getline(), left.lineno, left.colno)
left = AndNode(left, self.e4())
return left
@ -633,6 +639,7 @@ class Parser:
def ifblock(self):
condition = self.statement()
clause = IfClauseNode(condition.lineno, condition.colno)
self.expect('eol')
block = self.codeblock()
clause.ifs.append(IfNode(clause.lineno, clause.colno, condition, block))
self.elseifblock(clause)

@ -0,0 +1,7 @@
project('silent_or', 'c')
if get_option('foo') == 'true'
or get_option('foo') == 'auto'
else
message('If this message is printed then something is wrong. The or above should give a syntax error.')
endif

@ -0,0 +1 @@
option('foo', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto')
Loading…
Cancel
Save