SciLex
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
scilex::token_range Class Reference

A lazy range of tokens, returned by lexer::scan. More...

#include <lexer.hpp>

Collaboration diagram for scilex::token_range:
[legend]

Public Member Functions

 token_range (const lexer &owner, std::string_view source, eof_policy policy)
 Builds the range.
 
token_iterator begin () const
 Begin iterator (produces the first token).
 
token_iterator end () const
 End sentinel.
 

Private Attributes

const lexerowner_ {nullptr}
 Rules provider (not owned).
 
std::string_view source_
 Text being scanned.
 
eof_policy policy_ {eof_policy::omit}
 End-of-input policy.
 

Detailed Description

A lazy range of tokens, returned by lexer::scan.

Holds the lexer and source by reference/view; usable directly in range-for.

Definition at line 1080 of file lexer.hpp.

Constructor & Destructor Documentation

◆ token_range()

scilex::token_range::token_range ( const lexer owner,
std::string_view  source,
eof_policy  policy 
)
inline

Builds the range.

Parameters
[in]ownerThe lexer providing the rules.
[in]sourceThe text to scan.
[in]policyWhether to yield a terminal end_of_input token.

Definition at line 1090 of file lexer.hpp.

Member Function Documentation

◆ begin()

token_iterator scilex::token_range::begin ( ) const
inline

Begin iterator (produces the first token).

Returns
The iterator.

Definition at line 1099 of file lexer.hpp.

◆ end()

token_iterator scilex::token_range::end ( ) const
inline

End sentinel.

Returns
A default-constructed iterator.

Definition at line 1105 of file lexer.hpp.

Member Data Documentation

◆ owner_

const lexer* scilex::token_range::owner_ {nullptr}
private

Rules provider (not owned).

Definition at line 1112 of file lexer.hpp.

◆ policy_

eof_policy scilex::token_range::policy_ {eof_policy::omit}
private

End-of-input policy.

Definition at line 1114 of file lexer.hpp.

◆ source_

std::string_view scilex::token_range::source_
private

Text being scanned.

Definition at line 1113 of file lexer.hpp.


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