ruby-changes:49748
From: nobu <ko1@a...>
Date: Tue, 16 Jan 2018 12:16:20 +0900 (JST)
Subject: [ruby-changes:49748] nobu:r61866 (trunk): parse.y: expand tokadd_mbchar
nobu 2018-01-16 12:16:15 +0900 (Tue, 16 Jan 2018) New Revision: 61866 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61866 Log: parse.y: expand tokadd_mbchar * parse.y (tokadd_mbchar): renamed and expand callers with p. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 61865) +++ parse.y (revision 61866) @@ -5748,7 +5748,7 @@ parser_regx_options(struct parser_params https://github.com/ruby/ruby/blob/trunk/parse.y#L5748 } static int -parser_tokadd_mbchar(struct parser_params *p, int c) +tokadd_mbchar(struct parser_params *p, int c) { int len = parser_precise_mbclen(p, p->lex.pcur-1); if (len < 0) return -1; @@ -5758,8 +5758,6 @@ parser_tokadd_mbchar(struct parser_param https://github.com/ruby/ruby/blob/trunk/parse.y#L5758 return c; } -#define tokadd_mbchar(c) parser_tokadd_mbchar(p, (c)) - static inline int simple_re_meta(int c) { @@ -5917,7 +5915,7 @@ parser_tokadd_string(struct parser_param https://github.com/ruby/ruby/blob/trunk/parse.y#L5915 mixed_error(enc, *encp); continue; } - if (tokadd_mbchar(c) == -1) return -1; + if (tokadd_mbchar(p, c) == -1) return -1; continue; } else if ((func & STR_FUNC_QWORDS) && ISSPACE(c)) { @@ -6169,7 +6167,7 @@ parser_heredoc_identifier(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L6167 tokadd(func); term = c; while ((c = nextc()) != -1 && c != term) { - if (tokadd_mbchar(c) == -1) return 0; + if (tokadd_mbchar(p, c) == -1) return 0; if (!newline && c == '\n') newline = 1; else if (newline) newline = 2; } @@ -6200,7 +6198,7 @@ parser_heredoc_identifier(struct parser_ https://github.com/ruby/ruby/blob/trunk/parse.y#L6198 tokadd(term_len); tokadd(func |= str_dquote); do { - if (tokadd_mbchar(c) == -1) return 0; + if (tokadd_mbchar(p, c) == -1) return 0; } while ((c = nextc()) != -1 && parser_is_identchar()); pushback(c); break; @@ -7297,7 +7295,7 @@ parse_qmark(struct parser_params *p, int https://github.com/ruby/ruby/blob/trunk/parse.y#L7295 newtok(); enc = p->enc; if (!parser_isascii()) { - if (tokadd_mbchar(c) == -1) return 0; + if (tokadd_mbchar(p, c) == -1) return 0; } else if ((rb_enc_isalnum(c, p->enc) || c == '_') && p->lex.pcur < p->lex.pend && is_identchar(p->lex.pcur, p->lex.pend, p->enc)) { @@ -7323,7 +7321,7 @@ parse_qmark(struct parser_params *p, int https://github.com/ruby/ruby/blob/trunk/parse.y#L7321 } else if (!lex_eol_p() && !(c = *p->lex.pcur, ISASCII(c))) { nextc(); - if (tokadd_mbchar(c) == -1) return 0; + if (tokadd_mbchar(p, c) == -1) return 0; } else { c = read_escape(0, &enc); @@ -7433,7 +7431,7 @@ static int https://github.com/ruby/ruby/blob/trunk/parse.y#L7431 tokadd_ident(struct parser_params *p, int c) { do { - if (tokadd_mbchar(c) == -1) return -1; + if (tokadd_mbchar(p, c) == -1) return -1; c = nextc(); } while (parser_is_identchar()); pushback(c); @@ -7515,7 +7513,7 @@ parse_gvar(struct parser_params *p, cons https://github.com/ruby/ruby/blob/trunk/parse.y#L7513 tokadd(c); c = nextc(); if (parser_is_identchar()) { - if (tokadd_mbchar(c) == -1) return 0; + if (tokadd_mbchar(p, c) == -1) return 0; } else { pushback(c); @@ -7622,7 +7620,7 @@ parse_ident(struct parser_params *p, int https://github.com/ruby/ruby/blob/trunk/parse.y#L7620 do { if (!ISASCII(c)) mb = ENC_CODERANGE_UNKNOWN; - if (tokadd_mbchar(c) == -1) return 0; + if (tokadd_mbchar(p, c) == -1) return 0; c = nextc(); } while (parser_is_identchar()); if ((c == '!' || c == '?') && !peek('=')) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/