libgpac
Documentation of the core library of GPAC
|
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include "cutils.h"
#include "libregexp.h"
#include "libregexp-opcode.h"
Data Structures | |
struct | REParseState |
struct | REOpCode |
struct | REExecState |
struct | REExecContext |
union | REParseState.u |
Macros | |
#define | DEF(id, size) REOP_ ## id, |
#define | CAPTURE_COUNT_MAX 255 |
#define | STACK_SIZE_MAX 255 |
#define | CP_LS 0x2028 |
#define | CP_PS 0x2029 |
#define | TMP_BUF_SIZE 128 |
#define | DEF(id, size) { size }, |
#define | RE_HEADER_FLAGS 0 |
#define | RE_HEADER_CAPTURE_COUNT 1 |
#define | RE_HEADER_STACK_SIZE 2 |
#define | RE_HEADER_LEN 7 |
#define | CLASS_RANGE_BASE 0x40000000 |
#define | GET_CHAR(c, cptr, cbuf_end) |
#define | PEEK_CHAR(c, cptr, cbuf_end) |
#define | PEEK_PREV_CHAR(c, cptr, cbuf_start) |
#define | GET_PREV_CHAR(c, cptr, cbuf_start) |
#define | PREV_CHAR(cptr, cbuf_start) |
Typedefs | |
typedef uintptr_t | StackInt |
Enumerations | |
enum | REOPCodeEnum { REOP_COUNT } |
enum | CharRangeEnum { CHAR_RANGE_d , CHAR_RANGE_D , CHAR_RANGE_s , CHAR_RANGE_S , CHAR_RANGE_w , CHAR_RANGE_W } |
enum | REExecStateEnum { RE_EXEC_STATE_SPLIT , RE_EXEC_STATE_LOOKAHEAD , RE_EXEC_STATE_NEGATIVE_LOOKAHEAD , RE_EXEC_STATE_GREEDY_QUANT } |
Functions | |
static int | is_digit (int c) |
static int | dbuf_insert (DynBuf *s, int pos, int len) |
static uint32_t | lre_canonicalize (uint32_t c, BOOL is_utf16) |
BOOL | lre_is_space (int c) |
static int | cr_init_char_range (REParseState *s, CharRange *cr, uint32_t c) |
static int | cr_canonicalize (CharRange *cr) |
static void | re_emit_op (REParseState *s, int op) |
static int | re_emit_op_u32 (REParseState *s, int op, uint32_t val) |
static int | re_emit_goto (REParseState *s, int op, uint32_t val) |
static void | re_emit_op_u8 (REParseState *s, int op, uint32_t val) |
static void | re_emit_op_u16 (REParseState *s, int op, uint32_t val) |
static int | __attribute__ ((format(printf, 2, 3))) |
static int | re_parse_out_of_memory (REParseState *s) |
static int | parse_digits (const uint8_t **pp, BOOL allow_overflow) |
static int | re_parse_expect (REParseState *s, const uint8_t **pp, int c) |
int | lre_parse_escape (const uint8_t **pp, int allow_utf16) |
static BOOL | is_unicode_char (int c) |
static int | parse_unicode_property (REParseState *s, CharRange *cr, const uint8_t **pp, BOOL is_inv) |
static int | get_class_atom (REParseState *s, CharRange *cr, const uint8_t **pp, BOOL inclass) |
static int | re_emit_range (REParseState *s, const CharRange *cr) |
static int | re_parse_char_class (REParseState *s, const uint8_t **pp) |
static int | re_check_advance (const uint8_t *bc_buf, int bc_buf_len) |
static int | re_is_simple_quantifier (const uint8_t *bc_buf, int bc_buf_len) |
static int | re_parse_group_name (char *buf, int buf_size, const uint8_t **pp, BOOL is_utf16) |
static int | re_parse_captures (REParseState *s, int *phas_named_captures, const char *capture_name) |
static int | re_count_captures (REParseState *s) |
static BOOL | re_has_named_captures (REParseState *s) |
static int | find_group_name (REParseState *s, const char *name) |
static int | re_parse_disjunction (REParseState *s, BOOL is_backward_dir) |
static int | re_parse_term (REParseState *s, BOOL is_backward_dir) |
static int | re_parse_alternative (REParseState *s, BOOL is_backward_dir) |
static int | compute_stack_size (const uint8_t *bc_buf, int bc_buf_len) |
uint8_t * | lre_compile (int *plen, char *error_msg, int error_msg_size, const char *buf, size_t buf_len, int re_flags, void *opaque) |
static BOOL | is_line_terminator (uint32_t c) |
static BOOL | is_word_char (uint32_t c) |
static int | push_state (REExecContext *s, uint8_t **capture, StackInt *stack, size_t stack_len, const uint8_t *pc, const uint8_t *cptr, REExecStateEnum type, size_t count) |
static intptr_t | lre_exec_backtrack (REExecContext *s, uint8_t **capture, StackInt *stack, int stack_len, const uint8_t *pc, const uint8_t *cptr, BOOL no_recurse) |
int | lre_exec (uint8_t **capture, const uint8_t *bc_buf, const uint8_t *cbuf, int cindex, int clen, int cbuf_type, void *opaque) |
int | lre_get_capture_count (const uint8_t *bc_buf) |
int | lre_get_flags (const uint8_t *bc_buf) |
const char * | lre_get_groupnames (const uint8_t *bc_buf) |
Variables | |
static const REOpCode | reopcode_info [REOP_COUNT] |
static const uint16_t | char_range_d [] |
static const uint16_t | char_range_s [] |
uint32_t const | lre_id_start_table_ascii [4] |
uint32_t const | lre_id_continue_table_ascii [4] |
static const uint16_t | char_range_w [] |
static const uint16_t * | char_range_table [] |
struct REParseState |
Data Fields | ||
---|---|---|
DynBuf | byte_code | |
const uint8_t * | buf_ptr | |
const uint8_t * | buf_end | |
const uint8_t * | buf_start | |
int | re_flags | |
BOOL | is_utf16 | |
BOOL | ignore_case | |
BOOL | dotall | |
int | capture_count | |
int | total_capture_count | |
int | has_named_captures | |
void * | opaque | |
DynBuf | group_names | |
union REParseState | u |
struct REOpCode |
Data Fields | ||
---|---|---|
uint8_t | size |
struct REExecState |
Data Fields | ||
---|---|---|
REExecStateEnum | type: 8 | |
uint8_t | stack_len | |
size_t | count | |
const uint8_t * | cptr | |
const uint8_t * | pc | |
void * | buf[0] |
struct REExecContext |
union REParseState.u |
Data Fields | ||
---|---|---|
char | error_msg[TMP_BUF_SIZE] | |
char | tmp_buf[TMP_BUF_SIZE] |
#define DEF | ( | id, | |
size | |||
) | REOP_ ## id, |
#define CAPTURE_COUNT_MAX 255 |
#define STACK_SIZE_MAX 255 |
#define CP_LS 0x2028 |
#define CP_PS 0x2029 |
#define TMP_BUF_SIZE 128 |
#define DEF | ( | id, | |
size | |||
) | { size }, |
#define RE_HEADER_FLAGS 0 |
#define RE_HEADER_CAPTURE_COUNT 1 |
#define RE_HEADER_STACK_SIZE 2 |
#define RE_HEADER_LEN 7 |
#define CLASS_RANGE_BASE 0x40000000 |
#define GET_CHAR | ( | c, | |
cptr, | |||
cbuf_end | |||
) |
#define PEEK_CHAR | ( | c, | |
cptr, | |||
cbuf_end | |||
) |
#define PEEK_PREV_CHAR | ( | c, | |
cptr, | |||
cbuf_start | |||
) |
#define GET_PREV_CHAR | ( | c, | |
cptr, | |||
cbuf_start | |||
) |
#define PREV_CHAR | ( | cptr, | |
cbuf_start | |||
) |
typedef uintptr_t StackInt |
enum REOPCodeEnum |
enum CharRangeEnum |
enum REExecStateEnum |
|
static |
|
static |
BOOL lre_is_space | ( | int | c | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
int lre_parse_escape | ( | const uint8_t ** | pp, |
int | allow_utf16 | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
uint8_t* lre_compile | ( | int * | plen, |
char * | error_msg, | ||
int | error_msg_size, | ||
const char * | buf, | ||
size_t | buf_len, | ||
int | re_flags, | ||
void * | opaque | ||
) |
|
static |
|
static |
int lre_exec | ( | uint8_t ** | capture, |
const uint8_t * | bc_buf, | ||
const uint8_t * | cbuf, | ||
int | cindex, | ||
int | clen, | ||
int | cbuf_type, | ||
void * | opaque | ||
) |
int lre_get_capture_count | ( | const uint8_t * | bc_buf | ) |
int lre_get_flags | ( | const uint8_t * | bc_buf | ) |
const char* lre_get_groupnames | ( | const uint8_t * | bc_buf | ) |
|
static |
|
static |
|
static |
uint32_t const lre_id_start_table_ascii[4] |
uint32_t const lre_id_continue_table_ascii[4] |
|
static |
|
static |