Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::Parser Class Reference

Parses Thorin code into the provided World. More...

#include <thorin/fe/parser.h>

Inheritance diagram for thorin::Parser:
[legend]

Public Member Functions

 Parser (World &world)
 
Worldworld ()
 
Driverdriver ()
 
void import (std::string_view sv)
 
void import (Sym, std::ostream *md=nullptr)
 
void import (std::istream &, const fs::path *=nullptr, std::ostream *md=nullptr)
 
void plugin (Sym)
 
void plugin (const char *name)
 
const Scopesscopes () const
 

Detailed Description

Parses Thorin code into the provided World.

The logic behind the various parse methods is as follows:

  1. The parse_* method does not have a std::string_view ctxt parameter:

    It's the caller's responsibility to first make appropriate FIRST/FOLLOW checks. Otherwise, an assertion will be triggered in the case of a syntax error.

  2. The parse_* method does have a std::string_view ctxt parameter:

    The called method checks this and spits out an appropriate error message using ctxt in the case of a syntax error.

  3. The parse_* method does have a std::string_view ctxt = {} parameter with default argument:
    • If default argument is elided we have the same behavior as in 1.
    • If default argument is provided we have the same behavior as in 2.

Definition at line 33 of file parser.h.

Constructor & Destructor Documentation

◆ Parser()

thorin::Parser::Parser ( World world)
inline

Definition at line 35 of file parser.h.

Member Function Documentation

◆ driver()

Driver & thorin::Parser::driver ( )
inline

Definition at line 41 of file parser.h.

References thorin::World::driver(), and world().

Referenced by import(), import(), plugin(), and plugin().

◆ import() [1/3]

void thorin::Parser::import ( std::istream &  is,
const fs::path *  path = nullptr,
std::ostream *  md = nullptr 
)

Definition at line 60 of file parser.cpp.

References thorin::error(), and world().

◆ import() [2/3]

void thorin::Parser::import ( std::string_view  sv)
inline

Definition at line 42 of file parser.h.

References driver().

◆ import() [3/3]

void thorin::Parser::import ( Sym  name,
std::ostream *  md = nullptr 
)

◆ plugin() [1/2]

void thorin::Parser::plugin ( const char *  name)
inline

Definition at line 46 of file parser.h.

References driver(), and plugin().

Referenced by plugin().

◆ plugin() [2/2]

void thorin::Parser::plugin ( Sym  name)

Definition at line 72 of file parser.cpp.

References thorin::bootstrap(), driver(), and thorin::Driver::load().

◆ scopes()

const Scopes & thorin::Parser::scopes ( ) const
inline

Definition at line 47 of file parser.h.

◆ world()

World & thorin::Parser::world ( )
inline

Definition at line 40 of file parser.h.

Referenced by driver(), import(), and import().


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