[Python] Add missing lexer super class imports.

Although, both lexer and parser grammars can have a custom super
class set, but only the generated parser sources were prepared to
import these classes. The patch makes custom lexer ancestor
classes imported, too.
This commit is contained in:
Renata Hodovan 2018-10-08 14:18:56 +02:00
parent 432022fc1c
commit 301ac82631
2 changed files with 10 additions and 0 deletions

View File

@ -749,6 +749,10 @@ import sys
>>
Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= <<
<if(superClass)>
from .<superClass> import <superClass>
<endif>
<atn>

View File

@ -756,7 +756,13 @@ import sys
>>
Lexer(lexer, atn, actionFuncs, sempredFuncs, superClass) ::= <<
<if(superClass)>
if __name__ is not None and "." in __name__:
from .<superClass> import <superClass>
else:
from <superClass> import <superClass>
<endif>
<atn>
class <lexer.name>(<if(superClass)><superClass><else>Lexer<endif>):