tcalc 0.2.0
 
Loading...
Searching...
No Matches
tcalc::ast::Parser Class Reference

AST parser. More...

#include <parser.hpp>

Public Member Functions

error::Result< NodePtr<> > parse (std::string_view input)
 Parse the input string.
 
error::Result< NodePtr<> > next_program (ParserContext &ctx)
 Get the next program node.
 
error::Result< NodePtr<> > next_statement (ParserContext &ctx)
 Get the next statement node.
 
error::Result< NodePtr<> > next_expr (ParserContext &ctx)
 Get the next expression node.
 
error::Result< NodePtr<> > next_prio_term (ParserContext &ctx, std::size_t prio)
 Get the next term node with the given priority.
 
error::Result< NodePtr<> > next_if (ParserContext &ctx)
 Get the next if node.
 
error::Result< NodePtr<> > next_assign (ParserContext &ctx)
 Get the next assignment node.
 
error::Result< NodePtr<> > next_factor (ParserContext &ctx)
 Get the next factor node.
 
error::Result< NodePtr<> > next_idref (ParserContext &ctx)
 Get the next identifier reference node (function or variable).
 
error::Result< NodePtr<> > next_fdef (ParserContext &ctx)
 Get the next function definition node.
 
error::Result< NodePtr<> > next_import (ParserContext &ctx)
 Get the next import node.
 

Detailed Description

AST parser.

Member Function Documentation

◆ next_assign()

error::Result< NodePtr<> > tcalc::ast::Parser::next_assign ( ParserContext ctx)

Get the next assignment node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The assignment node result.

◆ next_expr()

error::Result< NodePtr<> > tcalc::ast::Parser::next_expr ( ParserContext ctx)

Get the next expression node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The expression node result.

◆ next_factor()

error::Result< NodePtr<> > tcalc::ast::Parser::next_factor ( ParserContext ctx)

Get the next factor node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The factor node result.

◆ next_fdef()

error::Result< NodePtr<> > tcalc::ast::Parser::next_fdef ( ParserContext ctx)

Get the next function definition node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The function definition node result.

◆ next_idref()

error::Result< NodePtr<> > tcalc::ast::Parser::next_idref ( ParserContext ctx)

Get the next identifier reference node (function or variable).

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The identifier reference node result.

◆ next_if()

error::Result< NodePtr<> > tcalc::ast::Parser::next_if ( ParserContext ctx)

Get the next if node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The if node result.

◆ next_import()

error::Result< NodePtr<> > tcalc::ast::Parser::next_import ( ParserContext ctx)

Get the next import node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The import node result.

◆ next_prio_term()

error::Result< NodePtr<> > tcalc::ast::Parser::next_prio_term ( ParserContext ctx,
std::size_t  prio 
)

Get the next term node with the given priority.

Parameters
ctxThe parser context.
prioThe priority of the term.
Returns
error::Result<NodePtr<>> The term node result.

◆ next_program()

error::Result< NodePtr<> > tcalc::ast::Parser::next_program ( ParserContext ctx)

Get the next program node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The program node result.

◆ next_statement()

error::Result< NodePtr<> > tcalc::ast::Parser::next_statement ( ParserContext ctx)

Get the next statement node.

Parameters
ctxThe parser context.
Returns
error::Result<NodePtr<>> The statement node result.

◆ parse()

error::Result< NodePtr<> > tcalc::ast::Parser::parse ( std::string_view  input)

Parse the input string.

Parameters
inputThe input string to parse.
Returns
error::Result<NodePtr<>> The root node of the AST.

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