Added missing argument to a few function calls. Closes #1647.

pull/1173/merge
Jussi Pakkanen 8 years ago
parent 407130a1d2
commit 6c500fd9db
  1. 19
      mesonbuild/mparser.py

@ -420,6 +420,9 @@ class Parser:
except StopIteration: except StopIteration:
self.current = Token('eof', '', self.current.line_start, self.current.lineno, self.current.colno + self.current.bytespan[1] - self.current.bytespan[0], (0, 0), None) self.current = Token('eof', '', self.current.line_start, self.current.lineno, self.current.colno + self.current.bytespan[1] - self.current.bytespan[0], (0, 0), None)
def getline(self):
return self.lexer.getline(self.current.line_start)
def accept(self, s): def accept(self, s):
if self.current.tid == s: if self.current.tid == s:
self.getsym() self.getsym()
@ -429,12 +432,12 @@ class Parser:
def expect(self, s): def expect(self, s):
if self.accept(s): if self.accept(s):
return True return True
raise ParseException('Expecting %s got %s.' % (s, self.current.tid), self.lexer.getline(self.current.line_start), self.current.lineno, self.current.colno) raise ParseException('Expecting %s got %s.' % (s, self.current.tid), self.getline(), self.current.lineno, self.current.colno)
def block_expect(self, s, block_start): def block_expect(self, s, block_start):
if self.accept(s): if self.accept(s):
return True return True
raise BlockParseException('Expecting %s got %s.' % (s, self.current.tid), self.lexer.getline(self.current.line_start), self.current.lineno, self.current.colno, self.lexer.getline(block_start.line_start), block_start.lineno, block_start.colno) raise BlockParseException('Expecting %s got %s.' % (s, self.current.tid), self.getline(), self.current.lineno, self.current.colno, self.lexer.getline(block_start.line_start), block_start.lineno, block_start.colno)
def parse(self): def parse(self):
block = self.codeblock() block = self.codeblock()
@ -449,18 +452,18 @@ class Parser:
if self.accept('plusassign'): if self.accept('plusassign'):
value = self.e1() value = self.e1()
if not isinstance(left, IdNode): if not isinstance(left, IdNode):
raise ParseException('Plusassignment target must be an id.', left.lineno, left.colno) raise ParseException('Plusassignment target must be an id.', self.getline(), left.lineno, left.colno)
return PlusAssignmentNode(left.lineno, left.colno, left.value, value) return PlusAssignmentNode(left.lineno, left.colno, left.value, value)
elif self.accept('assign'): elif self.accept('assign'):
value = self.e1() value = self.e1()
if not isinstance(left, IdNode): if not isinstance(left, IdNode):
raise ParseException('Assignment target must be an id.', raise ParseException('Assignment target must be an id.',
left.lineno, left.colno) self.getline(), left.lineno, left.colno)
return AssignmentNode(left.lineno, left.colno, left.value, value) return AssignmentNode(left.lineno, left.colno, left.value, value)
elif self.accept('questionmark'): elif self.accept('questionmark'):
if self.in_ternary: if self.in_ternary:
raise ParseException('Nested ternary operators are not allowed.', raise ParseException('Nested ternary operators are not allowed.',
left.lineno, left.colno) self.getline(), left.lineno, left.colno)
self.in_ternary = True self.in_ternary = True
trueblock = self.e1() trueblock = self.e1()
self.expect('colon') self.expect('colon')
@ -536,7 +539,7 @@ class Parser:
self.block_expect('rparen', block_start) self.block_expect('rparen', block_start)
if not isinstance(left, IdNode): if not isinstance(left, IdNode):
raise ParseException('Function call must be applied to plain id', raise ParseException('Function call must be applied to plain id',
left.lineno, left.colno) self.getline(), left.lineno, left.colno)
left = FunctionNode(left.subdir, left.lineno, left.colno, left.value, args) left = FunctionNode(left.subdir, left.lineno, left.colno, left.value, args)
go_again = True go_again = True
while go_again: while go_again:
@ -588,7 +591,7 @@ class Parser:
elif self.accept('colon'): elif self.accept('colon'):
if not isinstance(s, IdNode): if not isinstance(s, IdNode):
raise ParseException('Keyword argument must be a plain identifier.', raise ParseException('Keyword argument must be a plain identifier.',
s.lineno, s.colno) self.getline(), s.lineno, s.colno)
a.set_kwarg(s.value, self.statement()) a.set_kwarg(s.value, self.statement())
potential = self.current potential = self.current
if not self.accept('comma'): if not self.accept('comma'):
@ -604,7 +607,7 @@ class Parser:
methodname = self.e9() methodname = self.e9()
if not(isinstance(methodname, IdNode)): if not(isinstance(methodname, IdNode)):
raise ParseException('Method name must be plain id', raise ParseException('Method name must be plain id',
self.current.lineno, self.current.colno) self.getline(), self.current.lineno, self.current.colno)
self.expect('lparen') self.expect('lparen')
args = self.args() args = self.args()
self.expect('rparen') self.expect('rparen')

Loading…
Cancel
Save