Skip to content

Commit

Permalink
Get the fmt tests working for fixed form also
Browse files Browse the repository at this point in the history
  • Loading branch information
certik committed Jul 25, 2021
1 parent b9fcfc3 commit 363ef4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
10 changes: 8 additions & 2 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@ def main():
filename, update_reference)

if ast_f90:
run_test("ast_f90", "lfortran --show-ast-f90 --no-color {infile}",
filename, update_reference)
if filename.endswith(".f"):
# Use fixed form
run_test("ast_f90", "lfortran --fixed-form --show-ast-f90 --no-color {infile}",
filename, update_reference)
else:
# Use free form
run_test("ast_f90", "lfortran --show-ast-f90 --no-color {infile}",
filename, update_reference)

if ast_openmp:
run_test("ast_openmp", "cpptranslate --show-ast-openmp {infile}",
Expand Down
6 changes: 3 additions & 3 deletions src/bin/lfortran.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,14 @@ int emit_ast(const std::string &infile, bool colors, bool indent,
return 0;
}

int emit_ast_f90(const std::string &infile, bool colors)
int emit_ast_f90(const std::string &infile, bool colors, bool fixed_form)
{
std::string input = read_file(infile);
// Src -> AST
Allocator al(64*1024*1024);
LFortran::AST::TranslationUnit_t* ast;
try {
ast = LFortran::parse2(al, input, colors);
ast = LFortran::parse2(al, input, colors, fixed_form);
} catch (const LFortran::TokenizerError &e) {
std::cerr << "Tokenizing error: " << e.msg() << std::endl;
return 1;
Expand Down Expand Up @@ -1169,7 +1169,7 @@ int main(int argc, char *argv[])
arg_fixed_form);
}
if (show_ast_f90) {
return emit_ast_f90(arg_file, !arg_no_color);
return emit_ast_f90(arg_file, !arg_no_color, arg_fixed_form);
}
std::vector<ASRPass> passes;
if (arg_pass != "") {
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1342,4 +1342,4 @@ ast_f90 = true
[[test]]
filename = "fixed_form1.f"
ast = true
#ast_f90 = true
ast_f90 = true

0 comments on commit 363ef4c

Please sign in to comment.