From 86b710d9133b124fe084bdda278deb7948c9dd90 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 18 Jun 2002 15:53:57 +0000 Subject: * parse.y (yylex): ? followed by successive word charaters is ternary operator not numeric literal. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++++- parse.y | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ac3869fe2..bbfb8c09c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ -Wed Jun 19 00:39:52 2002 Nobuyoshi Nakada +Wed Jun 19 00:50:50 2002 Nobuyoshi Nakada + + * parse.y (yylex): ? followed by successive word charaters is + ternary operator not numeric literal. * parse.y (yylex): commands after break/next/rescue can take arguments. (ruby-bugs-ja:PR#265) diff --git a/parse.y b/parse.y index 7d1d81f9e..885b5d312 100644 --- a/parse.y +++ b/parse.y @@ -3300,10 +3300,14 @@ yylex() rb_warn("invalid character syntax; use ?\\%c", c); } } + ternary: pushback(c); lex_state = EXPR_BEG; return '?'; } + if ((ISALNUM(c) || c == '_') && lex_p < lex_pend && is_identchar(*lex_p)) { + goto ternary; + } else if (c == '\\') { c = read_escape(); } -- cgit