Ruby
2.1.10p492(2016-04-01revision54464)
|
Go to the source code of this file.
Data Structures | |
struct | strscanner |
Macros | |
#define | STRSCAN_VERSION "0.7.0" |
#define | FLAG_MATCHED (1 << 0) |
#define | MATCHED_P(s) ((s)->flags & FLAG_MATCHED) |
#define | MATCHED(s) (s)->flags |= FLAG_MATCHED |
#define | CLEAR_MATCH_STATUS(s) (s)->flags &= ~FLAG_MATCHED |
#define | S_PBEG(s) (RSTRING_PTR((s)->str)) |
#define | S_LEN(s) (RSTRING_LEN((s)->str)) |
#define | S_PEND(s) (S_PBEG(s) + S_LEN(s)) |
#define | CURPTR(s) (S_PBEG(s) + (s)->curr) |
#define | S_RESTLEN(s) (S_LEN(s) - (s)->curr) |
#define | EOS_P(s) ((s)->curr >= RSTRING_LEN(p->str)) |
#define | GET_SCANNER(obj, var) |
#define | INSPECT_LENGTH 5 |
#define | BUFSIZE 256 |
Variables | |
static VALUE | StringScanner |
static VALUE | ScanError |
static ID | id_byteslice |
static const rb_data_type_t | strscanner_type |
#define CLEAR_MATCH_STATUS | ( | s | ) | (s)->flags &= ~FLAG_MATCHED |
Definition at line 48 of file strscan.c.
Referenced by strscan_do_scan(), strscan_get_byte(), strscan_getch(), strscan_reset(), strscan_s_allocate(), strscan_set_string(), strscan_terminate(), and strscan_unscan().
#define CURPTR | ( | s | ) | (S_PBEG(s) + (s)->curr) |
Definition at line 53 of file strscan.c.
Referenced by inspect1(), inspect2(), strscan_bol_p(), strscan_do_scan(), and strscan_getch().
#define EOS_P | ( | s | ) | ((s)->curr >= RSTRING_LEN(p->str)) |
Definition at line 56 of file strscan.c.
Referenced by inspect2(), strscan_eos_p(), strscan_get_byte(), strscan_getch(), strscan_inspect(), strscan_peek(), strscan_rest(), strscan_rest_p(), and strscan_rest_size().
#define GET_SCANNER | ( | obj, | |
var | |||
) |
Definition at line 58 of file strscan.c.
Referenced by strscan_aref(), strscan_bol_p(), strscan_concat(), strscan_do_scan(), strscan_eos_p(), strscan_get_byte(), strscan_get_charpos(), strscan_get_pos(), strscan_get_string(), strscan_getch(), strscan_matched(), strscan_matched_p(), strscan_matched_size(), strscan_peek(), strscan_post_match(), strscan_pre_match(), strscan_reset(), strscan_rest(), strscan_rest_p(), strscan_rest_size(), strscan_set_pos(), strscan_terminate(), and strscan_unscan().
#define INSPECT_LENGTH 5 |
Definition at line 1140 of file strscan.c.
Referenced by inspect1(), and inspect2().
#define MATCHED | ( | s | ) | (s)->flags |= FLAG_MATCHED |
Definition at line 47 of file strscan.c.
Referenced by strscan_do_scan(), strscan_get_byte(), and strscan_getch().
#define MATCHED_P | ( | s | ) | ((s)->flags & FLAG_MATCHED) |
Definition at line 46 of file strscan.c.
Referenced by strscan_aref(), strscan_matched(), strscan_matched_p(), strscan_matched_size(), strscan_post_match(), strscan_pre_match(), and strscan_unscan().
#define S_LEN | ( | s | ) | (RSTRING_LEN((s)->str)) |
Definition at line 51 of file strscan.c.
Referenced by extract_beg_len(), extract_range(), inspect2(), strscan_getch(), strscan_inspect(), strscan_peek(), strscan_post_match(), strscan_rest(), strscan_rest_size(), strscan_set_pos(), and strscan_terminate().
#define S_PBEG | ( | s | ) | (RSTRING_PTR((s)->str)) |
Definition at line 50 of file strscan.c.
Referenced by extract_beg_len(), and extract_range().
Definition at line 52 of file strscan.c.
Referenced by strscan_bol_p(), and strscan_getch().
#define S_RESTLEN | ( | s | ) | (S_LEN(s) - (s)->curr) |
Definition at line 54 of file strscan.c.
Referenced by strscan_do_scan().
#define STRSCAN_VERSION "0.7.0" |
Definition at line 16 of file strscan.c.
Referenced by Init_strscan().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 702 of file strscan.c.
References strscanner::curr, onig_region_clear(), onig_region_set(), strscanner::prev, and strscanner::regs.
Referenced by strscan_get_byte(), and strscan_getch().
|
static |
Definition at line 231 of file strscan.c.
References rb_check_typeddata(), and strscanner_type.
Referenced by strscan_init_copy(), strscan_initialize(), strscan_inspect(), and strscan_set_string().
|
static |
Definition at line 153 of file strscan.c.
References infect(), Qnil, S_LEN, S_PBEG, and str_new().
Referenced by strscan_do_scan(), and strscan_peek().
|
static |
Definition at line 144 of file strscan.c.
References infect(), Qnil, S_LEN, S_PBEG, and str_new().
Referenced by strscan_aref(), strscan_get_byte(), strscan_getch(), strscan_matched(), strscan_post_match(), strscan_pre_match(), and strscan_rest().
|
static |
Definition at line 129 of file strscan.c.
References OBJ_INFECT, and strscanner::str.
Referenced by extract_beg_len(), extract_range(), strscan_inspect(), strscan_peek(), and strscan_rest().
void Init_strscan | ( | ) |
Definition at line 1331 of file strscan.c.
References id_byteslice, rb_alias(), rb_cObject, rb_const_defined(), rb_const_set(), rb_define_alloc_func(), rb_define_class(), rb_define_class_under(), rb_define_method(), rb_define_private_method(), rb_define_singleton_method(), rb_eStandardError, rb_intern, rb_obj_freeze(), rb_str_new2, ScanError, StringScanner, strscan_aref(), strscan_bol_p(), strscan_check(), strscan_check_until(), strscan_clear(), strscan_concat(), strscan_empty_p(), strscan_eos_p(), strscan_exist_p(), strscan_get_byte(), strscan_get_charpos(), strscan_get_pos(), strscan_get_string(), strscan_getbyte(), strscan_getch(), strscan_init_copy(), strscan_initialize(), strscan_inspect(), strscan_match_p(), strscan_matched(), strscan_matched_p(), strscan_matched_size(), strscan_peek(), strscan_peep(), strscan_post_match(), strscan_pre_match(), strscan_reset(), strscan_rest(), strscan_rest_p(), strscan_rest_size(), strscan_restsize(), strscan_s_allocate(), strscan_s_mustc(), strscan_scan(), strscan_scan_full(), strscan_scan_until(), strscan_search_full(), strscan_set_pos(), strscan_set_string(), strscan_skip(), strscan_skip_until(), strscan_terminate(), strscan_unscan(), and STRSCAN_VERSION.
|
static |
Definition at line 1187 of file strscan.c.
References CURPTR, strscanner::curr, INSPECT_LENGTH, rb_str_cat(), rb_str_dump(), rb_str_new(), rb_str_new2, rb_str_new_cstr(), and strscanner::str.
Referenced by strscan_inspect().
|
static |
Definition at line 1206 of file strscan.c.
References CURPTR, strscanner::curr, EOS_P, INSPECT_LENGTH, rb_str_cat2(), rb_str_dump(), rb_str_new(), rb_str_new2, S_LEN, and strscanner::str.
Referenced by strscan_inspect().
|
static |
Definition at line 980 of file strscan.c.
References name, onig_name_to_backref_number(), rb_eIndexError, rb_raise(), rb_str_new(), strscanner::regs, RREGEXP, StringValuePtr, and UNREACHABLE.
Referenced by strscan_aref().
|
static |
Definition at line 136 of file strscan.c.
References rb_enc_copy(), rb_str_new(), and strscanner::str.
Referenced by extract_beg_len(), extract_range(), strscan_peek(), and strscan_rest().
Definition at line 1025 of file strscan.c.
References re_registers::beg, re_registers::end, extract_range(), GET_SCANNER, MATCHED_P, name, name_to_backref_number(), NUM2LONG, re_registers::num_regs, strscanner::prev, Qnil, rb_id2name(), strscanner::regex, strscanner::regs, StringValuePtr, strlen(), SYM2ID, T_STRING, T_SYMBOL, and TYPE.
Referenced by Init_strscan().
Definition at line 866 of file strscan.c.
References CURPTR, strscanner::curr, GET_SCANNER, Qfalse, Qnil, Qtrue, and S_PEND.
Referenced by Init_strscan().
Definition at line 587 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
Definition at line 681 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
Definition at line 313 of file strscan.c.
References rb_warning(), and strscan_terminate().
Referenced by Init_strscan().
Definition at line 364 of file strscan.c.
References GET_SCANNER, rb_str_append(), strscanner::str, and StringValue.
Referenced by Init_strscan().
|
static |
Definition at line 448 of file strscan.c.
References Check_Type, CLEAR_MATCH_STATUS, CURPTR, strscanner::curr, re_registers::end, extract_beg_len(), GET_SCANNER, INT2FIX, MATCHED, onig_free(), onig_match(), ONIG_OPTION_NONE, onig_search(), strscanner::prev, Qnil, rb_raise(), rb_reg_prepare_re(), strscanner::regex, strscanner::regs, RREGEXP, S_RESTLEN, ScanError, strscanner::str, T_REGEXP, and UChar.
Referenced by strscan_check(), strscan_check_until(), strscan_exist_p(), strscan_match_p(), strscan_scan(), strscan_scan_full(), strscan_scan_until(), strscan_search_full(), strscan_skip(), and strscan_skip_until().
Definition at line 900 of file strscan.c.
References rb_warning(), and strscan_eos_p().
Referenced by Init_strscan().
Definition at line 887 of file strscan.c.
References EOS_P, GET_SCANNER, Qfalse, and Qtrue.
Referenced by Init_strscan(), and strscan_empty_p().
Definition at line 640 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
|
static |
Definition at line 173 of file strscan.c.
References onig_region_free(), strscanner::regs, and ruby_xfree().
Definition at line 762 of file strscan.c.
References adjust_registers_to_matched(), re_registers::beg, CLEAR_MATCH_STATUS, strscanner::curr, re_registers::end, EOS_P, extract_range(), GET_SCANNER, MATCHED, strscanner::prev, Qnil, and strscanner::regs.
Referenced by Init_strscan(), and strscan_getbyte().
Definition at line 411 of file strscan.c.
References strscanner::curr, GET_SCANNER, id_byteslice, INT2FIX, INT2NUM, rb_funcall(), rb_str_length(), and strscanner::str.
Referenced by Init_strscan().
Definition at line 389 of file strscan.c.
References strscanner::curr, GET_SCANNER, and INT2FIX.
Referenced by Init_strscan().
Definition at line 323 of file strscan.c.
References GET_SCANNER, and strscanner::str.
Referenced by Init_strscan().
Definition at line 784 of file strscan.c.
References rb_warning(), and strscan_get_byte().
Referenced by Init_strscan().
Definition at line 723 of file strscan.c.
References adjust_registers_to_matched(), re_registers::beg, CLEAR_MATCH_STATUS, CURPTR, strscanner::curr, re_registers::end, EOS_P, extract_range(), GET_SCANNER, MATCHED, strscanner::prev, Qnil, rb_enc_get(), rb_enc_mbclen(), strscanner::regs, S_LEN, S_PEND, and strscanner::str.
Referenced by Init_strscan().
Definition at line 244 of file strscan.c.
References check_strscan(), strscanner::curr, strscanner::flags, onig_region_copy(), strscanner::prev, strscanner::regs, and strscanner::str.
Referenced by Init_strscan().
Definition at line 217 of file strscan.c.
References argc, argv, check_strscan(), rb_scan_args(), strscanner::str, and StringValue.
Referenced by Init_strscan().
Definition at line 1155 of file strscan.c.
References check_strscan(), strscanner::curr, EOS_P, infect(), inspect1(), inspect2(), NIL_P, PRIsVALUE, rb_obj_class(), rb_sprintf(), S_LEN, and strscanner::str.
Referenced by Init_strscan().
|
static |
Definition at line 166 of file strscan.c.
References rb_gc_mark(), and strscanner::str.
Definition at line 543 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
Definition at line 949 of file strscan.c.
References re_registers::beg, re_registers::end, extract_range(), GET_SCANNER, MATCHED_P, strscanner::prev, Qnil, and strscanner::regs.
Referenced by Init_strscan().
Definition at line 933 of file strscan.c.
References GET_SCANNER, MATCHED_P, Qfalse, and Qtrue.
Referenced by Init_strscan().
Definition at line 970 of file strscan.c.
References re_registers::beg, re_registers::end, GET_SCANNER, INT2NUM, MATCHED_P, Qnil, and strscanner::regs.
Referenced by Init_strscan().
|
static |
Definition at line 181 of file strscan.c.
References onig_region_memsize(), strscanner::regs, and size.
Definition at line 802 of file strscan.c.
References strscanner::curr, EOS_P, extract_beg_len(), GET_SCANNER, infect(), NUM2LONG, S_LEN, and str_new().
Referenced by Init_strscan(), and strscan_peep().
Definition at line 823 of file strscan.c.
References rb_warning(), and strscan_peek().
Referenced by Init_strscan().
Definition at line 1087 of file strscan.c.
References re_registers::end, extract_range(), GET_SCANNER, MATCHED_P, strscanner::prev, Qnil, strscanner::regs, and S_LEN.
Referenced by Init_strscan().
Definition at line 1068 of file strscan.c.
References re_registers::beg, extract_range(), GET_SCANNER, MATCHED_P, strscanner::prev, Qnil, and strscanner::regs.
Referenced by Init_strscan().
Definition at line 280 of file strscan.c.
References CLEAR_MATCH_STATUS, strscanner::curr, and GET_SCANNER.
Referenced by Init_strscan().
Definition at line 1101 of file strscan.c.
References strscanner::curr, EOS_P, extract_range(), GET_SCANNER, infect(), S_LEN, and str_new().
Referenced by Init_strscan().
Definition at line 915 of file strscan.c.
References EOS_P, GET_SCANNER, Qfalse, and Qtrue.
Referenced by Init_strscan().
Definition at line 1116 of file strscan.c.
References strscanner::curr, EOS_P, GET_SCANNER, INT2FIX, and S_LEN.
Referenced by Init_strscan(), and strscan_restsize().
Definition at line 1134 of file strscan.c.
References rb_warning(), and strscan_rest_size().
Referenced by Init_strscan().
Definition at line 198 of file strscan.c.
References ALLOC, CLEAR_MATCH_STATUS, MEMZERO, onig_region_init(), Qnil, strscanner::regs, strscanner::str, strscanner_type, and TypedData_Wrap_Struct.
Referenced by Init_strscan().
Definition at line 271 of file strscan.c.
Referenced by Init_strscan().
Definition at line 526 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
Definition at line 603 of file strscan.c.
References f, RTEST, and strscan_do_scan().
Referenced by Init_strscan().
Definition at line 621 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
Definition at line 696 of file strscan.c.
References f, RTEST, and strscan_do_scan().
Referenced by Init_strscan().
Definition at line 433 of file strscan.c.
References strscanner::curr, GET_SCANNER, INT2NUM, NUM2INT, rb_eRangeError, rb_raise(), and S_LEN.
Referenced by Init_strscan().
Definition at line 338 of file strscan.c.
References check_strscan(), CLEAR_MATCH_STATUS, strscanner::curr, strscanner::str, and StringValue.
Referenced by Init_strscan().
Definition at line 566 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
Definition at line 662 of file strscan.c.
References strscan_do_scan().
Referenced by Init_strscan().
Definition at line 298 of file strscan.c.
References CLEAR_MATCH_STATUS, strscanner::curr, GET_SCANNER, and S_LEN.
Referenced by Init_strscan(), and strscan_clear().
Definition at line 841 of file strscan.c.
References CLEAR_MATCH_STATUS, strscanner::curr, GET_SCANNER, MATCHED_P, strscanner::prev, rb_raise(), and ScanError.
Referenced by Init_strscan().
|
static |
Definition at line 24 of file strscan.c.
Referenced by Init_strscan(), and strscan_get_charpos().
|
static |
Definition at line 23 of file strscan.c.
Referenced by Init_strscan(), strscan_do_scan(), and strscan_unscan().
|
static |
Definition at line 22 of file strscan.c.
Referenced by Init_strscan().
|
static |
Definition at line 191 of file strscan.c.
Referenced by check_strscan(), and strscan_s_allocate().