Skip to content
Snippets Groups Projects
Select Git revision
  • f5fa77f1f0e8f6fe36c628b9512b31e4c274221d
  • develop default protected
  • feature/gmsh-reader
  • origin/stage/bouguettaia
  • feature/kinetic-schemes
  • feature/reconstruction
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • feature/variational-hydro
  • feature/composite-scheme
  • hyperplastic
  • feature/polynomials
  • feature/gks
  • feature/implicit-solver-o2
  • feature/coupling_module
  • feature/implicit-solver
  • feature/merge-local-dt-fsi
  • master protected
  • feature/escobar-smoother
  • v0.5.0 protected
  • v0.4.1 protected
  • v0.4.0 protected
  • v0.3.0 protected
  • v0.2.0 protected
  • v0.1.0 protected
  • Kidder
  • v0.0.4 protected
  • v0.0.3 protected
  • v0.0.2 protected
  • v0 protected
  • v0.0.1 protected
33 results

ASTModulesImporter.cpp

Blame
  • PugsParser.cpp 17.34 KiB
    #include <PugsParser.hpp>
    
    #include <PugsAssert.hpp>
    
    #include <fstream>
    #include <iostream>
    #include <unordered_map>
    #include <variant>
    
    #include <rang.hpp>
    
    #include <pegtl/analyze.hpp>
    #include <pegtl/contrib/parse_tree.hpp>
    #include <pegtl/contrib/parse_tree_to_dot.hpp>
    
    #include <ASTNode.hpp>
    
    #include <ASTBuilder.hpp>
    #include <PEGGrammar.hpp>
    #include <SymbolTable.hpp>
    
    #include <EscapedString.hpp>
    
    #include <ASTNodeExpressionBuilder.hpp>
    
    #include <ASTSymbolTableBuilder.hpp>
    
    #include <ASTPrinter.hpp>
    
    namespace language
    {
    namespace internal
    {
    void
    print_dot(std::ostream& os, const Node& n)
    {
      if (n.is_root()) {
        os << "  x" << &n << " [ label=\"root \\n" << dataTypeName(n.m_data_type) << "\" ]\n";
      } else {
        if (n.has_content()) {
          os << "  x" << &n << " [ label=\"" << n.name() << "\\n"
             << n.string_view() << "\\n"
             << dataTypeName(n.m_data_type) << "\" ]\n";
        } else {
          os << "  x" << &n << " [ label=\"" << n.name() << "\\n" << dataTypeName(n.m_data_type) << "\" ]\n";
        }
      }
      if (!n.children.empty()) {
        os << "  x" << &n << " -> { ";
        for (auto& child : n.children) {
          os << "x" << child.get() << ((child == n.children.back()) ? " }\n" : ", ");
        }
        for (auto& child : n.children) {
          print_dot(os, *child);
        }
      }
    }
    
    }   // namespace internal
    
    void
    print_dot(std::ostream& os, const Node& n)
    {
      Assert(n.is_root());
      os << "digraph parse_tree\n{\n";
      internal::print_dot(os, n);
      os << "}\n";
    }
    
    // namespace internal