diff options
Diffstat (limited to 'contrib/replxx/src/escape.hxx')
-rw-r--r-- | contrib/replxx/src/escape.hxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/contrib/replxx/src/escape.hxx b/contrib/replxx/src/escape.hxx new file mode 100644 index 000000000..659739532 --- /dev/null +++ b/contrib/replxx/src/escape.hxx @@ -0,0 +1,37 @@ +#ifndef REPLXX_ESCAPE_HXX_INCLUDED +#define REPLXX_ESCAPE_HXX_INCLUDED 1 + +namespace replxx { + +namespace EscapeSequenceProcessing { + +// This is a typedef for the routine called by doDispatch(). It takes the +// current character +// as input, does any required processing including reading more characters and +// calling other +// dispatch routines, then eventually returns the final (possibly extended or +// special) character. +// +typedef char32_t (*CharacterDispatchRoutine)(char32_t); + +// This structure is used by doDispatch() to hold a list of characters to test +// for and +// a list of routines to call if the character matches. The dispatch routine +// list is one +// longer than the character list; the final entry is used if no character +// matches. +// +struct CharacterDispatch { + unsigned int len; // length of the chars list + const char* chars; // chars to test + CharacterDispatchRoutine* dispatch; // array of routines to call +}; + +char32_t doDispatch(char32_t c); + +} + +} + +#endif + |