// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef FORTRAN_SEMANTICS_DUMP_PARSE_TREE_H_
-#define FORTRAN_SEMANTICS_DUMP_PARSE_TREE_H_
+#ifndef FORTRAN_PARSER_DUMP_PARSE_TREE_H_
+#define FORTRAN_PARSER_DUMP_PARSE_TREE_H_
-#include "symbol.h"
+#include "format-specification.h"
+#include "parse-tree-visitor.h"
+#include "parse-tree.h"
#include "../common/idioms.h"
#include "../common/indirection.h"
-#include "../parser/format-specification.h"
-#include "../parser/parse-tree-visitor.h"
-#include "../parser/parse-tree.h"
#include <ostream>
#include <string>
-namespace Fortran::semantics {
+namespace Fortran::parser {
using namespace std::string_literals;
}
}
- bool PutName(const std::string &name, const semantics::Symbol *symbol) {
+ bool PutName(const std::string &name) {
IndentEmptyLine();
- if (symbol != nullptr) {
- out_ << "symbol = " << *symbol;
- } else {
- out_ << "Name = '" << name << '\'';
- }
+ out_ << "Name = '" << name << '\'';
++indent_;
EndLine();
return true;
}
- bool Pre(const parser::Name &x) { return PutName(x.ToString(), x.symbol); }
+ bool Pre(const parser::Name &x) { return PutName(x.ToString()); }
void Post(const parser::Name &) { --indent_; }
- bool Pre(const std::string &x) { return PutName(x, nullptr); }
+ bool Pre(const std::string &x) { return PutName(x); }
void Post(const std::string &x) { --indent_; }
parser::Walk(x, dumper);
}
}
-#endif // FORTRAN_SEMANTICS_DUMP_PARSE_TREE_H_
+#endif // FORTRAN_PARSER_DUMP_PARSE_TREE_H_
// TODO pmk remove when scaffolding is obsolete
#undef PMKDEBUG // #define PMKDEBUG 1
#if PMKDEBUG
-#include "dump-parse-tree.h"
+#include "../parser/dump-parse-tree.h"
#include <iostream>
#endif
},
arrElement.base.u)}) {
const Symbol &ultimate{symbol->GetUltimate()};
- if (const semantics::DeclTypeSpec *type{ultimate.GetType()}) {
+ if (const semantics::DeclTypeSpec * type{ultimate.GetType()}) {
if (!ultimate.IsObjectArray() &&
type->category() == semantics::DeclTypeSpec::Character) {
// The ambiguous S(j:k) was parsed as an array section
} else {
#if PMKDEBUG
std::cout << "TODO: expression analysis failed for this expression: ";
- DumpTree(std::cout, expr);
+ parser::DumpTree(std::cout, expr);
#endif
}
}
target_link_libraries(f18-parse-demo
FortranParser
- FortranSemantics
)
#include "../../lib/common/default-kinds.h"
#include "../../lib/parser/characters.h"
+#include "../../lib/parser/dump-parse-tree.h"
#include "../../lib/parser/features.h"
#include "../../lib/parser/message.h"
#include "../../lib/parser/parse-tree-visitor.h"
#include "../../lib/parser/parsing.h"
#include "../../lib/parser/provenance.h"
#include "../../lib/parser/unparse.h"
-#include "../../lib/semantics/dump-parse-tree.h"
#include <cerrno>
#include <cstdio>
#include <cstring>
}
auto &parseTree{*parsing.parseTree()};
if (driver.dumpParseTree) {
- Fortran::semantics::DumpTree(std::cout, parseTree);
+ Fortran::parser::DumpTree(std::cout, parseTree);
return {};
}
if (driver.dumpUnparse) {
#endif
#include "../../lib/common/default-kinds.h"
#include "../../lib/parser/characters.h"
+#include "../../lib/parser/dump-parse-tree.h"
#include "../../lib/parser/features.h"
#include "../../lib/parser/message.h"
#include "../../lib/parser/parse-tree-visitor.h"
#include "../../lib/parser/parsing.h"
#include "../../lib/parser/provenance.h"
#include "../../lib/parser/unparse.h"
-#include "../../lib/semantics/dump-parse-tree.h"
#include "../../lib/semantics/expression.h"
#include "../../lib/semantics/semantics.h"
#include "../../lib/semantics/unparse-with-symbols.h"
return {};
}
if (driver.dumpParseTree) {
- Fortran::semantics::DumpTree(std::cout, parseTree);
+ Fortran::parser::DumpTree(std::cout, parseTree);
}
if (driver.dumpUnparse) {
Unparse(std::cout, parseTree, driver.encoding, true /*capitalize*/,