Lines Matching refs:tok

2282 fetch_range_quantifier(UChar** src, UChar* end, OnigToken* tok, ScanEnv* env)  in fetch_range_quantifier()  argument
2358 tok->type = TK_INTERVAL; in fetch_range_quantifier()
2359 tok->u.repeat.lower = low; in fetch_range_quantifier()
2360 tok->u.repeat.upper = up; in fetch_range_quantifier()
2445 static int fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env);
2747 fetch_token_in_cc(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) in fetch_token_in_cc() argument
2758 tok->type = TK_EOT; in fetch_token_in_cc()
2759 return tok->type; in fetch_token_in_cc()
2763 tok->type = TK_CHAR; in fetch_token_in_cc()
2764 tok->base = 0; in fetch_token_in_cc()
2765 tok->u.c = c; in fetch_token_in_cc()
2766 tok->escaped = 0; in fetch_token_in_cc()
2769 tok->type = TK_CC_CLOSE; in fetch_token_in_cc()
2772 tok->type = TK_CC_RANGE; in fetch_token_in_cc()
2781 tok->escaped = 1; in fetch_token_in_cc()
2782 tok->u.c = c; in fetch_token_in_cc()
2785 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2786 tok->u.subtype = CTYPE_WORD; in fetch_token_in_cc()
2789 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2790 tok->u.subtype = CTYPE_NOT_WORD; in fetch_token_in_cc()
2793 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2794 tok->u.subtype = CTYPE_DIGIT; in fetch_token_in_cc()
2797 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2798 tok->u.subtype = CTYPE_NOT_DIGIT; in fetch_token_in_cc()
2801 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2802 tok->u.subtype = CTYPE_WHITE_SPACE; in fetch_token_in_cc()
2805 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2806 tok->u.subtype = CTYPE_NOT_WHITE_SPACE; in fetch_token_in_cc()
2810 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2811 tok->u.subtype = CTYPE_XDIGIT; in fetch_token_in_cc()
2815 tok->type = TK_CHAR_TYPE; in fetch_token_in_cc()
2816 tok->u.subtype = CTYPE_NOT_XDIGIT; in fetch_token_in_cc()
2825 tok->type = TK_CHAR_PROPERTY; in fetch_token_in_cc()
2826 tok->u.prop.not = (c == 'P' ? 1 : 0); in fetch_token_in_cc()
2831 tok->u.prop.not = (tok->u.prop.not == 0 ? 1 : 0); in fetch_token_in_cc()
2855 tok->type = TK_CODE_POINT; in fetch_token_in_cc()
2856 tok->base = 16; in fetch_token_in_cc()
2857 tok->u.code = (OnigCodePoint )num; in fetch_token_in_cc()
2870 tok->type = TK_RAW_BYTE; in fetch_token_in_cc()
2871 tok->base = 16; in fetch_token_in_cc()
2872 tok->u.c = num; in fetch_token_in_cc()
2886 tok->type = TK_CODE_POINT; in fetch_token_in_cc()
2887 tok->base = 16; in fetch_token_in_cc()
2888 tok->u.code = (OnigCodePoint )num; in fetch_token_in_cc()
2902 tok->type = TK_RAW_BYTE; in fetch_token_in_cc()
2903 tok->base = 8; in fetch_token_in_cc()
2904 tok->u.c = num; in fetch_token_in_cc()
2912 if (tok->u.c != num) { in fetch_token_in_cc()
2913 tok->u.code = (OnigCodePoint )num; in fetch_token_in_cc()
2914 tok->type = TK_CODE_POINT; in fetch_token_in_cc()
2922 tok->backp = p; /* point at '[' is readed */ in fetch_token_in_cc()
2926 tok->type = TK_POSIX_BRACKET_OPEN; in fetch_token_in_cc()
2936 tok->type = TK_CC_CC_OPEN; in fetch_token_in_cc()
2947 tok->type = TK_CC_AND; in fetch_token_in_cc()
2953 return tok->type; in fetch_token_in_cc()
2957 fetch_token(OnigToken* tok, UChar** src, UChar* end, ScanEnv* env) in fetch_token() argument
2969 tok->type = TK_EOT; in fetch_token()
2970 return tok->type; in fetch_token()
2973 tok->type = TK_STRING; in fetch_token()
2974 tok->base = 0; in fetch_token()
2975 tok->backp = p; in fetch_token()
2981 tok->backp = p; in fetch_token()
2984 tok->u.c = c; in fetch_token()
2985 tok->escaped = 1; in fetch_token()
2989 tok->type = TK_OP_REPEAT; in fetch_token()
2990 tok->u.repeat.lower = 0; in fetch_token()
2991 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
2997 tok->type = TK_OP_REPEAT; in fetch_token()
2998 tok->u.repeat.lower = 1; in fetch_token()
2999 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
3005 tok->type = TK_OP_REPEAT; in fetch_token()
3006 tok->u.repeat.lower = 0; in fetch_token()
3007 tok->u.repeat.upper = 1; in fetch_token()
3012 tok->u.repeat.greedy = 0; in fetch_token()
3013 tok->u.repeat.possessive = 0; in fetch_token()
3019 tok->type != TK_INTERVAL) || in fetch_token()
3021 tok->type == TK_INTERVAL))) { in fetch_token()
3023 tok->u.repeat.greedy = 1; in fetch_token()
3024 tok->u.repeat.possessive = 1; in fetch_token()
3027 tok->u.repeat.greedy = 1; in fetch_token()
3028 tok->u.repeat.possessive = 0; in fetch_token()
3035 r = fetch_range_quantifier(&p, end, tok, env); in fetch_token()
3049 tok->type = TK_ALT; in fetch_token()
3054 tok->type = TK_SUBEXP_OPEN; in fetch_token()
3059 tok->type = TK_SUBEXP_CLOSE; in fetch_token()
3064 tok->type = TK_CHAR_TYPE; in fetch_token()
3065 tok->u.subtype = CTYPE_WORD; in fetch_token()
3070 tok->type = TK_CHAR_TYPE; in fetch_token()
3071 tok->u.subtype = CTYPE_NOT_WORD; in fetch_token()
3076 tok->type = TK_ANCHOR; in fetch_token()
3077 tok->u.anchor = ANCHOR_WORD_BOUND; in fetch_token()
3082 tok->type = TK_ANCHOR; in fetch_token()
3083 tok->u.anchor = ANCHOR_NOT_WORD_BOUND; in fetch_token()
3089 tok->type = TK_ANCHOR; in fetch_token()
3090 tok->u.anchor = ANCHOR_WORD_BEGIN; in fetch_token()
3095 tok->type = TK_ANCHOR; in fetch_token()
3096 tok->u.anchor = ANCHOR_WORD_END; in fetch_token()
3102 tok->type = TK_CHAR_TYPE; in fetch_token()
3103 tok->u.subtype = CTYPE_WHITE_SPACE; in fetch_token()
3108 tok->type = TK_CHAR_TYPE; in fetch_token()
3109 tok->u.subtype = CTYPE_NOT_WHITE_SPACE; in fetch_token()
3114 tok->type = TK_CHAR_TYPE; in fetch_token()
3115 tok->u.subtype = CTYPE_DIGIT; in fetch_token()
3120 tok->type = TK_CHAR_TYPE; in fetch_token()
3121 tok->u.subtype = CTYPE_NOT_DIGIT; in fetch_token()
3126 tok->type = TK_CHAR_TYPE; in fetch_token()
3127 tok->u.subtype = CTYPE_XDIGIT; in fetch_token()
3132 tok->type = TK_CHAR_TYPE; in fetch_token()
3133 tok->u.subtype = CTYPE_NOT_XDIGIT; in fetch_token()
3139 tok->type = TK_ANCHOR; in fetch_token()
3140 tok->u.subtype = ANCHOR_BEGIN_BUF; in fetch_token()
3145 tok->type = TK_ANCHOR; in fetch_token()
3146 tok->u.subtype = ANCHOR_SEMI_END_BUF; in fetch_token()
3152 tok->type = TK_ANCHOR; in fetch_token()
3153 tok->u.subtype = ANCHOR_END_BUF; in fetch_token()
3158 tok->type = TK_ANCHOR; in fetch_token()
3159 tok->u.subtype = ANCHOR_BEGIN_POSITION; in fetch_token()
3187 tok->type = TK_CODE_POINT; in fetch_token()
3188 tok->u.code = (OnigCodePoint )num; in fetch_token()
3201 tok->type = TK_RAW_BYTE; in fetch_token()
3202 tok->base = 16; in fetch_token()
3203 tok->u.c = num; in fetch_token()
3217 tok->type = TK_CODE_POINT; in fetch_token()
3218 tok->base = 16; in fetch_token()
3219 tok->u.code = (OnigCodePoint )num; in fetch_token()
3239 tok->type = TK_BACKREF; in fetch_token()
3240 tok->u.backref.num = 1; in fetch_token()
3241 tok->u.backref.ref1 = num; in fetch_token()
3242 tok->u.backref.by_name = 0; in fetch_token()
3244 tok->u.backref.exist_level = 0; in fetch_token()
3266 tok->type = TK_RAW_BYTE; in fetch_token()
3267 tok->base = 8; in fetch_token()
3268 tok->u.c = num; in fetch_token()
3287 r = fetch_name_with_level(&p, end, &name_end, env, &tok->u.backref.level); in fetch_token()
3288 if (r == 1) tok->u.backref.exist_level = 1; in fetch_token()
3289 else tok->u.backref.exist_level = 0; in fetch_token()
3310 tok->type = TK_BACKREF; in fetch_token()
3311 tok->u.backref.by_name = 1; in fetch_token()
3313 tok->u.backref.num = 1; in fetch_token()
3314 tok->u.backref.ref1 = backs[0]; in fetch_token()
3317 tok->u.backref.num = num; in fetch_token()
3318 tok->u.backref.refs = backs; in fetch_token()
3338 tok->type = TK_CALL; in fetch_token()
3339 tok->u.call.name = prev; in fetch_token()
3340 tok->u.call.name_end = name_end; in fetch_token()
3350 tok->type = TK_QUOTE_OPEN; in fetch_token()
3359 tok->type = TK_CHAR_PROPERTY; in fetch_token()
3360 tok->u.prop.not = (c == 'P' ? 1 : 0); in fetch_token()
3365 tok->u.prop.not = (tok->u.prop.not == 0 ? 1 : 0); in fetch_token()
3378 if (tok->u.c != num) { in fetch_token()
3379 tok->type = TK_CODE_POINT; in fetch_token()
3380 tok->u.code = (OnigCodePoint )num; in fetch_token()
3383 p = tok->backp + enc_len(enc, tok->backp); in fetch_token()
3389 tok->u.c = c; in fetch_token()
3390 tok->escaped = 0; in fetch_token()
3404 tok->type = TK_ANYCHAR_ANYTIME; in fetch_token()
3416 tok->type = TK_ANYCHAR; in fetch_token()
3424 tok->type = TK_OP_REPEAT; in fetch_token()
3425 tok->u.repeat.lower = 0; in fetch_token()
3426 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
3435 tok->type = TK_OP_REPEAT; in fetch_token()
3436 tok->u.repeat.lower = 1; in fetch_token()
3437 tok->u.repeat.upper = REPEAT_INFINITE; in fetch_token()
3446 tok->type = TK_OP_REPEAT; in fetch_token()
3447 tok->u.repeat.lower = 0; in fetch_token()
3448 tok->u.repeat.upper = 1; in fetch_token()
3454 r = fetch_range_quantifier(&p, end, tok, env); in fetch_token()
3468 tok->type = TK_ALT; in fetch_token()
3493 tok->type = TK_SUBEXP_OPEN; in fetch_token()
3498 tok->type = TK_SUBEXP_CLOSE; in fetch_token()
3503 tok->type = TK_ANCHOR; in fetch_token()
3504 tok->u.subtype = (IS_SINGLELINE(env->option) in fetch_token()
3510 tok->type = TK_ANCHOR; in fetch_token()
3511 tok->u.subtype = (IS_SINGLELINE(env->option) in fetch_token()
3517 tok->type = TK_CC_OPEN; in fetch_token()
3552 return tok->type; in fetch_token()
3906 parse_char_property(Node** np, OnigToken* tok, UChar** src, UChar* end, in parse_char_property() argument
3920 if (tok->u.prop.not != 0) CCLASS_SET_NOT(cc); in parse_char_property()
4061 parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end, in parse_char_class() argument
4077 r = fetch_token_in_cc(tok, src, end, env); in parse_char_class()
4078 if (r == TK_CHAR && tok->u.c == '^' && tok->escaped == 0) { in parse_char_class()
4080 r = fetch_token_in_cc(tok, src, end, env); in parse_char_class()
4093 r = tok->type = TK_CHAR; /* allow []...] */ in parse_char_class()
4107 len = ONIGENC_CODE_TO_MBCLEN(env->enc, tok->u.c); in parse_char_class()
4115 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4122 if (! ONIGENC_IS_SINGLEBYTE(env->enc) && tok->base != 0) { in parse_char_class()
4126 int i, base = tok->base; in parse_char_class()
4128 buf[0] = tok->u.c; in parse_char_class()
4130 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4132 if (r != TK_RAW_BYTE || tok->base != base) { in parse_char_class()
4136 buf[i] = tok->u.c; in parse_char_class()
4152 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4167 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4176 v = tok->u.code; in parse_char_class()
4196 p = tok->backp; in parse_char_class()
4197 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4207 ctype = parse_ctype_to_enc_ctype(tok->u.subtype, &not); in parse_char_class()
4223 r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, env); in parse_char_class()
4231 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4248 v = (OnigCodePoint )tok->u.c; in parse_char_class()
4251 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4265 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4288 r = parse_char_class(&anode, tok, &p, end, env); in parse_char_class()
4334 r = tok->type; in parse_char_class()
4336 r = fetch_token_in_cc(tok, &p, end, env); in parse_char_class()
4387 static int parse_subexp(Node** top, OnigToken* tok, int term,
4391 parse_effect(Node** np, OnigToken* tok, int term, UChar** src, UChar* end, in parse_effect() argument
4416 r = fetch_token(tok, &p, end, env); in parse_effect()
4418 r = parse_subexp(np, tok, term, &p, end, env); in parse_effect()
4556 r = fetch_token(tok, &p, end, env); in parse_effect()
4558 r = parse_subexp(&target, tok, term, &p, end, env); in parse_effect()
4590 r = fetch_token(tok, &p, end, env); in parse_effect()
4592 r = parse_subexp(&target, tok, term, &p, end, env); in parse_effect()
4786 parse_exp(Node** np, OnigToken* tok, int term, in parse_exp() argument
4794 if (tok->type == term) in parse_exp()
4797 switch (tok->type) { in parse_exp()
4802 return tok->type; in parse_exp()
4806 r = parse_effect(np, tok, TK_SUBEXP_CLOSE, src, end, env); in parse_exp()
4814 r = fetch_token(tok, src, end, env); in parse_exp()
4816 r = parse_subexp(&target, tok, term, src, end, env); in parse_exp()
4820 return tok->type; in parse_exp()
4828 if (tok->escaped) goto tk_raw_byte; in parse_exp()
4835 *np = node_new_str(tok->backp, *src); in parse_exp()
4839 r = fetch_token(tok, src, end, env); in parse_exp()
4843 r = onig_node_str_cat(*np, tok->backp, *src); in parse_exp()
4856 *np = node_new_str_char((UChar )tok->u.c); in parse_exp()
4862 r = fetch_token(tok, src, end, env); in parse_exp()
4867 r = fetch_token(tok, src, end, env); in parse_exp()
4883 r = node_str_cat_char(*np, (UChar )tok->u.c); in parse_exp()
4894 int num = ONIGENC_CODE_TO_MBC(env->enc, tok->u.code, buf); in parse_exp()
4925 switch (tok->u.subtype) { in parse_exp()
4928 *np = node_new_ctype(tok->u.subtype); in parse_exp()
4945 ctype = parse_ctype_to_enc_ctype(tok->u.subtype, &not); in parse_exp()
4991 ctype = parse_ctype_to_enc_ctype(tok->u.subtype, &not); in parse_exp()
5011 r = parse_char_property(np, tok, src, end, env); in parse_exp()
5019 r = parse_char_class(np, tok, src, end, env); in parse_exp()
5075 len = tok->u.backref.num; in parse_exp()
5077 (len > 1 ? tok->u.backref.refs : &(tok->u.backref.ref1)), in parse_exp()
5078 tok->u.backref.by_name, in parse_exp()
5080 tok->u.backref.exist_level, in parse_exp()
5081 tok->u.backref.level, in parse_exp()
5089 *np = node_new_call(tok->u.call.name, tok->u.call.name_end); in parse_exp()
5096 *np = onig_node_new_anchor(tok->u.anchor); in parse_exp()
5121 r = fetch_token(tok, src, end, env); in parse_exp()
5129 qn = node_new_quantifier(tok->u.repeat.lower, tok->u.repeat.upper, in parse_exp()
5132 NQUANTIFIER(qn).greedy = tok->u.repeat.greedy; in parse_exp()
5136 if (tok->u.repeat.possessive != 0) { in parse_exp()
5164 parse_branch(Node** top, OnigToken* tok, int term, in parse_branch() argument
5171 r = parse_exp(&node, tok, term, src, end, env); in parse_branch()
5181 r = parse_exp(&node, tok, term, src, end, env); in parse_branch()
5201 parse_subexp(Node** top, OnigToken* tok, int term, in parse_subexp() argument
5208 r = parse_branch(&node, tok, term, src, end, env); in parse_subexp()
5221 r = fetch_token(tok, src, end, env); in parse_subexp()
5223 r = parse_branch(&node, tok, term, src, end, env); in parse_subexp()
5230 if (tok->type != term) in parse_subexp()
5248 OnigToken tok; in parse_regexp() local
5250 r = fetch_token(&tok, src, end, env); in parse_regexp()
5252 r = parse_subexp(top, &tok, TK_EOT, src, end, env); in parse_regexp()