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

Parser. More...

#include <Parser.hpp>

Public Member Functions

 Parser (const std::vector< Token > &tokens)
std::unique_ptr< AST::Programparse ()

Private Member Functions

Token peek ()
Token previous ()
Token advance ()
bool isAtEnd ()
bool check (TokenType type)
Token peekNext ()
bool match (TokenType type)
bool match (TokenType type, std::string lexeme)
Token consume (TokenType type, std::string message)
Token consume (TokenType type, std::string lexeme, std::string message)
Token expect (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::StatementreadLineStatement ()
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 = ""

Detailed Description

Parser.

Definition at line 11 of file Parser.hpp.

Constructor & Destructor Documentation

◆ Parser()

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

Definition at line 9 of file Parser.cpp.

Member Function Documentation

◆ advance()

Token Phasor::Parser::advance ( )
private

Definition at line 704 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 > Phasor::Parser::assignment ( )
private

Definition at line 356 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 > Phasor::Parser::block ( )
private

Definition at line 312 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 > Phasor::Parser::call ( )
private

Definition at line 498 of file Parser.cpp.

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

◆ check()

bool Phasor::Parser::check ( TokenType type)
private

Definition at line 716 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 > Phasor::Parser::comparison ( )
private

Definition at line 412 of file Parser.cpp.

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

◆ consume() [1/2]

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

Definition at line 757 of file Parser.cpp.

Here is the call graph for this function:

◆ consume() [2/2]

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

Definition at line 733 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 > Phasor::Parser::declaration ( )
private

Definition at line 23 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 > Phasor::Parser::equality ( )
private

Definition at line 397 of file Parser.cpp.

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

◆ expect()

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

Definition at line 773 of file Parser.cpp.

Here is the call graph for this function:

◆ exportStatement()

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

Definition at line 339 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 > Phasor::Parser::expression ( )
private

Definition at line 351 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 > Phasor::Parser::expressionStatement ( )
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:

◆ factor()

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

Definition at line 452 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 679 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 > Phasor::Parser::finishCall ( std::unique_ptr< AST::Expression > callee)
private

Definition at line 535 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 > Phasor::Parser::forStatement ( )
private

Definition at line 200 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 > Phasor::Parser::functionDeclaration ( )
private

Definition at line 52 of file Parser.cpp.

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

◆ ifStatement()

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

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

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

◆ isAtEnd()

bool Phasor::Parser::isAtEnd ( )
private

Definition at line 711 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 > Phasor::Parser::logicalAnd ( )
private

Definition at line 383 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 > Phasor::Parser::logicalOr ( )
private

Definition at line 369 of file Parser.cpp.

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

◆ match() [1/2]

bool Phasor::Parser::match ( TokenType type)
private

Definition at line 723 of file Parser.cpp.

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

◆ match() [2/2]

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

Definition at line 747 of file Parser.cpp.

Here is the call graph for this function:

◆ parse()

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

Definition at line 13 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 > Phasor::Parser::parseType ( )
private

Definition at line 89 of file Parser.cpp.

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

◆ peek()

Token Phasor::Parser::peek ( )
private

Definition at line 685 of file Parser.cpp.

Here is the caller graph for this function:

◆ peekNext()

Token Phasor::Parser::peekNext ( )
private

Definition at line 690 of file Parser.cpp.

Here is the caller graph for this function:

◆ previous()

Token Phasor::Parser::previous ( )
private

Definition at line 699 of file Parser.cpp.

Here is the caller graph for this function:

◆ primary()

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

Definition at line 564 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 > Phasor::Parser::printStatement ( )
private

Definition at line 325 of file Parser.cpp.

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

◆ readLineStatement()

std::unique_ptr< AST::Statement > Phasor::Parser::readLineStatement ( )
private

◆ returnStatement()

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

Definition at line 295 of file Parser.cpp.

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

◆ statement()

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

Definition at line 119 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 621 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 651 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 > Phasor::Parser::switchStatement ( )
private

Definition at line 241 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 > Phasor::Parser::term ( )
private

Definition at line 437 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 > Phasor::Parser::unary ( )
private

Definition at line 474 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 306 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 > Phasor::Parser::varDeclaration ( )
private

Definition at line 107 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 > Phasor::Parser::whileStatement ( )
private

Definition at line 191 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 19 of file Parser.hpp.

◆ currentFunction

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

Definition at line 20 of file Parser.hpp.

◆ tokens

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

Definition at line 18 of file Parser.hpp.


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