Gyoji Compiler
|
Represents the top-level syntax unit for a source file. More...
#include <tree.hpp>
Public Member Functions | |
~TranslationUnit () | |
const std::vector< Gyoji::owned< FileStatement > > & | get_statements () const |
![]() | |
SyntaxNode (Gyoji::context::TokenID _type, specific_type_t _data, const Gyoji::context::SourceReference &_source_ref) | |
const std::vector< std::reference_wrapper< const SyntaxNode > > & | get_children () const |
const Gyoji::context::TokenID & | get_type () const |
template<class T > | |
bool | has_data () const |
template<class T > | |
const T & | get_data () const |
const SyntaxNode & | get_syntax_node () const |
const Gyoji::context::SourceReference & | get_source_ref () const |
Represents the top-level syntax unit for a source file.
This class represents a translation unit, the top-level result of parsing a source-file. A translation unit normally corresponds to a unit that will ultimately be compiled into a binary object file (.o) and linked later into an executable.
A translation unit consists of zero or more file-level statements that represent the file's content. At this level, the statements may be one of:
All syntax information about the file appears in a tree-like structure beneath this node.
TranslationUnit::~TranslationUnit | ( | ) |
Destructor, nothing special.
const std::vector< Gyoji::owned< FileStatement > > & TranslationUnit::get_statements | ( | ) | const |
This method returns a list of 'const' owned pointers to the statements defined in this translation unit.