Lines Matching refs:tok

2269 fetch_range_quantifier(UChar** src, UChar* end, OnigToken* tok, ScanEnv* env)  in fetch_range_quantifier()  argument
2345 tok->type = TK_INTERVAL; in fetch_range_quantifier()
2346 tok->u.repeat.lower = low; in fetch_range_quantifier()
2347 tok->u.repeat.upper = up; in fetch_range_quantifier()
2432 static int fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env);
2866 fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) in fetch_token_in_cc() argument
2877 tok->type = TK_EOT; in fetch_token_in_cc()
2878 return tok->type; in fetch_token_in_cc()
2882 tok->type = TK_CHAR; in fetch_token_in_cc()
2883 tok->base = 0; in fetch_token_in_cc()
2884 tok->u.c = c; in fetch_token_in_cc()
2885 tok->escaped = 0; in fetch_token_in_cc()
2888 tok->type = TK_CC_CLOSE; in fetch_token_in_cc()
2891 tok->type = TK_CC_RANGE; in fetch_token_in_cc()
2900 tok->escaped = 1; in fetch_token_in_cc()
2901 tok->u.c = c; in fetch_token_in_cc()
2904 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2905 tok->u.prop.ctype = ONIGENC_CTYPE_WORD; in fetch_token_in_cc()
2906 tok->u.prop.not = 0; in fetch_token_in_cc()
2909 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2910 tok->u.prop.ctype = ONIGENC_CTYPE_WORD; in fetch_token_in_cc()
2911 tok->u.prop.not = 1; in fetch_token_in_cc()
2914 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2915 tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; in fetch_token_in_cc()
2916 tok->u.prop.not = 0; in fetch_token_in_cc()
2919 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2920 tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; in fetch_token_in_cc()
2921 tok->u.prop.not = 1; in fetch_token_in_cc()
2924 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2925 tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; in fetch_token_in_cc()
2926 tok->u.prop.not = 0; in fetch_token_in_cc()
2929 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2930 tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; in fetch_token_in_cc()
2931 tok->u.prop.not = 1; in fetch_token_in_cc()
2935 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2936 tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; in fetch_token_in_cc()
2937 tok->u.prop.not = 0; in fetch_token_in_cc()
2941 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2942 tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; in fetch_token_in_cc()
2943 tok->u.prop.not = 1; in fetch_token_in_cc()
2954 tok->type = TK_CHAR_PROPERTY; in fetch_token_in_cc()
2955 tok->u.prop.not = (c == 'P' ? 1 : 0); in fetch_token_in_cc()
2960 tok->u.prop.not = (tok->u.prop.not == 0 ? 1 : 0); in fetch_token_in_cc()
2984 tok->type = TK_CODE_POINT; in fetch_token_in_cc()
2985 tok->base = 8; in fetch_token_in_cc()
2986 tok->u.code = (OnigCodePoint )num; in fetch_token_in_cc()
3011 tok->type = TK_CODE_POINT; in fetch_token_in_cc()
3012 tok->base = 16; in fetch_token_in_cc()
3013 tok->u.code = (OnigCodePoint )num; in fetch_token_in_cc()
3026 tok->type = TK_RAW_BYTE; in fetch_token_in_cc()
3027 tok->base = 16; in fetch_token_in_cc()
3028 tok->u.c = num; in fetch_token_in_cc()
3042 tok->type = TK_CODE_POINT; in fetch_token_in_cc()
3043 tok->base = 16; in fetch_token_in_cc()
3044 tok->u.code = (OnigCodePoint )num; in fetch_token_in_cc()
3058 tok->type = TK_RAW_BYTE; in fetch_token_in_cc()
3059 tok->base = 8; in fetch_token_in_cc()
3060 tok->u.c = num; in fetch_token_in_cc()
3068 if (tok->u.c != c2) { in fetch_token_in_cc()
3069 tok->u.code = c2; in fetch_token_in_cc()
3070 tok->type = TK_CODE_POINT; in fetch_token_in_cc()
3078 tok->backp = p; /* point at '[' is read */ in fetch_token_in_cc()
3082 tok->type = TK_POSIX_BRACKET_OPEN; in fetch_token_in_cc()
3092 tok->type = TK_CC_CC_OPEN; in fetch_token_in_cc()
3103 tok->type = TK_CC_AND; in fetch_token_in_cc()
3109 return tok->type; in fetch_token_in_cc()
3113 fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) in fetch_token() argument
3125 tok->type = TK_EOT; in fetch_token()
3126 return tok->type; in fetch_token()
3129 tok->type = TK_STRING; in fetch_token()
3130 tok->base = 0; in fetch_token()
3131 tok->backp = p; in fetch_token()
3137 tok->backp = p; in fetch_token()
3140 tok->u.c = c; in fetch_token()
3141 tok->escaped = 1; in fetch_token()
3145 tok->type = TK_OP_REPEAT; in fetch_token()
3146 tok->u.repeat.lower = 0; in fetch_token()
3147 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
3153 tok->type = TK_OP_REPEAT; in fetch_token()
3154 tok->u.repeat.lower = 1; in fetch_token()
3155 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
3161 tok->type = TK_OP_REPEAT; in fetch_token()
3162 tok->u.repeat.lower = 0; in fetch_token()
3163 tok->u.repeat.upper = 1; in fetch_token()
3168 tok->u.repeat.greedy = 0; in fetch_token()
3169 tok->u.repeat.possessive = 0; in fetch_token()
3175 tok->type != TK_INTERVAL) || in fetch_token()
3177 tok->type == TK_INTERVAL))) { in fetch_token()
3179 tok->u.repeat.greedy = 1; in fetch_token()
3180 tok->u.repeat.possessive = 1; in fetch_token()
3183 tok->u.repeat.greedy = 1; in fetch_token()
3184 tok->u.repeat.possessive = 0; in fetch_token()
3191 r = fetch_range_quantifier(&p, end, tok, env); in fetch_token()
3205 tok->type = TK_ALT; in fetch_token()
3210 tok->type = TK_SUBEXP_OPEN; in fetch_token()
3215 tok->type = TK_SUBEXP_CLOSE; in fetch_token()
3220 tok->type = TK_CHAR_TYPE; in fetch_token()
3221 tok->u.prop.ctype = ONIGENC_CTYPE_WORD; in fetch_token()
3222 tok->u.prop.not = 0; in fetch_token()
3227 tok->type = TK_CHAR_TYPE; in fetch_token()
3228 tok->u.prop.ctype = ONIGENC_CTYPE_WORD; in fetch_token()
3229 tok->u.prop.not = 1; in fetch_token()
3234 tok->type = TK_ANCHOR; in fetch_token()
3235 tok->u.anchor = ANCHOR_WORD_BOUND; in fetch_token()
3240 tok->type = TK_ANCHOR; in fetch_token()
3241 tok->u.anchor = ANCHOR_NOT_WORD_BOUND; in fetch_token()
3247 tok->type = TK_ANCHOR; in fetch_token()
3248 tok->u.anchor = ANCHOR_WORD_BEGIN; in fetch_token()
3253 tok->type = TK_ANCHOR; in fetch_token()
3254 tok->u.anchor = ANCHOR_WORD_END; in fetch_token()
3260 tok->type = TK_CHAR_TYPE; in fetch_token()
3261 tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; in fetch_token()
3262 tok->u.prop.not = 0; in fetch_token()
3267 tok->type = TK_CHAR_TYPE; in fetch_token()
3268 tok->u.prop.ctype = ONIGENC_CTYPE_SPACE; in fetch_token()
3269 tok->u.prop.not = 1; in fetch_token()
3274 tok->type = TK_CHAR_TYPE; in fetch_token()
3275 tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; in fetch_token()
3276 tok->u.prop.not = 0; in fetch_token()
3281 tok->type = TK_CHAR_TYPE; in fetch_token()
3282 tok->u.prop.ctype = ONIGENC_CTYPE_DIGIT; in fetch_token()
3283 tok->u.prop.not = 1; in fetch_token()
3288 tok->type = TK_CHAR_TYPE; in fetch_token()
3289 tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; in fetch_token()
3290 tok->u.prop.not = 0; in fetch_token()
3295 tok->type = TK_CHAR_TYPE; in fetch_token()
3296 tok->u.prop.ctype = ONIGENC_CTYPE_XDIGIT; in fetch_token()
3297 tok->u.prop.not = 1; in fetch_token()
3303 tok->type = TK_ANCHOR; in fetch_token()
3304 tok->u.subtype = ANCHOR_BEGIN_BUF; in fetch_token()
3309 tok->type = TK_ANCHOR; in fetch_token()
3310 tok->u.subtype = ANCHOR_SEMI_END_BUF; in fetch_token()
3316 tok->type = TK_ANCHOR; in fetch_token()
3317 tok->u.subtype = ANCHOR_END_BUF; in fetch_token()
3322 tok->type = TK_ANCHOR; in fetch_token()
3323 tok->u.subtype = ANCHOR_BEGIN_POSITION; in fetch_token()
3351 tok->type = TK_CODE_POINT; in fetch_token()
3352 tok->u.code = (OnigCodePoint )num; in fetch_token()
3376 tok->type = TK_CODE_POINT; in fetch_token()
3377 tok->u.code = (OnigCodePoint )num; in fetch_token()
3390 tok->type = TK_RAW_BYTE; in fetch_token()
3391 tok->base = 16; in fetch_token()
3392 tok->u.c = num; in fetch_token()
3406 tok->type = TK_CODE_POINT; in fetch_token()
3407 tok->base = 16; in fetch_token()
3408 tok->u.code = (OnigCodePoint )num; in fetch_token()
3428 tok->type = TK_BACKREF; in fetch_token()
3429 tok->u.backref.num = 1; in fetch_token()
3430 tok->u.backref.ref1 = num; in fetch_token()
3431 tok->u.backref.by_name = 0; in fetch_token()
3433 tok->u.backref.exist_level = 0; in fetch_token()
3455 tok->type = TK_RAW_BYTE; in fetch_token()
3456 tok->base = 8; in fetch_token()
3457 tok->u.c = num; in fetch_token()
3478 env, &back_num, &tok->u.backref.level); in fetch_token()
3479 if (r == 1) tok->u.backref.exist_level = 1; in fetch_token()
3480 else tok->u.backref.exist_level = 0; in fetch_token()
3498 tok->type = TK_BACKREF; in fetch_token()
3499 tok->u.backref.by_name = 0; in fetch_token()
3500 tok->u.backref.num = 1; in fetch_token()
3501 tok->u.backref.ref1 = back_num; in fetch_token()
3519 tok->type = TK_BACKREF; in fetch_token()
3520 tok->u.backref.by_name = 1; in fetch_token()
3522 tok->u.backref.num = 1; in fetch_token()
3523 tok->u.backref.ref1 = backs[0]; in fetch_token()
3526 tok->u.backref.num = num; in fetch_token()
3527 tok->u.backref.refs = backs; in fetch_token()
3549 tok->type = TK_CALL; in fetch_token()
3550 tok->u.call.name = prev; in fetch_token()
3551 tok->u.call.name_end = name_end; in fetch_token()
3552 tok->u.call.gnum = gnum; in fetch_token()
3562 tok->type = TK_QUOTE_OPEN; in fetch_token()
3571 tok->type = TK_CHAR_PROPERTY; in fetch_token()
3572 tok->u.prop.not = (c == 'P' ? 1 : 0); in fetch_token()
3578 tok->u.prop.not = (tok->u.prop.not == 0 ? 1 : 0); in fetch_token()
3594 if (tok->u.c != c2) { in fetch_token()
3595 tok->type = TK_CODE_POINT; in fetch_token()
3596 tok->u.code = c2; in fetch_token()
3600 SAFE_ENC_LEN(enc, tok->backp, end, len); in fetch_token()
3601 p = tok->backp + len; in fetch_token()
3608 tok->u.c = c; in fetch_token()
3609 tok->escaped = 0; in fetch_token()
3623 tok->type = TK_ANYCHAR_ANYTIME; in fetch_token()
3635 tok->type = TK_ANYCHAR; in fetch_token()
3643 tok->type = TK_OP_REPEAT; in fetch_token()
3644 tok->u.repeat.lower = 0; in fetch_token()
3645 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
3654 tok->type = TK_OP_REPEAT; in fetch_token()
3655 tok->u.repeat.lower = 1; in fetch_token()
3656 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
3665 tok->type = TK_OP_REPEAT; in fetch_token()
3666 tok->u.repeat.lower = 0; in fetch_token()
3667 tok->u.repeat.upper = 1; in fetch_token()
3673 r = fetch_range_quantifier(&p, end, tok, env); in fetch_token()
3687 tok->type = TK_ALT; in fetch_token()
3712 tok->type = TK_SUBEXP_OPEN; in fetch_token()
3717 tok->type = TK_SUBEXP_CLOSE; in fetch_token()
3722 tok->type = TK_ANCHOR; in fetch_token()
3723 tok->u.subtype = (IS_SINGLELINE(env->option) in fetch_token()
3729 tok->type = TK_ANCHOR; in fetch_token()
3730 tok->u.subtype = (IS_SINGLELINE(env->option) in fetch_token()
3736 tok->type = TK_CC_OPEN; in fetch_token()
3771 return tok->type; in fetch_token()
4037 parse_char_property(Node** np, OnigToken* tok, UChar** src, UChar* end, in parse_char_property() argument
4051 if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc); in parse_char_property()
4190 parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end, in parse_char_class() argument
4209 r = fetch_token_in_cc(tok, src, end, env); in parse_char_class()
4210 if (r == TK_CHAR && tok->u.c == '^' && tok->escaped == 0) { in parse_char_class()
4212 r = fetch_token_in_cc(tok, src, end, env); in parse_char_class()
4225 r = tok->type = TK_CHAR; /* allow []...] */ in parse_char_class()
4240 len = ONIGENC_CODE_TO_MBCLEN(env->enc, tok->u.c); in parse_char_class()
4252 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4259 if (! ONIGENC_IS_SINGLEBYTE(env->enc) && tok->base != 0) { in parse_char_class()
4263 int i, base = tok->base; in parse_char_class()
4265 buf[0] = tok->u.c; in parse_char_class()
4267 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4269 if (r != TK_RAW_BYTE || tok->base != base) { in parse_char_class()
4273 buf[i] = tok->u.c; in parse_char_class()
4289 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4304 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4313 v = tok->u.code; in parse_char_class()
4333 p = tok->backp; in parse_char_class()
4334 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4342 r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not, env); in parse_char_class()
4356 r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, env); in parse_char_class()
4364 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4381 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4384 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4398 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4421 r = parse_char_class(&anode, tok, &p, end, env); in parse_char_class()
4470 r = tok->type; in parse_char_class()
4472 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4523 static int parse_subexp(Node** top, OnigToken* tok, int term,
4527 parse_enclose(Node** np, OnigToken* tok, int term, UChar** src, UChar* end, in parse_enclose() argument
4556 r = fetch_token(tok, &p, end, env); in parse_enclose()
4558 r = parse_subexp(np, tok, term, &p, end, env); in parse_enclose()
4715 r = fetch_token(tok, &p, end, env); in parse_enclose()
4717 r = parse_subexp(&target, tok, term, &p, end, env); in parse_enclose()
4752 r = fetch_token(tok, &p, end, env); in parse_enclose()
4754 r = parse_subexp(&target, tok, term, &p, end, env); in parse_enclose()
4987 parse_exp(Node** np, OnigToken* tok, int term, in parse_exp() argument
4995 if (tok->type == (enum TokenSyms )term) in parse_exp()
4998 switch (tok->type) { in parse_exp()
5003 return tok->type; in parse_exp()
5007 r = parse_enclose(np, tok, TK_SUBEXP_CLOSE, src, end, env); in parse_exp()
5015 r = fetch_token(tok, src, end, env); in parse_exp()
5017 r = parse_subexp(&target, tok, term, src, end, env); in parse_exp()
5024 return tok->type; in parse_exp()
5032 if (tok->escaped) goto tk_raw_byte; in parse_exp()
5039 *np = node_new_str(tok->backp, *src); in parse_exp()
5043 r = fetch_token(tok, src, end, env); in parse_exp()
5047 r = onig_node_str_cat(*np, tok->backp, *src); in parse_exp()
5060 *np = node_new_str_raw_char((UChar )tok->u.c); in parse_exp()
5066 r = fetch_token(tok, src, end, env); in parse_exp()
5072 r = fetch_token(tok, src, end, env); in parse_exp()
5090 r = node_str_cat_char(*np, (UChar )tok->u.c); in parse_exp()
5101 int num = ONIGENC_CODE_TO_MBC(env->enc, tok->u.code, buf); in parse_exp()
5132 switch (tok->u.prop.ctype) { in parse_exp()
5134 *np = node_new_ctype(tok->u.prop.ctype, tok->u.prop.not); in parse_exp()
5147 add_ctype_to_cc(cc, tok->u.prop.ctype, 0, env); in parse_exp()
5148 if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc); in parse_exp()
5160 r = parse_char_property(np, tok, src, end, env); in parse_exp()
5168 r = parse_char_class(np, tok, src, end, env); in parse_exp()
5213 len = tok->u.backref.num; in parse_exp()
5215 (len > 1 ? tok->u.backref.refs : &(tok->u.backref.ref1)), in parse_exp()
5216 tok->u.backref.by_name, in parse_exp()
5218 tok->u.backref.exist_level, in parse_exp()
5219 tok->u.backref.level, in parse_exp()
5228 int gnum = tok->u.call.gnum; in parse_exp()
5235 *np = node_new_call(tok->u.call.name, tok->u.call.name_end, gnum); in parse_exp()
5243 *np = onig_node_new_anchor(tok->u.anchor); in parse_exp()
5268 r = fetch_token(tok, src, end, env); in parse_exp()
5276 qn = node_new_quantifier(tok->u.repeat.lower, tok->u.repeat.upper, in parse_exp()
5279 NQTFR(qn)->greedy = tok->u.repeat.greedy; in parse_exp()
5286 if (tok->u.repeat.possessive != 0) { in parse_exp()
5326 parse_branch(Node** top, OnigToken* tok, int term, in parse_branch() argument
5333 r = parse_exp(&node, tok, term, src, end, env); in parse_branch()
5346 r = parse_exp(&node, tok, term, src, end, env); in parse_branch()
5369 parse_subexp(Node** top, OnigToken* tok, int term, in parse_subexp() argument
5379 r = parse_branch(&node, tok, term, src, end, env); in parse_subexp()
5392 r = fetch_token(tok, src, end, env); in parse_subexp()
5394 r = parse_branch(&node, tok, term, src, end, env); in parse_subexp()
5403 if (tok->type != (enum TokenSyms )term) in parse_subexp()
5423 OnigToken tok; in parse_regexp() local
5425 r = fetch_token(&tok, src, end, env); in parse_regexp()
5427 r = parse_subexp(top, &tok, TK_EOT, src, end, env); in parse_regexp()