Skip to content
Snippets Groups Projects
Select Git revision
  • 71d2f3a5e336a1b24b360fb97d78bfb633e11643
  • develop default protected
  • feature/variational-hydro
  • origin/stage/bouguettaia
  • feature/gmsh-reader
  • feature/reconstruction
  • save_clemence
  • feature/kinetic-schemes
  • feature/local-dt-fsi
  • feature/composite-scheme-sources
  • feature/composite-scheme-other-fluxes
  • feature/serraille
  • 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
  • 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

ASTBacktrace.hpp

Blame
  • ASTBacktrace.hpp 1.13 KiB
    #ifndef AST_BACTRACE_HPP
    #define AST_BACTRACE_HPP
    
    #include <utils/PugsAssert.hpp>
    #include <utils/SourceLocation.hpp>
    
    #include <pegtl/file_input.hpp>
    #include <string>
    #include <vector>
    
    class ASTNode;
    class ASTBacktrace
    {
     private:
      std::vector<const ASTNode*> m_stack;
    
      std::shared_ptr<TAO_PEGTL_NAMESPACE::file_input<>> m_file_input;
    
      static ASTBacktrace* m_instance;
    
      ASTBacktrace() = default;
      ASTBacktrace(const std::shared_ptr<TAO_PEGTL_NAMESPACE::file_input<>>& file_input);
      ~ASTBacktrace() = default;
    
     public:
      std::string errorMessageAt(const std::string& error_msg) const;
    
      SourceLocation sourceLocation() const;
    
      void
      push(const ASTNode* node)
      {
        m_stack.push_back(node);
      }
    
      void
      pop()
      {
        m_stack.pop_back();
      }
    
      static void create();   // for unit tests only
      static void create(const std::shared_ptr<TAO_PEGTL_NAMESPACE::file_input<>>& file_input);
      static void destroy();
    
      static ASTBacktrace&
      getInstance()
      {
        Assert(m_instance != nullptr);
        return *m_instance;
      }
    
      ASTBacktrace(const ASTBacktrace&) = delete;
      ASTBacktrace(ASTBacktrace&&)      = delete;
    };
    
    #endif   // AST_BACTRACE_HPP