|
SciLex
A header-only C++20 lexer built on REAL
|
Forward (single-pass) iterator yielding one token at a time. More...
#include <lexer.hpp>
Public Types | |
| using | iterator_category = std::input_iterator_tag |
| Single-pass. | |
| using | value_type = token |
| Yielded element. | |
| using | difference_type = std::ptrdiff_t |
| Required typedef. | |
| using | pointer = const token * |
| Pointer to current. | |
| using | reference = const token & |
| Reference to current. | |
Public Member Functions | |
| token_iterator ()=default | |
| Constructs the end sentinel. | |
| token_iterator (const lexer &owner, std::string_view source, eof_policy policy) | |
Constructs a begin iterator over source for owner. | |
| reference | operator* () const |
| Returns the current token. | |
| pointer | operator-> () const |
| Member access to the current token. | |
| token_iterator & | operator++ () |
| Advances to the next token. | |
| void | operator++ (int) |
| Post-increment (single-pass: no useful copy is returned). | |
| bool | operator== (const token_iterator &other) const |
| Equality: both exhausted, or both at the same offset. | |
| bool | operator!= (const token_iterator &other) const |
| Inequality. | |
Forward (single-pass) iterator yielding one token at a time.
A default-constructed iterator is the end sentinel. Each increment runs the lexer just far enough to produce the next non-skipped token; a lex_error thrown by the lexer propagates out of the increment.
| using scilex::token_iterator::difference_type = std::ptrdiff_t |
Required typedef.
| using scilex::token_iterator::iterator_category = std::input_iterator_tag |
Single-pass.
| using scilex::token_iterator::pointer = const token* |
Pointer to current.
| using scilex::token_iterator::reference = const token& |
Reference to current.
Yielded element.
|
default |
Constructs the end sentinel.
|
inline |
Constructs a begin iterator over source for owner.
| [in] | owner | The lexer providing the rules. |
| [in] | source | The text to scan. |
| [in] | policy | Whether to yield a terminal end_of_input token. |
|
inline |
Inequality.
| [in] | other | Another iterator. |
true if the two differ.
|
inline |
Returns the current token.
|
inline |
Advances to the next token.
*this.
|
inline |
Post-increment (single-pass: no useful copy is returned).
|
inline |
Member access to the current token.
|
inline |
Equality: both exhausted, or both at the same offset.
| [in] | other | Another iterator. |
true if the two denote the same position/end.