libdonut  2.3.2
Application framework for cross-platform game development in C++20
Public Member Functions | List of all members
donut::json::Lexer< It > Class Template Reference

Lexical analyzer for scanning and tokenizing input in the JSON5 format. More...

#include <donut/json.hpp>

Public Member Functions

 Lexer (unicode::UTF8Iterator< It > it, unicode::UTF8Sentinel end, const SourceLocation &source)
 Construct a lexer with a Unicode iterator pair as input. More...
 
Token scan ()
 Scan and consume the next token from the input. More...
 

Detailed Description

template<typename It>
class donut::json::Lexer< It >

Lexical analyzer for scanning and tokenizing input in the JSON5 format.

Template Parameters
Ititerator type of the underlying input source. Must be an input iterator.

Constructor & Destructor Documentation

◆ Lexer()

template<typename It >
donut::json::Lexer< It >::Lexer ( unicode::UTF8Iterator< It >  it,
unicode::UTF8Sentinel  end,
const SourceLocation source 
)
inline

Construct a lexer with a Unicode iterator pair as input.

Parameters
ititerator to the beginning of the JSON input to scan.
endsentinel that marks the end of the JSON input to scan.
sourceinitial source location corresponding to the current position of the iterator.
Warning
The iterator pair [it, end) must form a valid forward range.

Member Function Documentation

◆ scan()

template<typename It >
Token donut::json::Lexer< It >::scan ( )
inline

Scan and consume the next token from the input.

This advances the internal state of the lexer.

Returns
the scanned token.
Exceptions
json::Erroron invalid input.
std::bad_allocon allocation failure.
anyexception thrown by the underlying input iterator.

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