Phasor 3.3.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
Phasor::Parser Class Reference

Parser. More...

#include <Parser.hpp>

Collaboration diagram for Phasor::Parser:
[legend]

Classes

struct  Error

Public Member Functions

 Parser (const std::vector< Token > &tokens)
 Parser (const std::vector< Token > &tokens, std::filesystem::path sourcePath)
void setSourcePath (const std::filesystem::path &path)
std::unique_ptr< AST::Programparse ()
std::optional< ErrorgetError () const

Private Member Functions

Token peek ()
Token previous ()
Token advance ()
bool isAtEnd ()
bool check (Phasor::TokenType type)
Token peekNext ()
bool match (Phasor::TokenType type)
bool match (Phasor::TokenType type, const std::string &lexeme)
Token consume (Phasor::TokenType type, const std::string &message)
Token consume (Phasor::TokenType type, const std::string &lexeme, const std::string &message)
Token expect (Phasor::TokenType type, const std::string &message)
std::unique_ptr< AST::Statementdeclaration ()
std::unique_ptr< AST::StatementvarDeclaration ()
std::unique_ptr< AST::StatementfunctionDeclaration ()
std::unique_ptr< AST::Statementstatement ()
std::unique_ptr< AST::StatementprintStatement ()
std::unique_ptr< AST::StatementifStatement ()
std::unique_ptr< AST::StatementwhileStatement ()
std::unique_ptr< AST::StatementforStatement ()
std::unique_ptr< AST::StatementswitchStatement ()
std::unique_ptr< AST::StatementreturnStatement ()
std::unique_ptr< AST::StatementunsafeStatement ()
std::unique_ptr< AST::BlockStmtblock ()
std::unique_ptr< AST::StatementimportStatement ()
std::unique_ptr< AST::StatementexportStatement ()
std::unique_ptr< AST::StatementexpressionStatement ()
std::unique_ptr< AST::TypeNodeparseType ()
std::unique_ptr< AST::Expressionexpression ()
std::unique_ptr< AST::Expressionassignment ()
std::unique_ptr< AST::ExpressionlogicalOr ()
std::unique_ptr< AST::ExpressionlogicalAnd ()
std::unique_ptr< AST::Expressionequality ()
std::unique_ptr< AST::Expressioncomparison ()
std::unique_ptr< AST::Expressionterm ()
std::unique_ptr< AST::Expressionfactor ()
std::unique_ptr< AST::Expressionunary ()
std::unique_ptr< AST::Expressioncall ()
std::unique_ptr< AST::ExpressionfinishCall (std::unique_ptr< AST::Expression > callee)
std::unique_ptr< AST::Expressionprimary ()
std::unique_ptr< AST::StructDeclstructDecl ()
std::unique_ptr< AST::StructInstanceExprstructInstance ()
std::unique_ptr< AST::ExpressionfieldAccess (std::unique_ptr< AST::Expression > object)

Private Attributes

std::vector< Tokentokens
int current = 0
std::string currentFunction
std::optional< ErrorlastError
std::filesystem::path sourcePath

Detailed Description

Parser.

Definition at line 12 of file Parser.hpp.

Constructor & Destructor Documentation

◆ Parser() [1/2]

pulsar::Parser::Parser ( const std::vector< Token > & tokens)

Definition at line 65 of file Parser.cpp.

◆ Parser() [2/2]

Phasor::Parser::Parser ( const std::vector< Token > & tokens,
std::filesystem::path sourcePath )

Definition at line 69 of file Parser.cpp.

Member Function Documentation

◆ advance()

Definition at line 988 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assignment()

std::unique_ptr< Expression > pulsar::Parser::assignment ( )
private

Definition at line 525 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ block()

std::unique_ptr< BlockStmt > pulsar::Parser::block ( )
private

Definition at line 468 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ call()

std::unique_ptr< Expression > pulsar::Parser::call ( )
private

Definition at line 712 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check()

Definition at line 1002 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ comparison()

std::unique_ptr< Expression > pulsar::Parser::comparison ( )
private

Definition at line 594 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ consume() [1/2]

Token pulsar::Parser::consume ( Phasor::TokenType type,
const std::string & lexeme,
const std::string & message )
private

Definition at line 1049 of file Parser.cpp.

Here is the call graph for this function:

◆ consume() [2/2]

Token pulsar::Parser::consume ( Phasor::TokenType type,
const std::string & message )
private

Definition at line 1021 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ declaration()

std::unique_ptr< Statement > pulsar::Parser::declaration ( )
private

Definition at line 87 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equality()

std::unique_ptr< Expression > pulsar::Parser::equality ( )
private

Definition at line 576 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expect()

Token pulsar::Parser::expect ( Phasor::TokenType type,
const std::string & message )
private

Definition at line 1068 of file Parser.cpp.

Here is the call graph for this function:

◆ exportStatement()

std::unique_ptr< Statement > Phasor::Parser::exportStatement ( )
private

Definition at line 502 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expression()

std::unique_ptr< Expression > pulsar::Parser::expression ( )
private

Definition at line 520 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ expressionStatement()

std::unique_ptr< Statement > pulsar::Parser::expressionStatement ( )
private

Definition at line 509 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ factor()

std::unique_ptr< Expression > pulsar::Parser::factor ( )
private

Definition at line 648 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fieldAccess()

std::unique_ptr< Expression > Phasor::Parser::fieldAccess ( std::unique_ptr< AST::Expression > object)
private

Definition at line 960 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finishCall()

std::unique_ptr< Expression > pulsar::Parser::finishCall ( std::unique_ptr< AST::Expression > callee)
private

Definition at line 767 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ forStatement()

std::unique_ptr< Statement > pulsar::Parser::forStatement ( )
private

Definition at line 345 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ functionDeclaration()

std::unique_ptr< Statement > pulsar::Parser::functionDeclaration ( )
private

Definition at line 132 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getError()

std::optional< Error > Phasor::Parser::getError ( ) const
inlinenodiscard

Definition at line 31 of file Parser.hpp.

Here is the caller graph for this function:

◆ ifStatement()

std::unique_ptr< Statement > pulsar::Parser::ifStatement ( )
private

Definition at line 321 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ importStatement()

std::unique_ptr< Statement > Phasor::Parser::importStatement ( )
private

Definition at line 492 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isAtEnd()

bool pulsar::Parser::isAtEnd ( )
private

Definition at line 997 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logicalAnd()

std::unique_ptr< Expression > pulsar::Parser::logicalAnd ( )
private

Definition at line 559 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ logicalOr()

std::unique_ptr< Expression > pulsar::Parser::logicalOr ( )
private

Definition at line 542 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ match() [1/2]

Definition at line 1011 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ match() [2/2]

bool pulsar::Parser::match ( Phasor::TokenType type,
const std::string & lexeme )
private

Definition at line 1039 of file Parser.cpp.

Here is the call graph for this function:

◆ parse()

std::unique_ptr< Program > pulsar::Parser::parse ( )

Definition at line 74 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseType()

std::unique_ptr< TypeNode > pulsar::Parser::parseType ( )
private

Definition at line 172 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ peek()

Definition at line 969 of file Parser.cpp.

Here is the caller graph for this function:

◆ peekNext()

Definition at line 974 of file Parser.cpp.

Here is the caller graph for this function:

◆ previous()

Definition at line 983 of file Parser.cpp.

Here is the caller graph for this function:

◆ primary()

std::unique_ptr< Expression > pulsar::Parser::primary ( )
private

Definition at line 803 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printStatement()

std::unique_ptr< Statement > pulsar::Parser::printStatement ( )
private

Definition at line 484 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ returnStatement()

std::unique_ptr< Statement > pulsar::Parser::returnStatement ( )
private

Definition at line 450 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSourcePath()

void Phasor::Parser::setSourcePath ( const std::filesystem::path & path)
inline

Definition at line 18 of file Parser.hpp.

Here is the caller graph for this function:

◆ statement()

std::unique_ptr< Statement > pulsar::Parser::statement ( )
private

Definition at line 210 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ structDecl()

std::unique_ptr< StructDecl > Phasor::Parser::structDecl ( )
private

Definition at line 890 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ structInstance()

std::unique_ptr< StructInstanceExpr > Phasor::Parser::structInstance ( )
private

Definition at line 927 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ switchStatement()

std::unique_ptr< Statement > pulsar::Parser::switchStatement ( )
private

Definition at line 386 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ term()

std::unique_ptr< Expression > pulsar::Parser::term ( )
private

Definition at line 630 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unary()

std::unique_ptr< Expression > pulsar::Parser::unary ( )
private

Definition at line 679 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsafeStatement()

std::unique_ptr< Statement > Phasor::Parser::unsafeStatement ( )
private

Definition at line 462 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ varDeclaration()

std::unique_ptr< Statement > pulsar::Parser::varDeclaration ( )
private

Definition at line 195 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ whileStatement()

std::unique_ptr< Statement > pulsar::Parser::whileStatement ( )
private

Definition at line 336 of file Parser.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ current

int Phasor::Parser::current = 0
private

Definition at line 38 of file Parser.hpp.

◆ currentFunction

std::string Phasor::Parser::currentFunction
private

Definition at line 39 of file Parser.hpp.

◆ lastError

std::optional<Error> Phasor::Parser::lastError
private

Definition at line 40 of file Parser.hpp.

◆ sourcePath

std::filesystem::path Phasor::Parser::sourcePath
private

Definition at line 41 of file Parser.hpp.

◆ tokens

std::vector<Token> Phasor::Parser::tokens
private

Definition at line 37 of file Parser.hpp.


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