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

Parses Thorin code as AST. More...

#include <thorin/ast/parser.h>

Inheritance diagram for thorin::ast::Parser:
[legend]

Public Member Functions

 Parser (AST &ast)
 
ASTast ()
 
Driverdriver ()
 
Ptr< Moduleimport (std::string_view sv)
 
Ptr< Moduleimport (Dbg, std::ostream *md=nullptr)
 
Ptr< Moduleimport (std::istream &, Loc={}, const fs::path *=nullptr, std::ostream *md=nullptr)
 
Ptr< Moduleplugin (Dbg)
 
Ptr< Moduleplugin (const std::string &s)
 
Ptr< Moduleplugin (const char *name)
 

Detailed Description

Parses Thorin code as AST.

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 30 of file parser.h.

Constructor & Destructor Documentation

◆ Parser()

thorin::ast::Parser::Parser ( AST ast)
inline

Definition at line 34 of file parser.h.

Member Function Documentation

◆ ast()

AST & thorin::ast::Parser::ast ( )
inline

Definition at line 37 of file parser.h.

Referenced by driver(), and import().

◆ driver()

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

Definition at line 38 of file parser.h.

References ast(), and thorin::ast::AST::driver().

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

◆ import() [1/3]

Ptr< Module > thorin::ast::Parser::import ( Dbg  dbg,
std::ostream *  md = nullptr 
)

◆ import() [2/3]

Ptr< Module > thorin::ast::Parser::import ( std::istream &  is,
Loc  loc = {},
const fs::path *  path = nullptr,
std::ostream *  md = nullptr 
)

Definition at line 130 of file parser.cpp.

References ast(), driver(), and thorin::ast::AST::error().

◆ import() [3/3]

Ptr< Module > thorin::ast::Parser::import ( std::string_view  sv)
inline

Definition at line 39 of file parser.h.

References driver().

◆ plugin() [1/3]

Ptr< Module > thorin::ast::Parser::plugin ( const char *  name)
inline

Definition at line 44 of file parser.h.

References driver(), and plugin().

Referenced by plugin().

◆ plugin() [2/3]

Ptr< Module > thorin::ast::Parser::plugin ( const std::string &  s)
inline

Definition at line 43 of file parser.h.

References driver(), and plugin().

Referenced by plugin().

◆ plugin() [3/3]

Ptr< Module > thorin::ast::Parser::plugin ( Dbg  dbg)

Definition at line 146 of file parser.cpp.

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


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