diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -886,6 +886,7 @@ static void token_info_warn(struct parser_params *p, const char *token, token_in %token tRSHFT RUBY_TOKEN(RSHFT) ">>" %token <id> tANDDOT RUBY_TOKEN(ANDDOT) "&." %token <id> tCOLON2 RUBY_TOKEN(COLON2) "::" +%token <id> tMETHREF RUBY_TOKEN(METHREF) ".:" %token tCOLON3 ":: at EXPR_BEG" %token <id> tOP_ASGN /* +=, -= etc. */ %token tASSOC "=>" @@ -2710,6 +2711,13 @@ primary : literal /*% %*/ /*% ripper: retry! %*/ } + | primary_value tMETHREF operation2 + { + /*%%%*/ + $$ = NEW_METHREF($1, $3, &@$); + /*% %*/ + /*% ripper: methref!($1, $3) %*/ + } ; primary_value : primary @@ -8060,12 +8068,30 @@ parser_yylex(struct parser_params *p) case '.': SET_LEX_STATE(EXPR_BEG); - if ((c = nextc(p)) == '.') { + switch (c = nextc(p)) { + case '.': if ((c = nextc(p)) == '.') { return tDOT3; } pushback(p, c); return tDOT2; + case ':': + switch (c = nextc(p)) { + default: + if (!parser_is_identchar(p)) break; + /* fallthru */ + case '!': case '%': case '&': case '*': case '+': + case '-': case '/': case '<': case '=': case '>': + case '[': case '^': case '`': case '|': case '~': + pushback(p, c); + SET_LEX_STATE(EXPR_DOT); + return tMETHREF; + case -1: + break; + } + pushback(p, c); + c = ':'; + break; } pushback(p, c); if (c != -1 && ISDIGIT(c)) { |