Yume
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
yume::ast::Program Struct Referencefinal

The top level structure of a file of source code. More...

#include <ast.hpp>

Inheritance diagram for yume::ast::Program:
Inheritance graph
[legend]
Collaboration diagram for yume::ast::Program:
Collaboration graph
[legend]

Public Member Functions

 Program (span< Token > tok, vector< AnyStmt > body)
 
void visit (Visitor &visitor) const override
 Recursively visit this ast node and all its constituents. More...
 
auto clone () const -> Program *override
 Deep copy, except for the type and attachments. More...
 
auto clone () const -> Stmt *override=0
 Deep copy, except for the type and attachments. More...
 
- Public Member Functions inherited from yume::ast::AST
 AST (const AST &)=delete
 
 AST (AST &&)=default
 
auto operator= (const AST &) -> AST &=delete
 
auto operator= (AST &&) -> AST &=delete
 
virtual ~AST ()=default
 
virtual void visit (Visitor &visitor) const =0
 Recursively visit this ast node and all its constituents. More...
 
auto val_ty () const noexcept -> optional< ty::Type >
 
auto ensure_ty () const -> ty::Type
 
void val_ty (optional< ty::Type > type)
 
void attach_to (nonnull< AST * > other)
 Make the type of this node depend on the type of other. More...
 
auto kind () const -> Kind
 
auto kind_name () const -> string
 Human-readable string representation of the Kind of this node. More...
 
auto token_range () const -> const span< Token > &
 
auto equals_by_hash (ast::AST &other) const -> bool
 
auto location () const -> Loc
 The union of the locations of the Tokens making up this node. More...
 
virtual auto describe () const -> string
 A short, string representation for debugging. More...
 
virtual auto clone () const -> AST *=0
 Deep copy, except for the type and attachments. More...
 

Static Public Member Functions

static auto parse (TokenIterator &tokens, diagnostic::NotesHolder &notes) -> unique_ptr< Program >
 

Public Attributes

vector< AnyStmtbody
 

Additional Inherited Members

- Protected Member Functions inherited from yume::ast::Stmt
 AST (Kind kind, span< Token > tok)
 
 AST (const AST &)=delete
 
 AST (AST &&)=default
 
- Protected Member Functions inherited from yume::ast::AST
void unify_val_ty ()
 Verify the type compatibility of the depends of this node, and merge the types if possible. This is called every time the node's type is updated. More...
 
auto tok () const noexcept -> span< Token >
 
 AST (Kind kind, span< Token > tok)
 

Detailed Description

The top level structure of a file of source code.

Definition at line 957 of file ast.hpp.

Constructor & Destructor Documentation

◆ Program()

yume::ast::Program::Program ( span< Token tok,
vector< AnyStmt body 
)
inlineexplicit

Definition at line 961 of file ast.hpp.

Referenced by clone().

Member Function Documentation

◆ clone()

auto yume::ast::Program::clone ( ) const -> Program *override
overridevirtual

Deep copy, except for the type and attachments.

Implements yume::ast::Stmt.

Definition at line 129 of file ast.cpp.

References body, Program(), and yume::ast::AST::tok().

◆ parse()

auto yume::ast::Program::parse ( TokenIterator tokens,
diagnostic::NotesHolder notes 
) -> unique_ptr<Program>
static

◆ visit()

void yume::ast::Program::visit ( Visitor visitor) const
overridevirtual

Recursively visit this ast node and all its constituents.

See also
Visitor

Implements yume::ast::AST.

Definition at line 143 of file visit.cpp.

References body, and visitor.

Member Data Documentation

◆ body

vector<AnyStmt> yume::ast::Program::body

Definition at line 959 of file ast.hpp.

Referenced by clone(), and visit().


The documentation for this struct was generated from the following files: