Go to the source code of this file.
Classes | |
struct | MatchState |
Defines | |
#define | lstrlib_c |
#define | LUA_LIB |
#define | uchar(c) ((unsigned char)(c)) |
#define | CAP_UNFINISHED (-1) |
#define | CAP_POSITION (-2) |
#define | L_ESC '%' |
#define | SPECIALS "^$*+?.([%-" |
#define | MAX_ITEM 512 |
#define | FLAGS "-+ #0" |
#define | MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) |
Functions | |
static int | str_len (lua_State *L) |
static ptrdiff_t | posrelat (ptrdiff_t pos, size_t len) |
static int | str_sub (lua_State *L) |
static int | str_reverse (lua_State *L) |
static int | str_lower (lua_State *L) |
static int | str_upper (lua_State *L) |
static int | str_rep (lua_State *L) |
static int | str_byte (lua_State *L) |
static int | str_char (lua_State *L) |
static int | writer (lua_State *L, const void *b, size_t size, void *B) |
static int | str_dump (lua_State *L) |
static int | check_capture (MatchState *ms, int l) |
static int | capture_to_close (MatchState *ms) |
static const char * | classend (MatchState *ms, const char *p) |
static int | match_class (int c, int cl) |
static int | matchbracketclass (int c, const char *p, const char *ec) |
static int | singlematch (int c, const char *p, const char *ep) |
static const char * | match (MatchState *ms, const char *s, const char *p) |
static const char * | matchbalance (MatchState *ms, const char *s, const char *p) |
static const char * | max_expand (MatchState *ms, const char *s, const char *p, const char *ep) |
static const char * | min_expand (MatchState *ms, const char *s, const char *p, const char *ep) |
static const char * | start_capture (MatchState *ms, const char *s, const char *p, int what) |
static const char * | end_capture (MatchState *ms, const char *s, const char *p) |
static const char * | match_capture (MatchState *ms, const char *s, int l) |
static const char * | lmemfind (const char *s1, size_t l1, const char *s2, size_t l2) |
static void | push_onecapture (MatchState *ms, int i, const char *s, const char *e) |
static int | push_captures (MatchState *ms, const char *s, const char *e) |
static int | str_find_aux (lua_State *L, int find) |
static int | str_find (lua_State *L) |
static int | str_match (lua_State *L) |
static int | gmatch_aux (lua_State *L) |
static int | gmatch (lua_State *L) |
static int | gfind_nodef (lua_State *L) |
static void | add_s (MatchState *ms, luaL_Buffer *b, const char *s, const char *e) |
static void | add_value (MatchState *ms, luaL_Buffer *b, const char *s, const char *e) |
static int | str_gsub (lua_State *L) |
static void | addquoted (lua_State *L, luaL_Buffer *b, int arg) |
static const char * | scanformat (lua_State *L, const char *strfrmt, char *form) |
static void | addintlen (char *form) |
static int | str_format (lua_State *L) |
static void | createmetatable (lua_State *L) |
LUALIB_API int | luaopen_string (lua_State *L) |
Variables | |
static const luaL_Reg | strlib [] |
#define CAP_POSITION (-2) |
Definition at line 168 of file lstrlib.c.
Referenced by match(), and push_onecapture().
#define CAP_UNFINISHED (-1) |
Definition at line 167 of file lstrlib.c.
Referenced by capture_to_close(), check_capture(), end_capture(), match(), and push_onecapture().
#define FLAGS "-+ #0" |
Definition at line 688 of file lstrlib.c.
Referenced by scanformat().
#define L_ESC '%' |
Definition at line 182 of file lstrlib.c.
Referenced by add_s(), classend(), match(), matchbracketclass(), singlematch(), and str_format().
#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) |
Definition at line 693 of file lstrlib.c.
Referenced by str_format().
#define MAX_ITEM 512 |
Definition at line 686 of file lstrlib.c.
Referenced by str_format().
#define SPECIALS "^$*+?.([%-" |
Definition at line 183 of file lstrlib.c.
Referenced by str_find_aux().
#define uchar | ( | c | ) | ((unsigned char)(c)) |
Definition at line 24 of file lstrlib.c.
Referenced by add_s(), match(), matchbracketclass(), max_expand(), min_expand(), scanformat(), singlematch(), str_byte(), str_char(), str_lower(), and str_upper().
static void add_s | ( | MatchState * | ms, | |
luaL_Buffer * | b, | |||
const char * | s, | |||
const char * | e | |||
) | [static] |
Definition at line 590 of file lstrlib.c.
References MatchState::L, L_ESC, lua_tolstring(), luaL_addchar, luaL_addlstring(), luaL_addvalue(), push_onecapture(), and uchar.
Referenced by add_value().
static void add_value | ( | MatchState * | ms, | |
luaL_Buffer * | b, | |||
const char * | s, | |||
const char * | e | |||
) | [static] |
Definition at line 612 of file lstrlib.c.
References add_s(), MatchState::L, lua_call(), lua_gettable(), lua_isstring(), lua_pop, lua_pushlstring(), lua_pushvalue(), LUA_TFUNCTION, LUA_TNUMBER, lua_toboolean(), LUA_TSTRING, LUA_TTABLE, lua_type(), luaL_addvalue(), luaL_error(), luaL_typename, push_captures(), and push_onecapture().
Referenced by str_gsub().
static void addintlen | ( | char * | form | ) | [static] |
static void addquoted | ( | lua_State * | L, | |
luaL_Buffer * | b, | |||
int | arg | |||
) | [static] |
Definition at line 696 of file lstrlib.c.
References luaL_addchar, luaL_addlstring(), and luaL_checklstring().
Referenced by str_format().
static int capture_to_close | ( | MatchState * | ms | ) | [static] |
Definition at line 194 of file lstrlib.c.
References CAP_UNFINISHED, MatchState::capture, MatchState::L, MatchState::len, MatchState::level, and luaL_error().
Referenced by end_capture().
static int check_capture | ( | MatchState * | ms, | |
int | l | |||
) | [static] |
Definition at line 186 of file lstrlib.c.
References CAP_UNFINISHED, MatchState::capture, MatchState::L, MatchState::len, MatchState::level, and luaL_error().
Referenced by match_capture().
static const char* classend | ( | MatchState * | ms, | |
const char * | p | |||
) | [static] |
Definition at line 202 of file lstrlib.c.
References MatchState::L, L_ESC, LUA_QL, and luaL_error().
Referenced by match().
static void createmetatable | ( | lua_State * | L | ) | [static] |
Definition at line 850 of file lstrlib.c.
References lua_createtable(), lua_pop, lua_pushliteral, lua_pushvalue(), lua_setfield(), and lua_setmetatable().
Referenced by luaopen_string().
static const char* end_capture | ( | MatchState * | ms, | |
const char * | s, | |||
const char * | p | |||
) | [static] |
Definition at line 343 of file lstrlib.c.
References CAP_UNFINISHED, MatchState::capture, capture_to_close(), MatchState::init, MatchState::len, and match().
Referenced by match().
static int gfind_nodef | ( | lua_State * | L | ) | [static] |
Definition at line 584 of file lstrlib.c.
References LUA_QL, and luaL_error().
static int gmatch | ( | lua_State * | L | ) | [static] |
Definition at line 574 of file lstrlib.c.
References gmatch_aux(), lua_pushcclosure(), lua_pushinteger(), lua_settop(), and luaL_checkstring.
static int gmatch_aux | ( | lua_State * | L | ) | [static] |
Definition at line 548 of file lstrlib.c.
References MatchState::L, MatchState::level, lua_pushinteger(), lua_replace(), lua_tointeger(), lua_tolstring(), lua_tostring, lua_upvalueindex, match(), push_captures(), MatchState::src_end, and MatchState::src_init.
Referenced by gmatch().
static const char* lmemfind | ( | const char * | s1, | |
size_t | l1, | |||
const char * | s2, | |||
size_t | l2 | |||
) | [static] |
Definition at line 444 of file lstrlib.c.
Referenced by str_find_aux().
LUALIB_API int luaopen_string | ( | lua_State * | L | ) |
Definition at line 865 of file lstrlib.c.
References createmetatable(), lua_getfield(), lua_setfield(), LUA_STRLIBNAME, and luaL_register().
static const char * match | ( | MatchState * | ms, | |
const char * | s, | |||
const char * | p | |||
) | [static] |
Definition at line 365 of file lstrlib.c.
References CAP_POSITION, CAP_UNFINISHED, classend(), end_capture(), MatchState::L, L_ESC, LUA_QL, luaL_error(), match_capture(), matchbalance(), matchbracketclass(), max_expand(), min_expand(), singlematch(), MatchState::src_end, MatchState::src_init, start_capture(), and uchar.
Referenced by docListDiscardEmpty(), docListTrim(), end_capture(), gmatch_aux(), matchQuality(), max_expand(), mergePosList(), min_expand(), posListPhraseMerge(), snippetOffsetsOfColumn(), start_capture(), str_find_aux(), and str_gsub().
static const char* match_capture | ( | MatchState * | ms, | |
const char * | s, | |||
int | l | |||
) | [static] |
Definition at line 354 of file lstrlib.c.
References MatchState::capture, check_capture(), MatchState::init, MatchState::len, and MatchState::src_end.
Referenced by match().
static int match_class | ( | int | c, | |
int | cl | |||
) | [static] |
Definition at line 226 of file lstrlib.c.
Referenced by matchbracketclass(), and singlematch().
static const char* matchbalance | ( | MatchState * | ms, | |
const char * | s, | |||
const char * | p | |||
) | [static] |
Definition at line 281 of file lstrlib.c.
References MatchState::L, and luaL_error().
Referenced by match().
static int matchbracketclass | ( | int | c, | |
const char * | p, | |||
const char * | ec | |||
) | [static] |
Definition at line 245 of file lstrlib.c.
References L_ESC, match_class(), and uchar.
Referenced by match(), and singlematch().
static const char* max_expand | ( | MatchState * | ms, | |
const char * | s, | |||
const char * | p, | |||
const char * | ep | |||
) | [static] |
Definition at line 301 of file lstrlib.c.
References match(), singlematch(), MatchState::src_end, and uchar.
Referenced by match().
static const char* min_expand | ( | MatchState * | ms, | |
const char * | s, | |||
const char * | p, | |||
const char * | ep | |||
) | [static] |
static ptrdiff_t posrelat | ( | ptrdiff_t | pos, | |
size_t | len | |||
) | [static] |
Definition at line 36 of file lstrlib.c.
Referenced by str_byte(), str_find_aux(), and str_sub().
static int push_captures | ( | MatchState * | ms, | |
const char * | s, | |||
const char * | e | |||
) | [static] |
Definition at line 485 of file lstrlib.c.
References MatchState::L, MatchState::level, luaL_checkstack(), and push_onecapture().
Referenced by add_value(), gmatch_aux(), and str_find_aux().
static void push_onecapture | ( | MatchState * | ms, | |
int | i, | |||
const char * | s, | |||
const char * | e | |||
) | [static] |
Definition at line 466 of file lstrlib.c.
References CAP_POSITION, CAP_UNFINISHED, MatchState::capture, MatchState::init, MatchState::L, MatchState::len, MatchState::level, lua_pushinteger(), lua_pushlstring(), luaL_error(), and MatchState::src_init.
Referenced by add_s(), add_value(), and push_captures().
static const char* scanformat | ( | lua_State * | L, | |
const char * | strfrmt, | |||
char * | form | |||
) | [static] |
Definition at line 725 of file lstrlib.c.
References FLAGS, luaL_error(), and uchar.
Referenced by str_format().
static int singlematch | ( | int | c, | |
const char * | p, | |||
const char * | ep | |||
) | [static] |
Definition at line 268 of file lstrlib.c.
References L_ESC, match_class(), matchbracketclass(), and uchar.
Referenced by match(), max_expand(), and min_expand().
static const char* start_capture | ( | MatchState * | ms, | |
const char * | s, | |||
const char * | p, | |||
int | what | |||
) | [static] |
Definition at line 329 of file lstrlib.c.
References MatchState::capture, MatchState::init, MatchState::L, MatchState::len, MatchState::level, LUA_MAXCAPTURES, luaL_error(), and match().
Referenced by match().
static int str_byte | ( | lua_State * | L | ) | [static] |
Definition at line 106 of file lstrlib.c.
References lua_pushinteger(), luaL_checklstring(), luaL_checkstack(), luaL_error(), luaL_optinteger(), posrelat(), and uchar.
static int str_char | ( | lua_State * | L | ) | [static] |
Definition at line 125 of file lstrlib.c.
References lua_gettop(), luaL_addchar, luaL_argcheck, luaL_buffinit(), luaL_checkint, luaL_pushresult(), and uchar.
static int str_dump | ( | lua_State * | L | ) | [static] |
Definition at line 147 of file lstrlib.c.
References lua_dump(), lua_settop(), LUA_TFUNCTION, luaL_buffinit(), luaL_checktype(), luaL_error(), luaL_pushresult(), and writer().
static int str_find | ( | lua_State * | L | ) | [static] |
Definition at line 538 of file lstrlib.c.
References str_find_aux().
static int str_find_aux | ( | lua_State * | L, | |
int | find | |||
) | [static] |
Definition at line 495 of file lstrlib.c.
References MatchState::L, MatchState::level, lmemfind(), lua_pushinteger(), lua_pushnil(), lua_toboolean(), luaL_checklstring(), luaL_optinteger(), match(), posrelat(), push_captures(), SPECIALS, MatchState::src_end, and MatchState::src_init.
Referenced by str_find(), and str_match().
static int str_format | ( | lua_State * | L | ) | [static] |
Definition at line 756 of file lstrlib.c.
References addintlen(), addquoted(), L_ESC, LUA_INTFRM_T, lua_pushvalue(), LUA_QL, luaL_addchar, luaL_addlstring(), luaL_addvalue(), luaL_buffinit(), luaL_checklstring(), luaL_checknumber(), luaL_error(), luaL_pushresult(), MAX_FORMAT, MAX_ITEM, and scanformat().
static int str_gsub | ( | lua_State * | L | ) | [static] |
Definition at line 644 of file lstrlib.c.
References add_value(), MatchState::L, MatchState::level, lua_pushinteger(), LUA_TFUNCTION, LUA_TNUMBER, LUA_TSTRING, LUA_TTABLE, lua_type(), luaL_addchar, luaL_addlstring(), luaL_argcheck, luaL_buffinit(), luaL_checklstring(), luaL_checkstring, luaL_optint, luaL_pushresult(), match(), MatchState::src_end, and MatchState::src_init.
static int str_len | ( | lua_State * | L | ) | [static] |
Definition at line 28 of file lstrlib.c.
References lua_pushinteger(), and luaL_checklstring().
static int str_lower | ( | lua_State * | L | ) | [static] |
Definition at line 68 of file lstrlib.c.
References luaL_addchar, luaL_buffinit(), luaL_checklstring(), luaL_pushresult(), and uchar.
static int str_match | ( | lua_State * | L | ) | [static] |
Definition at line 543 of file lstrlib.c.
References str_find_aux().
static int str_rep | ( | lua_State * | L | ) | [static] |
Definition at line 93 of file lstrlib.c.
References luaL_addlstring(), luaL_buffinit(), luaL_checkint, luaL_checklstring(), and luaL_pushresult().
static int str_reverse | ( | lua_State * | L | ) | [static] |
Definition at line 57 of file lstrlib.c.
References luaL_addchar, luaL_buffinit(), luaL_checklstring(), and luaL_pushresult().
static int str_sub | ( | lua_State * | L | ) | [static] |
Definition at line 43 of file lstrlib.c.
References lua_pushliteral, lua_pushlstring(), luaL_checkinteger(), luaL_checklstring(), luaL_optinteger(), and posrelat().
static int str_upper | ( | lua_State * | L | ) | [static] |
Definition at line 81 of file lstrlib.c.
References luaL_addchar, luaL_buffinit(), luaL_checklstring(), luaL_pushresult(), and uchar.
static int writer | ( | lua_State * | L, | |
const void * | b, | |||
size_t | size, | |||
void * | B | |||
) | [static] |
Definition at line 140 of file lstrlib.c.
References luaL_addlstring().
Referenced by docListAndMerge(), docListExceptMerge(), docListMerge(), docListOrMerge(), docListPhraseMerge(), docListUnion(), optimizeFunc(), posListPhraseMerge(), posListUnion(), segmentMerge(), str_dump(), and writeZeroSegment().
{ {"byte", str_byte}, {"char", str_char}, {"dump", str_dump}, {"find", str_find}, {"format", str_format}, {"gfind", gfind_nodef}, {"gmatch", gmatch}, {"gsub", str_gsub}, {"len", str_len}, {"lower", str_lower}, {"match", str_match}, {"rep", str_rep}, {"reverse", str_reverse}, {"sub", str_sub}, {"upper", str_upper}, {NULL, NULL} }
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:00 2011 by Doxygen 1.6.1