From 363ef4cf2a11dd9f611a60a91e078f704141d446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Sun, 25 Jul 2021 12:28:53 +0200 Subject: [PATCH] Get the fmt tests working for fixed form also --- run_tests.py | 10 ++++++++-- src/bin/lfortran.cpp | 6 +++--- tests/tests.toml | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/run_tests.py b/run_tests.py index 323181fa54..b3b34d20ee 100755 --- a/run_tests.py +++ b/run_tests.py @@ -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}", diff --git a/src/bin/lfortran.cpp b/src/bin/lfortran.cpp index a76b179889..bcd67b21bb 100644 --- a/src/bin/lfortran.cpp +++ b/src/bin/lfortran.cpp @@ -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; @@ -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 passes; if (arg_pass != "") { diff --git a/tests/tests.toml b/tests/tests.toml index 01e63705b1..a87567768f 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -1342,4 +1342,4 @@ ast_f90 = true [[test]] filename = "fixed_form1.f" ast = true -#ast_f90 = true +ast_f90 = true