libcss
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
lex.h File Reference
#include <libwapcaplet/libwapcaplet.h>
#include <libcss/errors.h>
#include <libcss/functypes.h>
#include <libcss/types.h>
#include <parserutils/input/inputstream.h>

Go to the source code of this file.

Classes

union  css_lexer_optparams
 
struct  css_token
 

Typedefs

typedef struct css_lexer css_lexer
 
typedef enum css_lexer_opttype css_lexer_opttype
 
typedef union css_lexer_optparams css_lexer_optparams
 
typedef enum css_token_type css_token_type
 
typedef struct css_token css_token
 

Enumerations

enum  css_lexer_opttype { CSS_LEXER_EMIT_COMMENTS }
 
enum  css_token_type {
  CSS_TOKEN_IDENT , CSS_TOKEN_ATKEYWORD , CSS_TOKEN_HASH , CSS_TOKEN_FUNCTION ,
  CSS_TOKEN_STRING , CSS_TOKEN_INVALID_STRING , CSS_TOKEN_URI , CSS_TOKEN_UNICODE_RANGE ,
  CSS_TOKEN_CHAR , CSS_TOKEN_NUMBER , CSS_TOKEN_PERCENTAGE , CSS_TOKEN_DIMENSION ,
  CSS_TOKEN_LAST_INTERN , CSS_TOKEN_CDO , CSS_TOKEN_CDC , CSS_TOKEN_S ,
  CSS_TOKEN_COMMENT , CSS_TOKEN_INCLUDES , CSS_TOKEN_DASHMATCH , CSS_TOKEN_PREFIXMATCH ,
  CSS_TOKEN_SUFFIXMATCH , CSS_TOKEN_SUBSTRINGMATCH , CSS_TOKEN_EOF
}
 

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)
 

Typedef Documentation

◆ css_lexer

typedef struct css_lexer css_lexer

◆ css_lexer_optparams

Lexer option parameters

◆ css_lexer_opttype

Lexer option types

◆ css_token

typedef struct css_token css_token

Token object

◆ css_token_type

Token type

Enumeration Type Documentation

◆ css_lexer_opttype

Lexer option types

Enumerator
CSS_LEXER_EMIT_COMMENTS 

◆ css_token_type

Token type

Enumerator
CSS_TOKEN_IDENT 
CSS_TOKEN_ATKEYWORD 
CSS_TOKEN_HASH 
CSS_TOKEN_FUNCTION 
CSS_TOKEN_STRING 
CSS_TOKEN_INVALID_STRING 
CSS_TOKEN_URI 
CSS_TOKEN_UNICODE_RANGE 
CSS_TOKEN_CHAR 
CSS_TOKEN_NUMBER 
CSS_TOKEN_PERCENTAGE 
CSS_TOKEN_DIMENSION 
CSS_TOKEN_LAST_INTERN 
CSS_TOKEN_CDO 
CSS_TOKEN_CDC 
CSS_TOKEN_S 
CSS_TOKEN_COMMENT 
CSS_TOKEN_INCLUDES 
CSS_TOKEN_DASHMATCH 
CSS_TOKEN_PREFIXMATCH 
CSS_TOKEN_SUFFIXMATCH 
CSS_TOKEN_SUBSTRINGMATCH 
CSS_TOKEN_EOF 

Function Documentation

◆ css__lexer_create()

css_error css__lexer_create ( parserutils_inputstream *  input,
css_lexer **  lexer 
)

Create a lexer instance

Parameters
inputThe inputstream to read from
lexerPointer to location to receive lexer instance
Returns
CSS_OK on success, CSS_BADPARM on bad parameters, CSS_NOMEM on memory exhaustion

◆ css__lexer_destroy()

css_error css__lexer_destroy ( css_lexer lexer)

Destroy a lexer instance

Parameters
lexerThe instance to destroy
Returns
CSS_OK on success, appropriate error otherwise

◆ css__lexer_get_token()

css_error css__lexer_get_token ( css_lexer lexer,
css_token **  token 
)

Retrieve a token from a lexer

Parameters
lexerThe lexer instance to read from
tokenPointer to location to receive pointer to token
Returns
CSS_OK on success, appropriate error otherwise

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__lexer_setopt()

css_error css__lexer_setopt ( css_lexer lexer,
css_lexer_opttype  type,
css_lexer_optparams params 
)

Configure a lexer instance

Parameters
lexerThe lexer to configure
typeThe option type to modify
paramsOption-specific parameters
Returns
CSS_OK on success, appropriate error otherwise