summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-30 06:20:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-06-30 06:20:09 +0000
commit639bd5e78fa7d83b44c892afccb99869a886e533 (patch)
treed33ef363870dccb8536cbcc1ab3a8780df92ff7f /parse.y
parent00433666fd12d7e08c4c7c51593fc30265dd4508 (diff)
* eval.c (rb_eval): pre-evaluate argument for unambiguous
evaluation order. [ruby-dev:26383] * lib/delegate.rb (Delegator::method_missing): forward unknown method to the destination. suggested by <christophe.poucet@gmail.com>. [ruby-talk:146776] * process.c (detach_process_watcher): terminate process watcher thread right after rb_waitpid() succeed. [ruby-talk:146430] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y16
1 files changed, 10 insertions, 6 deletions
diff --git a/parse.y b/parse.y
index ee0444d7da..ffd1b18323 100644
--- a/parse.y
+++ b/parse.y
@@ -56,6 +56,7 @@ int ruby_sourceline; /* current line no. */
enum lex_state_e {
EXPR_BEG, /* ignore newline, +/- is a sign. */
EXPR_END, /* newline significant, +/- is a operator. */
+ EXPR_END2, /* newline significant, +/- is a operator. */
EXPR_ARG, /* newline significant, +/- is a operator. */
EXPR_CMDARG, /* newline significant, +/- is a operator. */
EXPR_ENDARG, /* newline significant, +/- is a operator. */
@@ -5725,6 +5726,7 @@ parser_yylex(parser)
c = nextc();
if (c == '<' &&
lex_state != EXPR_END &&
+ lex_state != EXPR_END2 &&
lex_state != EXPR_DOT &&
lex_state != EXPR_ENDARG &&
lex_state != EXPR_CLASS &&
@@ -5803,7 +5805,9 @@ parser_yylex(parser)
return tSTRING_BEG;
case '?':
- if (lex_state == EXPR_END || lex_state == EXPR_ENDARG) {
+ if (lex_state == EXPR_END ||
+ lex_state == EXPR_END2 ||
+ lex_state == EXPR_ENDARG) {
lex_state = EXPR_VALUE;
return '?';
}
@@ -6232,7 +6236,8 @@ parser_yylex(parser)
lex_state = EXPR_DOT;
return tCOLON2;
}
- if (lex_state == EXPR_END || lex_state == EXPR_ENDARG || ISSPACE(c)) {
+ if (lex_state == EXPR_END || lex_state == EXPR_END2 ||
+ lex_state == EXPR_ENDARG || ISSPACE(c)) {
pushback(c);
lex_state = EXPR_BEG;
return ':';
@@ -6293,11 +6298,10 @@ parser_yylex(parser)
return '^';
case ';':
- if ((c = nextc()) == ';') {
- lex_state = EXPR_END;
+ if (lex_state != EXPR_END2 && peek(';')) {
+ lex_state = EXPR_END2;
return kEND;
}
- pushback(c);
lex_state = EXPR_BEG;
command_start = Qtrue;
return ';';
@@ -6363,7 +6367,7 @@ parser_yylex(parser)
return c;
case '{':
- if (IS_ARG() || lex_state == EXPR_END)
+ if (IS_ARG() || lex_state == EXPR_END || lex_state == EXPR_END2)
c = '{'; /* block (primary) */
else if (lex_state == EXPR_ENDARG)
c = tLBRACE_ARG; /* block (expr) */