-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Description
The method daast_from_str(filename, args=None) in parser.py initializes Parser with filename and optional args. The args are used as options in initialization of Resolver. Initializing Parser without the optional args throws the following error during initialization of Resolver:
options does not have attribute module_name.
To fix this, we have modified the method daast_from_str as follows:
We have created an option parameter and passed it as the argument to constructor of Parser.
"""Generates DistAlgo AST from source string.
'src' is the DistAlgo source string to parse. Optional argument 'filename'
specifies the filename that appears in error messages, defaults to
'<str>'. Optional argument 'args' is a Namespace object containing the
command line parameters for the compiler. Returns the generated DistAlgo
AST.
"""
try:
options = Namespace()
options.benchmark=False
options.debug=None
options.dump_ast=False
options.geninc=False
options.genpsd=False
options.incfile=None,
options.infile=filename
options.interactive=False
options.module_name='__main__'
options.optimize=-1
options.outfile=None
options.psdfile=None
options.write_bytecode=False
# dt = Parser(filename, args)
dt = Parser(filename, options)
rawast = parse(src, filename)
dt.visit(rawast)
sys.stderr.write("%s compiled with %d errors and %d warnings.\n" %
(filename, dt.errcnt, dt.warncnt))
if dt.errcnt == 0:
return dt.program
except SyntaxError as e:
sys.stderr.write("%s:%d:%d: SyntaxError: %s" % (e.filename, e.lineno,
e.offset, e.text))
return None`
Metadata
Metadata
Assignees
Labels
No labels