Yume
Public Member Functions | List of all members
yume::ast::TokenIterator Class Reference

An iterator-like holding Tokens, used when parsing. More...

#include <parser.hpp>

Public Member Functions

 TokenIterator (const VectorTokenIterator &iterator, const VectorTokenIterator &end)
 
auto at_end () const noexcept -> bool
 Check if the iterator is at the end and no more Tokens could possibly be read. More...
 
auto operator-> () const -> Token *
 
auto operator* () const -> Token
 
auto operator+ (int i) const noexcept -> TokenIterator
 
auto operator- (int i) const noexcept -> TokenIterator
 
auto operator++ () -> TokenIterator &
 
auto operator++ (int) -> TokenIterator
 
auto begin () const -> VectorTokenIterator
 Returns the underlying iterator. This shouldn't really be needed but I'm too lazy to properly model an iterator. More...
 
auto end () const -> VectorTokenIterator
 

Detailed Description

An iterator-like holding Tokens, used when parsing.

Every parse method usually takes this as the first parameter. This is its own struct as it actually holds two iterators, where one is the end. This is to provide safe indexing (avoiding going past the end) without having to pass the end iterator around as a separate parameter.

Definition at line 31 of file parser.hpp.

Constructor & Destructor Documentation

◆ TokenIterator()

yume::ast::TokenIterator::TokenIterator ( const VectorTokenIterator iterator,
const VectorTokenIterator end 
)
inline

Definition at line 36 of file parser.hpp.

Member Function Documentation

◆ at_end()

auto yume::ast::TokenIterator::at_end ( ) const -> bool
inlinenoexcept

Check if the iterator is at the end and no more Tokens could possibly be read.

Definition at line 40 of file parser.hpp.

Referenced by yume::ast::parser::Parser::consume(), yume::ast::parser::Parser::expect(), operator*(), operator++(), operator->(), and yume::ast::parser::Parser::require_separator().

◆ begin()

auto yume::ast::TokenIterator::begin ( ) const -> VectorTokenIterator
inline

Returns the underlying iterator. This shouldn't really be needed but I'm too lazy to properly model an iterator.

Definition at line 67 of file parser.hpp.

Referenced by yume::ast::parser::Parser::ast_ptr(), yume::ast::parser::Parser::make_ast(), yume::ast::parser::Parser::parse_operator(), and yume::ast::parser::Parser::ts().

◆ end()

auto yume::ast::TokenIterator::end ( ) const -> VectorTokenIterator
inline

Definition at line 69 of file parser.hpp.

Referenced by yume::ast::parser::Parser::clamped_iterator().

◆ operator*()

auto yume::ast::TokenIterator::operator* ( ) const -> Token
inline

Definition at line 46 of file parser.hpp.

References at_end().

◆ operator+()

auto yume::ast::TokenIterator::operator+ ( int  i) const -> TokenIterator
inlinenoexcept

Definition at line 51 of file parser.hpp.

◆ operator++() [1/2]

auto yume::ast::TokenIterator::operator++ ( ) -> TokenIterator&
inline

Definition at line 53 of file parser.hpp.

References at_end().

◆ operator++() [2/2]

auto yume::ast::TokenIterator::operator++ ( int  ) -> TokenIterator
inline

Definition at line 60 of file parser.hpp.

References at_end().

◆ operator-()

auto yume::ast::TokenIterator::operator- ( int  i) const -> TokenIterator
inlinenoexcept

Definition at line 52 of file parser.hpp.

◆ operator->()

auto yume::ast::TokenIterator::operator-> ( ) const -> Token*
inline

Definition at line 41 of file parser.hpp.

References at_end().


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