#include "../../lib/parser/parsing.h"
#include "../../lib/parser/provenance.h"
#include "../../lib/parser/unparse.h"
+#include "../../lib/semantics/ParseTreeDump.h"
+#include "../../lib/semantics/resolve-names.h"
#include <cerrno>
#include <cstdio>
#include <cstring>
bool dumpProvenance{false};
bool dumpCookedChars{false};
bool dumpUnparse{false};
+ bool dumpParseTree{false};
+ bool debugResolveNames{false};
bool measureTree{false};
std::vector<std::string> pgf90Args;
const char *prefix{nullptr};
if (driver.measureTree) {
MeasureParseTree(*parsing.parseTree());
}
+ if (driver.debugResolveNames) {
+ Fortran::semantics::ResolveNames(
+ *parsing.parseTree(), parsing.messages().cooked());
+ }
+ if (driver.dumpParseTree) {
+ Fortran::parser::DumpTree(*parsing.parseTree());
+ }
if (driver.dumpUnparse) {
Unparse(std::cout, *parsing.parseTree(), driver.encoding,
true /*capitalize*/);
driver.dumpCookedChars = true;
} else if (arg == "-fdebug-dump-provenance") {
driver.dumpProvenance = true;
+ } else if (arg == "-fdebug-dump-parse-tree") {
+ driver.dumpParseTree = true;
+ } else if (arg == "-fdebug-resolve-names") {
+ driver.debugResolveNames = true;
} else if (arg == "-fdebug-measure-parse-tree") {
driver.measureTree = true;
} else if (arg == "-funparse") {
<< " -funparse parse & reformat only, no code generation\n"
<< " -fdebug-measure-parse-tree\n"
<< " -fdebug-dump-provenance\n"
+ << " -fdebug-dump-parse-tree\n"
+ << " -fdebug-resolve-names\n"
<< " -v -c -o -I -D -U have their usual meanings\n"
<< " -help print this again\n"
<< "Other options are passed through to the compiler.\n";
+++ /dev/null
-#include "../../lib/parser/parsing.h"
-#include "../../lib/semantics/make-types.h"
-
-#include <iostream>
-#include <string>
-
-using namespace Fortran;
-using namespace parser;
-
-int main(int argc, char *const argv[]) {
- if (argc != 2) {
- std::cerr << "Expected 1 source file, got " << (argc - 1) << "\n";
- return EXIT_FAILURE;
- }
- std::string path{argv[1]};
- parser::Parsing parsing;
- if (parsing.ForTesting(path, std::cerr)) {
- semantics::MakeTypes(*parsing.parseTree(), parsing.messages().cooked());
- return EXIT_SUCCESS;
- }
- return EXIT_FAILURE;
-}