Skip to content

Commit

Permalink
#51 ensure make_dag initialises parser
Browse files Browse the repository at this point in the history
  • Loading branch information
arporter committed May 17, 2019
1 parent 7b67fa4 commit 104a427
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/habakkuk/make_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def dag_of_files(options, args):
''' Parses the files listed in args and generates a DAG for all of
the subroutines/inner loops that it finds '''
from fparser.two.utils import FortranSyntaxError
from fparser.two.parser import ParserFactory
from fparser.two import Fortran2003
from fparser.common.readfortran import FortranFileReader
from fparser.two.Fortran2003 import Main_Program, Program_Stmt, \
Expand All @@ -104,6 +105,9 @@ def dag_of_files(options, args):
Name
from habakkuk.parse2003 import Loop, get_child, ParseError

# Create our Fortran parser
parser = ParserFactory().create()

apply_fma_transformation = not options.no_fma
prune_duplicate_nodes = not options.no_prune
unroll_factor = int(options.unroll_factor)
Expand All @@ -116,7 +120,7 @@ def dag_of_files(options, args):
if options.mode != 'auto':
reader.set_mode_from_str(options.mode)
try:
program = Fortran2003.Program(reader)
program = parser(reader)
# Find all the subroutines contained in the file
routines = walk_ast(program.content, [Subroutine_Subprogram,
Function_Subprogram])
Expand Down

0 comments on commit 104a427

Please sign in to comment.