summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--bootstraptest/test_syntax.rb3
-rw-r--r--parse.y3
3 files changed, 10 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4bf555b..dbd1365 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Apr 18 12:48:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): seems like a symbol-literal when spaces
+ are unbalanced. [ruby-core:29578]
+
Sun Apr 18 12:32:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (string_content): preserve cond_stack and cmdarg_stack.
diff --git a/bootstraptest/test_syntax.rb b/bootstraptest/test_syntax.rb
index 44db11b..30219c0 100644
--- a/bootstraptest/test_syntax.rb
+++ b/bootstraptest/test_syntax.rb
@@ -890,3 +890,6 @@ assert_valid_syntax('x y { "#{}".z { } }', bug1240)
assert_valid_syntax('x y { "#{}".z do end }', bug1240)
assert_valid_syntax('y "#{a 1}" do end', '[ruby-core:29579]')
+
+bug3163 = '[ruby-core:29578]'
+assert_valid_syntax('foo = 1; foo :bar', bug3163)
diff --git a/parse.y b/parse.y
index fd788da..6a33f08 100644
--- a/parse.y
+++ b/parse.y
@@ -7192,7 +7192,8 @@ parser_yylex(struct parser_params *parser)
lex_state = EXPR_DOT;
return tCOLON2;
}
- if (lex_state == EXPR_END || lex_state == EXPR_ENDARG || (c != -1 && ISSPACE(c))) {
+ if ((!space_seen && (lex_state == EXPR_END || lex_state == EXPR_ENDARG)) ||
+ (c != -1 && ISSPACE(c))) {
pushback(c);
lex_state = EXPR_BEG;
return ':';