wibble::Parser< Token, Stream > Struct Template Reference

`#include <parse.h>`

Collaboration diagram for wibble::Parser< Token, Stream >:
[legend]

## Public Types

typedef Token::Id | TokenId
typedef ParseContext< Token, Stream > | Context
typedef Context::Fail | Fail
typedef Fail::Type | FailType

## Public Member Functions

bool | valid () const
Context & | context ()
int | position ()
void | rewind (int i)
void | fail (const char *what, FailType type=FailType::Syntax) __attribute__((noreturn))
void | semicolon ()
void | colon ()
Token | eat (TokenId id)
template<typename F , typename G >
void | either (F f, void(G::*g)())
template<typename F , typename G >
bool | maybe (F f, G g)
template<typename F , typename G , typename H >
bool | maybe (F f, G g, H h)
template<typename F >
bool | maybe (void(F::*f)())
bool | maybe (TokenId id)
template<typename T , typename I >
void | many (I i)
template<typename T , typename I >
void | list (I i, TokenId sep)
template<typename T , typename I , typename F >
void | list (I i, void(F::*sep)())
template<typename T , typename I >
void | list (I i, TokenId first, TokenId sep, TokenId last)
Token | eat (bool _fail=true)
bool | next (TokenId id)
| Parser (Context &c)
| Parser ()

## Public Attributes

Context * | ctx
int | _position

## Member Typedef Documentation

template<typename Token , typename Stream >

typedef ParseContext< Token, Stream > wibble::Parser< Token, Stream >::Context

template<typename Token , typename Stream >

typedef Context::Fail wibble::Parser< Token, Stream >::Fail

template<typename Token , typename Stream >

typedef Fail::Type wibble::Parser< Token, Stream >::FailType

template<typename Token , typename Stream >

typedef Token::Id wibble::Parser< Token, Stream >::TokenId

## Constructor & Destructor Documentation

template<typename Token , typename Stream >

wibble::Parser< Token, Stream >::Parser | ( | Context & | c | ) |

inline

template<typename Token , typename Stream >

wibble::Parser< Token, Stream >::Parser | ( |  | ) |

inline

## Member Function Documentation

template<typename Token , typename Stream >

void wibble::Parser< Token, Stream >::colon | ( |  | ) |

inline

References wibble::Token< _Id >::data, wibble::Parser< Token, Stream >::eat(), wibble::Parser< Token, Stream >::fail(), wibble::Token< _Id >::id, and wibble::Parser< Token, Stream >::rewind().

template<typename Token , typename Stream >

Context& wibble::Parser< Token, Stream >::context | ( |  | ) |

inline

References assert, and wibble::Parser< Token, Stream >::ctx.

Referenced by wibble::Parser< Token, Stream >::eat(), wibble::Parser< Token, Stream >::fail(), wibble::Parser< Token, Stream >::list(), wibble::Parser< Token, Stream >::many(), wibble::Parser< Token, Stream >::position(), and wibble::Parser< Token, Stream >::rewind().

template<typename Token , typename Stream >

Token wibble::Parser< Token, Stream >::eat | ( | TokenId | id | ) |

inline

References wibble::Parser< Token, Stream >::fail(), wibble::Token< _Id >::id, and wibble::Parser< Token, Stream >::rewind().

Referenced by wibble::Parser< Token, Stream >::colon(), wibble::Parser< Token, Stream >::list(), wibble::Parser< Token, Stream >::maybe(), wibble::Parser< Token, Stream >::next(), and wibble::Parser< Token, Stream >::semicolon().

template<typename Token , typename Stream >

Token wibble::Parser< Token, Stream >::eat | ( | bool | _fail = `true` | ) |

inline

References wibble::Parser< Token, Stream >::context(), wibble::Parser< Token, Stream >::fail(), wibble::ParseContext< Token, Stream >::position, wibble::ParseContext< Token, Stream >::remove(), wibble::Parser< Token, Stream >::rewind(), and wibble::Token< _Id >::valid().

template<typename Token , typename Stream >
template<typename F , typename G >

void wibble::Parser< Token, Stream >::either | ( | F | f,
|  | void(G::*)() | g
| ) |  |

inline

References wibble::Parser< Token, Stream >::maybe().

template<typename Token , typename Stream >

void wibble::Parser< Token, Stream >::fail | ( | const char * | what,
|  | FailType | type = `FailType::Syntax`
| ) |  |

inline

References wibble::Parser< Token, Stream >::_position, wibble::Parser< Token, Stream >::context(), wibble::ParseContext< Token, Stream >::failures, and wibble::ParseContext< Token, Stream >::position.

Referenced by wibble::Parser< Token, Stream >::colon(), wibble::Parser< Token, Stream >::eat(), wibble::Parser< Token, Stream >::maybe(), and wibble::Parser< Token, Stream >::semicolon().

template<typename Token , typename Stream >
template<typename T , typename I >

void wibble::Parser< Token, Stream >::list | ( | I | i,
|  | TokenId | sep
| ) |  |

inline

References wibble::Parser< Token, Stream >::context(), and wibble::Parser< Token, Stream >::next().

template<typename Token , typename Stream >
template<typename T , typename I , typename F >

void wibble::Parser< Token, Stream >::list | ( | I | i,
|  | void(F::*)() | sep
| ) |  |

inline

References wibble::Parser< Token, Stream >::context(), wibble::Parser< Token, Stream >::position(), and wibble::Parser< Token, Stream >::rewind().

template<typename Token , typename Stream >
template<typename T , typename I >

void wibble::Parser< Token, Stream >::list | ( | I | i,
|  | TokenId | first,
|  | TokenId | sep,
|  | TokenId | last
| ) |  |

inline

References wibble::Parser< Token, Stream >::eat().

template<typename Token , typename Stream >
template<typename T , typename I >

void wibble::Parser< Token, Stream >::many | ( | I | i | ) |

inline

References wibble::Parser< Token, Stream >::context(), wibble::Parser< Token, Stream >::position(), and wibble::Parser< Token, Stream >::rewind().

template<typename Token , typename Stream >
template<typename F , typename G >

bool wibble::Parser< Token, Stream >::maybe | ( | F | f,
|  | G | g
| ) |  |

inline

Referenced by wibble::Parser< Token, Stream >::either(), and wibble::Parser< Token, Stream >::maybe().

template<typename Token , typename Stream >
template<typename F , typename G , typename H >

bool wibble::Parser< Token, Stream >::maybe | ( | F | f,
|  | G | g,
|  | H | h
| ) |  |

inline

References wibble::Parser< Token, Stream >::maybe().

template<typename Token , typename Stream >
template<typename F >

bool wibble::Parser< Token, Stream >::maybe | ( | void(F::*)() | f | ) |

inline

References wibble::Parser< Token, Stream >::fail(), wibble::Parser< Token, Stream >::position(), and wibble::Parser< Token, Stream >::rewind().

template<typename Token , typename Stream >

bool wibble::Parser< Token, Stream >::maybe | ( | TokenId | id | ) |

inline

References wibble::Parser< Token, Stream >::eat(), wibble::Parser< Token, Stream >::position(), and wibble::Parser< Token, Stream >::rewind().

template<typename Token , typename Stream >

bool wibble::Parser< Token, Stream >::next | ( | TokenId | id | ) |

inline

References wibble::Parser< Token, Stream >::eat(), wibble::Token< _Id >::id, and wibble::Parser< Token, Stream >::rewind().

Referenced by wibble::Parser< Token, Stream >::list().

template<typename Token , typename Stream >

int wibble::Parser< Token, Stream >::position | ( |  | ) |

inline

References wibble::Parser< Token, Stream >::context(), and wibble::ParseContext< Token, Stream >::position.

Referenced by wibble::Parser< Token, Stream >::list(), wibble::Parser< Token, Stream >::many(), and wibble::Parser< Token, Stream >::maybe().

template<typename Token , typename Stream >

void wibble::Parser< Token, Stream >::rewind | ( | int | i | ) |

inline

References wibble::Parser< Token, Stream >::context(), wibble::ParseContext< Token, Stream >::position, and wibble::ParseContext< Token, Stream >::rewind().

Referenced by wibble::Parser< Token, Stream >::colon(), wibble::Parser< Token, Stream >::eat(), wibble::Parser< Token, Stream >::list(), wibble::Parser< Token, Stream >::many(), wibble::Parser< Token, Stream >::maybe(), wibble::Parser< Token, Stream >::next(), and wibble::Parser< Token, Stream >::semicolon().

template<typename Token , typename Stream >

void wibble::Parser< Token, Stream >::semicolon | ( |  | ) |

inline

References wibble::Token< _Id >::data, wibble::Parser< Token, Stream >::eat(), wibble::Parser< Token, Stream >::fail(), wibble::Token< _Id >::id, and wibble::Parser< Token, Stream >::rewind().

template<typename Token , typename Stream >

bool wibble::Parser< Token, Stream >::valid | ( |  | ) | const

inline

References wibble::Parser< Token, Stream >::ctx.

## Member Data Documentation

template<typename Token , typename Stream >

int wibble::Parser< Token, Stream >::_position

Referenced by wibble::Parser< Token, Stream >::fail().

template<typename Token , typename Stream >

Context* wibble::Parser< Token, Stream >::ctx

Referenced by wibble::Parser< Token, Stream >::context(), and wibble::Parser< Token, Stream >::valid().

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

- parse.h