|
libcss
|
#include <assert.h>#include <stdarg.h>#include <stdbool.h>#include <stdint.h>#include <parserutils/charset/utf8.h>#include <parserutils/input/inputstream.h>#include <parserutils/utils/buffer.h>#include <libcss/errors.h>#include "lex/lex.h"#include "utils/parserutilserror.h"#include "utils/utils.h"Classes | |
| struct | css_lexer |
Macros | |
| #define | APPEND(lexer, data, len) |
Enumerations | |
| enum | { sSTART = 0 , sATKEYWORD = 1 , sSTRING = 2 , sHASH = 3 , sNUMBER = 4 , sCDO = 5 , sCDC = 6 , sS = 7 , sCOMMENT = 8 , sMATCH = 9 , sURI = 10 , sIDENT = 11 , sESCAPEDIDENT = 12 , sURL = 13 , sUCR = 14 } |
Functions | |
| css_error | css__lexer_create (parserutils_inputstream *input, css_lexer **lexer) |
| css_error | css__lexer_destroy (css_lexer *lexer) |
| css_error | css__lexer_setopt (css_lexer *lexer, css_lexer_opttype type, css_lexer_optparams *params) |
| css_error | css__lexer_get_token (css_lexer *lexer, css_token **token) |
| #define APPEND | ( | lexer, | |
| data, | |||
| len | |||
| ) |
| anonymous enum |
| Enumerator | |
|---|---|
| sSTART | |
| sATKEYWORD | |
| sSTRING | |
| sHASH | |
| sNUMBER | |
| sCDO | |
| sCDC | |
| sS | |
| sCOMMENT | |
| sMATCH | |
| sURI | |
| sIDENT | |
| sESCAPEDIDENT | |
| sURL | |
| sUCR | |
Create a lexer instance
| input | The inputstream to read from |
| lexer | Pointer to location to receive lexer instance |
Destroy a lexer instance
| lexer | The instance to destroy |
Retrieve a token from a lexer
| lexer | The lexer instance to read from |
| token | Pointer to location to receive pointer to token |
The returned token object is owned by the lexer. However, the client is permitted to modify the data members of the token. The token must not be freed by the client (it may not have been allocated in the first place), nor may any of the pointers contained within it. The client may, if they wish, overwrite any data member of the returned token object – the lexer does not depend on these remaining constant. This allows the client code to efficiently implement a push-back buffer with interned string data.
| css_error css__lexer_setopt | ( | css_lexer * | lexer, |
| css_lexer_opttype | type, | ||
| css_lexer_optparams * | params | ||
| ) |
Configure a lexer instance
| lexer | The lexer to configure |
| type | The option type to modify |
| params | Option-specific parameters |