# Buggy code
def e1(self):
    left = self.e2()
    if self.accept("plusassign"):
        value = self.e1()
        if not isinstance(left, IdNode):
            raise ParseException(
                "Plusassignment target must be an id.",
                self.getline(),
                left.lineno,
                left.colno,
            )
        return PlusAssignmentNode(
            left.subdir, left.lineno, left.colno, left.value, value
        )
    elif self.accept("assign"):
        value = self.e1()
        if not isinstance(left, IdNode):
            raise ParseException(
                "Assignment target must be an id.",
                self.getline(),
                left.lineno,
                left.colno,
            )
        return AssignmentNode(left.subdir, left.lineno, left.colno, left.value, value)
    elif self.accept("questionmark"):
        if self.in_ternary:
            raise ParseException(
                "Nested ternary operators are not allowed.",
                self.getline(),
                left.lineno,
                left.colno,
            )
        self.in_ternary = True
        trueblock = self.e1()
        self.expect("colon")
        falseblock = self.e1()
        self.in_ternary = False
        return TernaryNode(left.lineno, left.colno, left, trueblock, falseblock)
    return left


# Traceback (AttributeError)
Traceback (most recent call last):
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mesonmain.py", line 353, in run
app.generate()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mesonmain.py", line 148, in generate
self._generate(env)
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mesonmain.py", line 188, in _generate
intr = interpreter.Interpreter(b, g)
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1327, in __init__
self.load_root_meson_file()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/interpreterbase.py", line 124, in load_root_meson_file
self.ast = mparser.Parser(code, self.subdir).parse()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 443, in parse
block = self.codeblock()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 679, in codeblock
curline = self.line()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 673, in line
return self.statement()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 448, in statement
return self.e1()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 451, in e1
left = self.e2()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 476, in e2
left = self.e3()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 485, in e3
left = self.e4()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 494, in e4
left = self.e5()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 501, in e5
return self.e5add()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 504, in e5add
left = self.e5sub()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 510, in e5sub
left = self.e5mod()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 516, in e5mod
left = self.e5mul()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 522, in e5mul
left = self.e5div()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 528, in e5div
left = self.e6()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 538, in e6
return self.e7()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 544, in e7
args = self.args()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 589, in args
s = self.statement()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 448, in statement
return self.e1()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 451, in e1
left = self.e2()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 476, in e2
left = self.e3()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 485, in e3
left = self.e4()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 494, in e4
left = self.e5()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 501, in e5
return self.e5add()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 504, in e5add
left = self.e5sub()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 510, in e5sub
left = self.e5mod()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 516, in e5mod
left = self.e5mul()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 522, in e5mul
left = self.e5div()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 528, in e5div
left = self.e6()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 538, in e6
return self.e7()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 555, in e7
left = self.method_call(left)
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 618, in method_call
args = self.args()
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 590, in args
a = ArgumentNode(s)
File "/home/adrian/.local/lib/python3.5/site-packages/mesonbuild/mparser.py", line 351, in __init__
self.subdir = token.subdir
AttributeError: 'TernaryNode' object has no attribute 'subdir'

# Fixed code
def e1(self):
    left = self.e2()
    if self.accept("plusassign"):
        value = self.e1()
        if not isinstance(left, IdNode):
            raise ParseException(
                "Plusassignment target must be an id.",
                self.getline(),
                left.lineno,
                left.colno,
            )
        return PlusAssignmentNode(
            left.subdir, left.lineno, left.colno, left.value, value
        )
    elif self.accept("assign"):
        value = self.e1()
        if not isinstance(left, IdNode):
            raise ParseException(
                "Assignment target must be an id.",
                self.getline(),
                left.lineno,
                left.colno,
            )
        return AssignmentNode(left.subdir, left.lineno, left.colno, left.value, value)
    elif self.accept("questionmark"):
        if self.in_ternary:
            raise ParseException(
                "Nested ternary operators are not allowed.",
                self.getline(),
                left.lineno,
                left.colno,
            )
        self.in_ternary = True
        trueblock = self.e1()
        self.expect("colon")
        falseblock = self.e1()
        self.in_ternary = False
        return TernaryNode(
            left.subdir, left.lineno, left.colno, left, trueblock, falseblock
        )
    return left