mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
ANSI-fication
This commit is contained in:
parent
286da3b46a
commit
7d0c71ac8c
3 changed files with 60 additions and 177 deletions
|
@ -546,8 +546,7 @@ void re_compile_initialize()
|
|||
regexp_ansi_sequences = (regexp_syntax & RE_ANSI_HEX) != 0;
|
||||
}
|
||||
|
||||
int re_set_syntax(syntax)
|
||||
int syntax;
|
||||
int re_set_syntax(int syntax)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -558,8 +557,7 @@ int re_set_syntax(syntax)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hex_char_to_decimal(ch)
|
||||
int ch;
|
||||
static int hex_char_to_decimal(int ch)
|
||||
{
|
||||
if (ch >= '0' && ch <= '9')
|
||||
return ch - '0';
|
||||
|
@ -570,16 +568,10 @@ static int hex_char_to_decimal(ch)
|
|||
return 16;
|
||||
}
|
||||
|
||||
static void re_compile_fastmap_aux(code,
|
||||
pos,
|
||||
visited,
|
||||
can_be_null,
|
||||
fastmap)
|
||||
unsigned char *code;
|
||||
int pos;
|
||||
unsigned char *visited;
|
||||
unsigned char *can_be_null;
|
||||
unsigned char *fastmap;
|
||||
static void re_compile_fastmap_aux(unsigned char *code, int pos,
|
||||
unsigned char *visited,
|
||||
unsigned char *can_be_null,
|
||||
unsigned char *fastmap)
|
||||
{
|
||||
int a;
|
||||
int b;
|
||||
|
@ -706,16 +698,9 @@ static void re_compile_fastmap_aux(code,
|
|||
}
|
||||
}
|
||||
|
||||
static int re_do_compile_fastmap(buffer,
|
||||
used,
|
||||
pos,
|
||||
can_be_null,
|
||||
fastmap)
|
||||
unsigned char *buffer;
|
||||
int used;
|
||||
int pos;
|
||||
unsigned char *can_be_null;
|
||||
unsigned char *fastmap;
|
||||
static int re_do_compile_fastmap(unsigned char *buffer, int used, int pos,
|
||||
unsigned char *can_be_null,
|
||||
unsigned char *fastmap)
|
||||
{
|
||||
unsigned char small_visited[512], *visited;
|
||||
|
||||
|
@ -736,8 +721,7 @@ static int re_do_compile_fastmap(buffer,
|
|||
return 1;
|
||||
}
|
||||
|
||||
void re_compile_fastmap(bufp)
|
||||
regexp_t bufp;
|
||||
void re_compile_fastmap(regexp_t bufp)
|
||||
{
|
||||
if (!bufp->fastmap || bufp->fastmap_accurate)
|
||||
return;
|
||||
|
@ -782,9 +766,7 @@ void re_compile_fastmap(bufp)
|
|||
*
|
||||
*/
|
||||
|
||||
static int re_optimize_star_jump(bufp, code)
|
||||
regexp_t bufp;
|
||||
unsigned char *code;
|
||||
static int re_optimize_star_jump(regexp_t bufp, unsigned char *code)
|
||||
{
|
||||
unsigned char map[256];
|
||||
unsigned char can_be_null;
|
||||
|
@ -945,8 +927,7 @@ static int re_optimize_star_jump(bufp, code)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int re_optimize(bufp)
|
||||
regexp_t bufp;
|
||||
static int re_optimize(regexp_t bufp)
|
||||
{
|
||||
unsigned char *code;
|
||||
|
||||
|
@ -1147,10 +1128,7 @@ else \
|
|||
} \
|
||||
}
|
||||
|
||||
char *re_compile_pattern(regex, size, bufp)
|
||||
unsigned char *regex;
|
||||
int size;
|
||||
regexp_t bufp;
|
||||
char *re_compile_pattern(unsigned char *regex, int size, regexp_t bufp)
|
||||
{
|
||||
int a;
|
||||
int pos;
|
||||
|
@ -1417,8 +1395,8 @@ char *re_compile_pattern(regex, size, bufp)
|
|||
int prev;
|
||||
int offset;
|
||||
int range;
|
||||
int firstchar;
|
||||
|
||||
int firstchar;
|
||||
|
||||
SET_LEVEL_START;
|
||||
ALLOC(1+256/8);
|
||||
STORE(Cset);
|
||||
|
@ -1586,16 +1564,8 @@ var = (unsigned char)*text++; \
|
|||
if (translate) \
|
||||
var = translate[var]
|
||||
|
||||
int re_match(bufp,
|
||||
string,
|
||||
size,
|
||||
pos,
|
||||
old_regs)
|
||||
regexp_t bufp;
|
||||
unsigned char *string;
|
||||
int size;
|
||||
int pos;
|
||||
regexp_registers_t old_regs;
|
||||
int re_match(regexp_t bufp, unsigned char *string, int size, int pos,
|
||||
regexp_registers_t old_regs)
|
||||
{
|
||||
unsigned char *code;
|
||||
unsigned char *translate;
|
||||
|
@ -2021,18 +1991,8 @@ int re_match(bufp,
|
|||
#undef PREFETCH
|
||||
#undef NEXTCHAR
|
||||
|
||||
int re_search(bufp,
|
||||
string,
|
||||
size,
|
||||
pos,
|
||||
range,
|
||||
regs)
|
||||
regexp_t bufp;
|
||||
unsigned char *string;
|
||||
int size;
|
||||
int pos;
|
||||
int range;
|
||||
regexp_registers_t regs;
|
||||
int re_search(regexp_t bufp, unsigned char *string, int size, int pos,
|
||||
int range, regexp_registers_t regs)
|
||||
{
|
||||
unsigned char *fastmap;
|
||||
unsigned char *translate;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue