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

Parser. More...

#include <Parser.hpp>

Classes

struct  Error

Public Member Functions

 Parser (const std::vector< Token > &tokens)
 Parser (const std::vector< Token > &tokens, const 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, std::string lexeme)
Token consume (Phasor::TokenType type, std::string message)
Token consume (Phasor::TokenType type, std::string lexeme, 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,
const std::filesystem::path & sourcePath )

Definition at line 69 of file Parser.cpp.

Member Function Documentation

◆ advance()

Definition at line 973 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 524 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 467 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 697 of file Parser.cpp.

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

◆ check()

Definition at line 985 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 593 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,
std::string lexeme,
std::string message )
private

Definition at line 1026 of file Parser.cpp.

Here is the call graph for this function:

◆ consume() [2/2]

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

Definition at line 1002 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 86 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 575 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 1043 of file Parser.cpp.

Here is the call graph for this function:

◆ exportStatement()

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

Definition at line 501 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 519 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 508 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 639 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 945 of file Parser.cpp.

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

◆ finishCall()

std::unique_ptr< AST::Expression > Phasor::Parser::finishCall ( std::unique_ptr< AST::Expression > callee)
private
Here is the caller graph for this function:

◆ forStatement()

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

Definition at line 344 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 131 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
inline

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 320 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 491 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 980 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 558 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 541 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 992 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,
std::string lexeme )
private

Definition at line 1016 of file Parser.cpp.

Here is the call graph for this function:

◆ parse()

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

Definition at line 73 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 171 of file Parser.cpp.

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

◆ peek()

Definition at line 954 of file Parser.cpp.

Here is the caller graph for this function:

◆ peekNext()

Definition at line 959 of file Parser.cpp.

Here is the caller graph for this function:

◆ previous()

Definition at line 968 of file Parser.cpp.

Here is the caller graph for this function:

◆ primary()

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

Definition at line 788 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 483 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 449 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 209 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 875 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 912 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 385 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 621 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 664 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 461 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 194 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 335 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 37 of file Parser.hpp.

◆ currentFunction

std::string Phasor::Parser::currentFunction = ""
private

Definition at line 38 of file Parser.hpp.

◆ lastError

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

Definition at line 39 of file Parser.hpp.

◆ sourcePath

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

Definition at line 40 of file Parser.hpp.

◆ tokens

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

Definition at line 36 of file Parser.hpp.


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