#include <ctype.h>#include <stddef.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "lua.h"#include "lauxlib.h"#include "lualib.h"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) |
| #define CAP_UNFINISHED (-1) |
| #define FLAGS "-+ #0" |
| #define L_ESC '%' |
| #define lstrlib_c |
| #define LUA_LIB |
| #define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) |
| #define MAX_ITEM 512 |
| #define SPECIALS "^$*+?.([%-" |
| #define uchar | ( | c | ) | ((unsigned char)(c)) |
| static void add_s | ( | MatchState * | ms, | |
| luaL_Buffer * | b, | |||
| const char * | s, | |||
| const char * | e | |||
| ) | [static] |
| static void add_value | ( | MatchState * | ms, | |
| luaL_Buffer * | b, | |||
| const char * | s, | |||
| const char * | e | |||
| ) | [static] |
| static void addintlen | ( | char * | form | ) | [static] |
| static void addquoted | ( | lua_State * | L, | |
| luaL_Buffer * | b, | |||
| int | arg | |||
| ) | [static] |
| static int capture_to_close | ( | MatchState * | ms | ) | [static] |
| static int check_capture | ( | MatchState * | ms, | |
| int | l | |||
| ) | [static] |
| static const char* classend | ( | MatchState * | ms, | |
| const char * | p | |||
| ) | [static] |
| static void createmetatable | ( | lua_State * | L | ) | [static] |
| static const char* end_capture | ( | MatchState * | ms, | |
| const char * | s, | |||
| const char * | p | |||
| ) | [static] |
| static int gfind_nodef | ( | lua_State * | L | ) | [static] |
| static int gmatch | ( | lua_State * | L | ) | [static] |
| static int gmatch_aux | ( | lua_State * | L | ) | [static] |
| static const char* lmemfind | ( | const char * | s1, | |
| size_t | l1, | |||
| const char * | s2, | |||
| size_t | l2 | |||
| ) | [static] |
| LUALIB_API int luaopen_string | ( | lua_State * | L | ) |
| static const char * match | ( | MatchState * | ms, | |
| const char * | s, | |||
| const char * | p | |||
| ) | [static] |
| static const char* match_capture | ( | MatchState * | ms, | |
| const char * | s, | |||
| int | l | |||
| ) | [static] |
| static int match_class | ( | int | c, | |
| int | cl | |||
| ) | [static] |
| static const char* matchbalance | ( | MatchState * | ms, | |
| const char * | s, | |||
| const char * | p | |||
| ) | [static] |
| static int matchbracketclass | ( | int | c, | |
| const char * | p, | |||
| const char * | ec | |||
| ) | [static] |
| static const char* max_expand | ( | MatchState * | ms, | |
| const char * | s, | |||
| const char * | p, | |||
| const char * | ep | |||
| ) | [static] |
| 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] |
| static int push_captures | ( | MatchState * | ms, | |
| const char * | s, | |||
| const char * | e | |||
| ) | [static] |
| static void push_onecapture | ( | MatchState * | ms, | |
| int | i, | |||
| const char * | s, | |||
| const char * | e | |||
| ) | [static] |
| static const char* scanformat | ( | lua_State * | L, | |
| const char * | strfrmt, | |||
| char * | form | |||
| ) | [static] |
| static int singlematch | ( | int | c, | |
| const char * | p, | |||
| const char * | ep | |||
| ) | [static] |
| static const char* start_capture | ( | MatchState * | ms, | |
| const char * | s, | |||
| const char * | p, | |||
| int | what | |||
| ) | [static] |
| static int str_byte | ( | lua_State * | L | ) | [static] |
| static int str_char | ( | lua_State * | L | ) | [static] |
| static int str_dump | ( | lua_State * | L | ) | [static] |
| static int str_find | ( | lua_State * | L | ) | [static] |
| static int str_find_aux | ( | lua_State * | L, | |
| int | find | |||
| ) | [static] |
| static int str_format | ( | lua_State * | L | ) | [static] |
| static int str_gsub | ( | lua_State * | L | ) | [static] |
| static int str_len | ( | lua_State * | L | ) | [static] |
| static int str_lower | ( | lua_State * | L | ) | [static] |
| static int str_match | ( | lua_State * | L | ) | [static] |
| static int str_rep | ( | lua_State * | L | ) | [static] |
| static int str_reverse | ( | lua_State * | L | ) | [static] |
| static int str_sub | ( | lua_State * | L | ) | [static] |
| static int str_upper | ( | lua_State * | L | ) | [static] |
| static int writer | ( | lua_State * | L, | |
| const void * | b, | |||
| size_t | size, | |||
| void * | B | |||
| ) | [static] |
Initial value:
{
{"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}
}
1.5.5