Code::Blocks
SVN r11506
|
#include <squirrel.h>
#include <string.h>
#include <ctype.h>
#include <setjmp.h>
#include "sqstdstring.h"
Go to the source code of this file.
Classes | |
struct | tagSQRexNode |
struct | SQRex |
Macros | |
#define | scisprint isprint |
#define | OP_GREEDY (MAX_CHAR+1) |
#define | OP_OR (MAX_CHAR+2) |
#define | OP_EXPR (MAX_CHAR+3) |
#define | OP_NOCAPEXPR (MAX_CHAR+4) |
#define | OP_DOT (MAX_CHAR+5) |
#define | OP_CLASS (MAX_CHAR+6) |
#define | OP_CCLASS (MAX_CHAR+7) |
#define | OP_NCLASS (MAX_CHAR+8) |
#define | OP_RANGE (MAX_CHAR+9) |
#define | OP_CHAR (MAX_CHAR+10) |
#define | OP_EOL (MAX_CHAR+11) |
#define | OP_BOL (MAX_CHAR+12) |
#define | OP_WB (MAX_CHAR+13) |
#define | SQREX_SYMBOL_ANY_CHAR ('.') |
#define | SQREX_SYMBOL_GREEDY_ONE_OR_MORE ('+') |
#define | SQREX_SYMBOL_GREEDY_ZERO_OR_MORE ('*') |
#define | SQREX_SYMBOL_GREEDY_ZERO_OR_ONE ('?') |
#define | SQREX_SYMBOL_BRANCH ('|') |
#define | SQREX_SYMBOL_END_OF_STRING ('$') |
#define | SQREX_SYMBOL_BEGINNING_OF_STRING ('^') |
#define | SQREX_SYMBOL_ESCAPE_CHAR ('\\') |
Typedefs | |
typedef int | SQRexNodeType |
typedef struct tagSQRexNode | SQRexNode |
Functions | |
static SQInteger | sqstd_rex_list (SQRex *exp) |
static SQInteger | sqstd_rex_newnode (SQRex *exp, SQRexNodeType type) |
static void | sqstd_rex_error (SQRex *exp, const SQChar *error) |
static void | sqstd_rex_expect (SQRex *exp, SQInteger n) |
static SQChar | sqstd_rex_escapechar (SQRex *exp) |
static SQInteger | sqstd_rex_charclass (SQRex *exp, SQInteger classid) |
static SQInteger | sqstd_rex_charnode (SQRex *exp, SQBool isclass) |
static SQInteger | sqstd_rex_class (SQRex *exp) |
static SQInteger | sqstd_rex_parsenumber (SQRex *exp) |
static SQInteger | sqstd_rex_element (SQRex *exp) |
static SQBool | sqstd_rex_matchcclass (SQInteger cclass, SQChar c) |
static SQBool | sqstd_rex_matchclass (SQRex *exp, SQRexNode *node, SQChar c) |
static const SQChar * | sqstd_rex_matchnode (SQRex *exp, SQRexNode *node, const SQChar *str, SQRexNode *next) |
SQRex * | sqstd_rex_compile (const SQChar *pattern, const SQChar **error) |
void | sqstd_rex_free (SQRex *exp) |
SQBool | sqstd_rex_match (SQRex *exp, const SQChar *text) |
SQBool | sqstd_rex_searchrange (SQRex *exp, const SQChar *text_begin, const SQChar *text_end, const SQChar **out_begin, const SQChar **out_end) |
SQBool | sqstd_rex_search (SQRex *exp, const SQChar *text, const SQChar **out_begin, const SQChar **out_end) |
SQInteger | sqstd_rex_getsubexpcount (SQRex *exp) |
SQBool | sqstd_rex_getsubexp (SQRex *exp, SQInteger n, SQRexMatch *subexp) |
struct tagSQRexNode |
Definition at line 54 of file sqstdrex.cpp.
Class Members | ||
---|---|---|
SQInteger | left | |
SQInteger | next | |
SQInteger | right | |
SQRexNodeType | type |
struct SQRex |
Definition at line 61 of file sqstdrex.cpp.
Class Members | ||
---|---|---|
const SQChar * | _bol | |
SQInteger | _currsubexp | |
const SQChar * | _eol | |
const SQChar ** | _error | |
SQInteger | _first | |
void * | _jmpbuf | |
SQRexMatch * | _matches | |
SQInteger | _nallocated | |
SQRexNode * | _nodes | |
SQInteger | _nsize | |
SQInteger | _nsubexpr | |
SQInteger | _op | |
const SQChar * | _p |
#define OP_BOL (MAX_CHAR+12) |
Definition at line 39 of file sqstdrex.cpp.
Referenced by sqstd_rex_list(), and sqstd_rex_matchnode().
#define OP_CCLASS (MAX_CHAR+7) |
Definition at line 34 of file sqstdrex.cpp.
Referenced by sqstd_rex_charclass(), sqstd_rex_class(), sqstd_rex_matchclass(), and sqstd_rex_matchnode().
#define OP_CHAR (MAX_CHAR+10) |
Definition at line 37 of file sqstdrex.cpp.
#define OP_CLASS (MAX_CHAR+6) |
Definition at line 33 of file sqstdrex.cpp.
Referenced by sqstd_rex_class(), and sqstd_rex_matchnode().
#define OP_DOT (MAX_CHAR+5) |
Definition at line 32 of file sqstdrex.cpp.
Referenced by sqstd_rex_element(), and sqstd_rex_matchnode().
#define OP_EOL (MAX_CHAR+11) |
Definition at line 38 of file sqstdrex.cpp.
Referenced by sqstd_rex_element(), and sqstd_rex_matchnode().
#define OP_EXPR (MAX_CHAR+3) |
Definition at line 30 of file sqstdrex.cpp.
Referenced by sqstd_rex_compile(), sqstd_rex_element(), sqstd_rex_matchnode(), and sqstd_rex_newnode().
#define OP_GREEDY (MAX_CHAR+1) |
Definition at line 28 of file sqstdrex.cpp.
Referenced by sqstd_rex_element(), and sqstd_rex_matchnode().
#define OP_NCLASS (MAX_CHAR+8) |
Definition at line 35 of file sqstdrex.cpp.
Referenced by sqstd_rex_class(), and sqstd_rex_matchnode().
#define OP_NOCAPEXPR (MAX_CHAR+4) |
Definition at line 31 of file sqstdrex.cpp.
Referenced by sqstd_rex_element(), and sqstd_rex_matchnode().
#define OP_OR (MAX_CHAR+2) |
Definition at line 29 of file sqstdrex.cpp.
Referenced by sqstd_rex_list(), and sqstd_rex_matchnode().
#define OP_RANGE (MAX_CHAR+9) |
Definition at line 36 of file sqstdrex.cpp.
Referenced by sqstd_rex_class(), and sqstd_rex_matchclass().
#define OP_WB (MAX_CHAR+13) |
Definition at line 40 of file sqstdrex.cpp.
Referenced by sqstd_rex_charnode(), and sqstd_rex_matchnode().
#define scisprint isprint |
Definition at line 12 of file sqstdrex.cpp.
Referenced by sqstd_rex_charnode(), and sqstd_rex_escapechar().
#define SQREX_SYMBOL_ANY_CHAR ('.') |
Definition at line 42 of file sqstdrex.cpp.
Referenced by sqstd_rex_element().
#define SQREX_SYMBOL_BEGINNING_OF_STRING ('^') |
Definition at line 48 of file sqstdrex.cpp.
Referenced by sqstd_rex_class(), and sqstd_rex_list().
#define SQREX_SYMBOL_BRANCH ('|') |
Definition at line 46 of file sqstdrex.cpp.
Referenced by sqstd_rex_element(), and sqstd_rex_list().
#define SQREX_SYMBOL_END_OF_STRING ('$') |
Definition at line 47 of file sqstdrex.cpp.
Referenced by sqstd_rex_element().
#define SQREX_SYMBOL_ESCAPE_CHAR ('\\') |
Definition at line 49 of file sqstdrex.cpp.
Referenced by sqstd_rex_charnode(), and sqstd_rex_escapechar().
#define SQREX_SYMBOL_GREEDY_ONE_OR_MORE ('+') |
Definition at line 43 of file sqstdrex.cpp.
Referenced by sqstd_rex_element().
#define SQREX_SYMBOL_GREEDY_ZERO_OR_MORE ('*') |
Definition at line 44 of file sqstdrex.cpp.
Referenced by sqstd_rex_element().
#define SQREX_SYMBOL_GREEDY_ZERO_OR_ONE ('?') |
Definition at line 45 of file sqstdrex.cpp.
Referenced by sqstd_rex_element().
typedef struct tagSQRexNode SQRexNode |
typedef int SQRexNodeType |
Definition at line 52 of file sqstdrex.cpp.
|
static |
Definition at line 124 of file sqstdrex.cpp.
References SQRex::_nodes, tagSQRexNode::left, OP_CCLASS, and sqstd_rex_newnode().
Referenced by sqstd_rex_charnode().
|
static |
Definition at line 131 of file sqstdrex.cpp.
References SQRex::_nodes, SQRex::_p, tagSQRexNode::left, OP_WB, scisprint, SQREX_SYMBOL_ESCAPE_CHAR, sqstd_rex_charclass(), sqstd_rex_error(), and sqstd_rex_newnode().
Referenced by sqstd_rex_class(), and sqstd_rex_element().
|
static |
Definition at line 169 of file sqstdrex.cpp.
References SQRex::_eol, SQRex::_nodes, SQRex::_p, tagSQRexNode::left, tagSQRexNode::next, OP_CCLASS, OP_CLASS, OP_NCLASS, OP_RANGE, tagSQRexNode::right, SQREX_SYMBOL_BEGINNING_OF_STRING, sqstd_rex_charnode(), sqstd_rex_error(), sqstd_rex_escapechar(), sqstd_rex_newnode(), and tagSQRexNode::type.
Referenced by sqstd_rex_element().
Definition at line 533 of file sqstdrex.cpp.
References SQRex::_bol, SQRex::_eol, SQRex::_error, SQRex::_first, SQRex::_jmpbuf, SQRex::_matches, SQRex::_nallocated, SQRex::_nodes, SQRex::_nsize, SQRex::_nsubexpr, SQRex::_p, tagSQRexNode::left, tagSQRexNode::next, NULL, OP_EXPR, tagSQRexNode::right, sq_malloc(), sqstd_rex_error(), sqstd_rex_free(), sqstd_rex_list(), sqstd_rex_newnode(), and tagSQRexNode::type.
Referenced by _regexp_constructor().
|
static |
Definition at line 231 of file sqstdrex.cpp.
References SQRex::_nodes, SQRex::_p, tagSQRexNode::left, tagSQRexNode::next, OP_DOT, OP_EOL, OP_EXPR, OP_GREEDY, OP_NOCAPEXPR, tagSQRexNode::right, SQREX_SYMBOL_ANY_CHAR, SQREX_SYMBOL_BRANCH, SQREX_SYMBOL_END_OF_STRING, SQREX_SYMBOL_GREEDY_ONE_OR_MORE, SQREX_SYMBOL_GREEDY_ZERO_OR_MORE, SQREX_SYMBOL_GREEDY_ZERO_OR_ONE, sqstd_rex_charnode(), sqstd_rex_class(), sqstd_rex_error(), sqstd_rex_expect(), sqstd_rex_list(), sqstd_rex_newnode(), and sqstd_rex_parsenumber().
Referenced by sqstd_rex_list().
Definition at line 96 of file sqstdrex.cpp.
References SQRex::_error, and SQRex::_jmpbuf.
Referenced by sqstd_rex_charnode(), sqstd_rex_class(), sqstd_rex_compile(), sqstd_rex_element(), sqstd_rex_escapechar(), sqstd_rex_expect(), and sqstd_rex_parsenumber().
Definition at line 108 of file sqstdrex.cpp.
References SQRex::_p, scisprint, SQREX_SYMBOL_ESCAPE_CHAR, and sqstd_rex_error().
Referenced by sqstd_rex_class().
|
static |
Definition at line 102 of file sqstdrex.cpp.
References SQRex::_p, and sqstd_rex_error().
Referenced by sqstd_rex_element().
void sqstd_rex_free | ( | SQRex * | exp | ) |
Definition at line 578 of file sqstdrex.cpp.
References SQRex::_jmpbuf, SQRex::_matches, SQRex::_nallocated, SQRex::_nodes, SQRex::_nsubexpr, and sq_free().
Referenced by _rexobj_releasehook(), and sqstd_rex_compile().
SQBool sqstd_rex_getsubexp | ( | SQRex * | exp, |
SQInteger | n, | ||
SQRexMatch * | subexp | ||
) |
Definition at line 640 of file sqstdrex.cpp.
References SQRex::_matches, and SQRex::_nsubexpr.
Referenced by _regexp_capture().
SQInteger sqstd_rex_getsubexpcount | ( | SQRex * | exp | ) |
Definition at line 635 of file sqstdrex.cpp.
References SQRex::_nsubexpr.
Referenced by _regexp_capture(), and _regexp_subexpcount().
|
static |
Definition at line 317 of file sqstdrex.cpp.
References SQRex::_nodes, SQRex::_p, tagSQRexNode::left, tagSQRexNode::next, OP_BOL, OP_OR, tagSQRexNode::right, SQREX_SYMBOL_BEGINNING_OF_STRING, SQREX_SYMBOL_BRANCH, sqstd_rex_element(), and sqstd_rex_newnode().
Referenced by sqstd_rex_compile(), and sqstd_rex_element().
Definition at line 588 of file sqstdrex.cpp.
References SQRex::_bol, SQRex::_currsubexp, SQRex::_eol, SQRex::_nodes, NULL, and sqstd_rex_matchnode().
Referenced by _regexp_match().
|
static |
Definition at line 342 of file sqstdrex.cpp.
Referenced by sqstd_rex_matchclass(), and sqstd_rex_matchnode().
Definition at line 365 of file sqstdrex.cpp.
References SQRex::_nodes, tagSQRexNode::left, tagSQRexNode::next, OP_CCLASS, OP_RANGE, tagSQRexNode::right, sqstd_rex_matchcclass(), and tagSQRexNode::type.
Referenced by sqstd_rex_matchnode().
|
static |
Definition at line 382 of file sqstdrex.cpp.
References SQRex::_bol, SQRex::_currsubexp, SQRex::_eol, SQRex::_matches, SQRex::_nodes, capture, tagSQRexNode::left, tagSQRexNode::next, NULL, OP_BOL, OP_CCLASS, OP_CLASS, OP_DOT, OP_EOL, OP_EXPR, OP_GREEDY, OP_NCLASS, OP_NOCAPEXPR, OP_OR, OP_WB, tagSQRexNode::right, sqstd_rex_matchcclass(), sqstd_rex_matchclass(), and tagSQRexNode::type.
Referenced by sqstd_rex_match(), and sqstd_rex_searchrange().
|
static |
Definition at line 79 of file sqstdrex.cpp.
References SQRex::_nallocated, SQRex::_nodes, SQRex::_nsize, SQRex::_nsubexpr, tagSQRexNode::left, tagSQRexNode::next, OP_EXPR, tagSQRexNode::right, sq_realloc(), and tagSQRexNode::type.
Referenced by sqstd_rex_charclass(), sqstd_rex_charnode(), sqstd_rex_class(), sqstd_rex_compile(), sqstd_rex_element(), and sqstd_rex_list().
|
static |
Definition at line 218 of file sqstdrex.cpp.
References SQRex::_p, and sqstd_rex_error().
Referenced by sqstd_rex_element().
SQBool sqstd_rex_search | ( | SQRex * | exp, |
const SQChar * | text, | ||
const SQChar ** | out_begin, | ||
const SQChar ** | out_end | ||
) |
Definition at line 630 of file sqstdrex.cpp.
References sqstd_rex_searchrange().
Referenced by _regexp_capture(), and _regexp_search().
SQBool sqstd_rex_searchrange | ( | SQRex * | exp, |
const SQChar * | text_begin, | ||
const SQChar * | text_end, | ||
const SQChar ** | out_begin, | ||
const SQChar ** | out_end | ||
) |
Definition at line 600 of file sqstdrex.cpp.
References SQRex::_bol, SQRex::_currsubexp, SQRex::_eol, SQRex::_first, SQRex::_nodes, tagSQRexNode::next, NULL, and sqstd_rex_matchnode().
Referenced by sqstd_rex_search().