src/rx.c - Supporting file for the regular expression engine


rx.c and rx.h set up functions to be used by the regular expression engine. They also define internal helper functions that add a layer of abstraction to the rx_is_X family of functions. Please also see rx.ops,, rxstacks.c, and rxstacks.h.

rxinfo is the main structure involved in regular expressions; it's stuffed into a Handle PMC and passed to all regular expression opcodes.

Functions ^

INTVAL rx_is_word_character(Interp *interpreter, INTVAL ch)

Checks to see if supplied char is a word character. It uses the constant RX_WORDCHARS to create a bitmap. Please see docs/dev/ for a detailed explanation of bitmap.

INTVAL rx_is_number_character(Interp *interpreter, INTVAL ch)

Checks to see if supplied character is a number character. This function breaks abstraction to gain speed. It's just a speed hack for now, it will change when it needs to be changed (for different language support/character encoding).

INTVAL rx_is_whitespace_character(Interp *interpreter, INTVAL ch)

Checks to see if supplied character is a whitespace character.

INTVAL rx_is_newline(Interp *interpreter, INTVAL ch)

Checks to see if supplied character is a newline.

Bitmap bitmap_make(Interp *interpreter, STRING *str)

Creates a bitmap from supplied string. Please see docs/dev/ for more information on bitmaps.

Bitmap bitmap_make_cstr(Interp *interpreter, const char *str)

Same as bitmap_make(), except passed a const char* arg.

void bitmap_add(Interp *interpreter, Bitmap bmp, INTVAL ch)

Appends supplied character to supplied bitmap.

INTVAL bitmap_match(Bitmap bmp, INTVAL ch)

Checks if supplied character is in supplied bitmap.

void bitmap_destroy(Bitmap bmp)

Frees up memory the bitmap allocated.


include/parrot/rx.h, src/rxstacks.c, include/parrot/rxstacks.h, docs/dev/