Source: yapps2
Version: 2.2.1-1
Severity: important

Generator.generate_output starts like this:

    def generate_output(self):
        self.calculate()
        self.write(self.preparser)
        self.write("# Begin -- grammar generated by Yapps\n")
        self.write("from __future__ import print_function\n")

This means that if you have any Python code in self.preparser, your
generated parser will fail with "SyntaxError: from __future__ imports
must occur at the beginning of the file".

I'd suggest moving the __future__ import to immediately before the
preparser to avoid this problem.

-- 
Colin Watson                                       [cjwat...@debian.org]

Reply via email to