Current Version: 1.0.33
Project Name: csspp
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
csspp::lexer Class Reference

#include <lexer.h>

Collaboration diagram for csspp::lexer:
Collaboration graph
[legend]

Public Types

typedef std::shared_ptr< lexerpointer_t
 

Public Member Functions

 lexer (std::istream &in, position const &pos)
 
wide_char_t mbtowc (char const *mb)
 
node::pointer_t next_token ()
 
std::string wctomb (wide_char_t const wc)
 
void wctomb (wide_char_t const wc, char *mb, size_t max_length)
 

Static Public Member Functions

static int hex_to_dec (wide_char_t c)
 
static bool constexpr is_digit (wide_char_t c)
 
static bool constexpr is_hash_character (wide_char_t c)
 
static bool constexpr is_hex (wide_char_t c)
 
static bool constexpr is_identifier (wide_char_t c)
 
static bool constexpr is_non_printable (wide_char_t c)
 
static bool constexpr is_space (wide_char_t c)
 
static bool constexpr is_start_identifier (wide_char_t c)
 
static bool constexpr is_variable (wide_char_t c)
 

Private Member Functions

node::pointer_t comment (bool c_comment)
 
wide_char_t escape ()
 
wide_char_t getc ()
 
node::pointer_t hash ()
 
node::pointer_t identifier (wide_char_t c)
 
node::pointer_t number (wide_char_t c)
 
std::string string (wide_char_t const quote)
 
void ungetc (wide_char_t c)
 
node::pointer_t unicode_range (wide_char_t c)
 
node::pointer_t variable (wide_char_t c)
 

Private Attributes

std::istream & f_in
 
position f_position
 
position f_start_position
 
wide_char_t f_ungetc [UNGETSIZ]
 
size_t f_ungetc_pos = 0
 

Static Private Attributes

static size_t const UNGETSIZ = 16
 

Detailed Description

Definition at line 26 of file lexer.h.

Member Typedef Documentation

◆ pointer_t

typedef std::shared_ptr<lexer> csspp::lexer::pointer_t

Definition at line 29 of file lexer.h.

Constructor & Destructor Documentation

◆ lexer()

csspp::lexer::lexer ( std::istream &  in,
position const &  pos 
)

Definition at line 52 of file lexer.cpp.

Member Function Documentation

◆ comment()

node::pointer_t csspp::lexer::comment ( bool  c_comment)
private

◆ escape()

wide_char_t csspp::lexer::escape ( )
private

◆ getc()

wide_char_t csspp::lexer::getc ( )
private

◆ hash()

node::pointer_t csspp::lexer::hash ( )
private

◆ hex_to_dec()

int csspp::lexer::hex_to_dec ( wide_char_t  c)
static

Definition at line 745 of file lexer.cpp.

Referenced by escape(), csspp::color::set_color(), and unicode_range().

◆ identifier()

node::pointer_t csspp::lexer::identifier ( wide_char_t  c)
private

◆ is_digit()

static bool constexpr csspp::lexer::is_digit ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 87 of file lexer.h.

Referenced by number().

◆ is_hash_character()

static bool constexpr csspp::lexer::is_hash_character ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 99 of file lexer.h.

Referenced by hash().

◆ is_hex()

static bool constexpr csspp::lexer::is_hex ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 92 of file lexer.h.

Referenced by escape(), next_token(), csspp::color::set_color(), and unicode_range().

◆ is_identifier()

static bool constexpr csspp::lexer::is_identifier ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 67 of file lexer.h.

Referenced by csspp::assembler::escape_id(), identifier(), next_token(), and number().

◆ is_non_printable()

static bool constexpr csspp::lexer::is_non_printable ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 47 of file lexer.h.

Referenced by identifier(), and csspp::assembler::output_url().

◆ is_space()

static bool constexpr csspp::lexer::is_space ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 39 of file lexer.h.

Referenced by comment(), escape(), identifier(), and next_token().

◆ is_start_identifier()

static bool constexpr csspp::lexer::is_start_identifier ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 78 of file lexer.h.

Referenced by csspp::assembler::escape_id(), identifier(), and next_token().

◆ is_variable()

static bool constexpr csspp::lexer::is_variable ( wide_char_t  c)
inlinestaticconstexpr

Definition at line 57 of file lexer.h.

Referenced by next_token(), and variable().

◆ mbtowc()

wide_char_t csspp::lexer::mbtowc ( char const *  mb)

◆ next_token()

node::pointer_t csspp::lexer::next_token ( )

◆ number()

node::pointer_t csspp::lexer::number ( wide_char_t  c)
private

◆ string()

std::string csspp::lexer::string ( wide_char_t const  quote)
private

Definition at line 1246 of file lexer.cpp.

References csspp::ERROR_ERROR, escape(), f_start_position, getc(), csspp::error::instance(), ungetc(), and wctomb().

Referenced by identifier().

◆ ungetc()

void csspp::lexer::ungetc ( wide_char_t  c)
private

Definition at line 717 of file lexer.cpp.

References f_ungetc, and f_ungetc_pos.

Referenced by comment(), escape(), hash(), identifier(), next_token(), number(), string(), unicode_range(), and variable().

◆ unicode_range()

node::pointer_t csspp::lexer::unicode_range ( wide_char_t  c)
private

◆ variable()

node::pointer_t csspp::lexer::variable ( wide_char_t  c)
private

◆ wctomb() [1/2]

std::string csspp::lexer::wctomb ( wide_char_t const  wc)

Definition at line 612 of file lexer.cpp.

References wctomb().

◆ wctomb() [2/2]

void csspp::lexer::wctomb ( wide_char_t const  wc,
char *  mb,
size_t  max_length 
)

Member Data Documentation

◆ f_in

std::istream& csspp::lexer::f_in
private

Definition at line 126 of file lexer.h.

Referenced by getc().

◆ f_position

position csspp::lexer::f_position
private

Definition at line 127 of file lexer.h.

Referenced by getc(), and next_token().

◆ f_start_position

position csspp::lexer::f_start_position
private

◆ f_ungetc

wide_char_t csspp::lexer::f_ungetc[UNGETSIZ]
private

Definition at line 129 of file lexer.h.

Referenced by getc(), and ungetc().

◆ f_ungetc_pos

size_t csspp::lexer::f_ungetc_pos = 0
private

Definition at line 130 of file lexer.h.

Referenced by getc(), and ungetc().

◆ UNGETSIZ

size_t const csspp::lexer::UNGETSIZ = 16
staticprivate

Definition at line 112 of file lexer.h.


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

Documentation of CSS Preprocessor.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.