summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-15 12:04:16 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-15 12:04:16 +0900
commit5d7905490659b9b4f4604e9fd479563fcd103b34 (patch)
tree8bdb627e415499a927a66f1cd353c67e24abfe58
parent6fa4c904483588d2aa08d1fd84e2b8efc95227df (diff)
Revert github/pull/2230, commit miss
-rw-r--r--parse.y9
-rw-r--r--test/ruby/test_syntax.rb39
2 files changed, 1 insertions, 47 deletions
diff --git a/parse.y b/parse.y
index 1ce75fd07b..a7cdddcaec 100644
--- a/parse.y
+++ b/parse.y
@@ -91,7 +91,6 @@ enum lex_state_bits {
EXPR_LABEL_bit, /* flag bit, label is allowed. */
EXPR_LABELED_bit, /* flag bit, just after a label. */
EXPR_FITEM_bit, /* symbol literal as FNAME. */
- EXPR_EMPTYLN_bit, /* line contains only whitespace and comments */
EXPR_MAX_STATE
};
/* examine combinations */
@@ -110,7 +109,6 @@ enum lex_state_e {
DEF_EXPR(LABEL),
DEF_EXPR(LABELED),
DEF_EXPR(FITEM),
- DEF_EXPR(EMPTYLN),
EXPR_VALUE = EXPR_BEG,
EXPR_BEG_ANY = (EXPR_BEG | EXPR_MID | EXPR_CLASS),
EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG),
@@ -8680,11 +8678,6 @@ parser_yylex(struct parser_params *p)
case '\13': /* '\v' */
space_seen = 1;
break;
- case '\n':
- case '#':
- SET_LEX_STATE(EXPR_EMPTYLN);
- pushback(p, c);
- goto retry;
case '|':
case '&':
case '.': {
@@ -10023,7 +10016,7 @@ new_regexp(struct parser_params *p, VALUE re, VALUE opt, const YYLTYPE *loc)
static const char rb_parser_lex_state_names[][13] = {
"EXPR_BEG", "EXPR_END", "EXPR_ENDARG", "EXPR_ENDFN", "EXPR_ARG",
"EXPR_CMDARG", "EXPR_MID", "EXPR_FNAME", "EXPR_DOT", "EXPR_CLASS",
- "EXPR_LABEL", "EXPR_LABELED","EXPR_FITEM", "EXPR_EMPTYLN",
+ "EXPR_LABEL", "EXPR_LABELED","EXPR_FITEM",
};
static VALUE
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 776711c8de..4e8ffe56fb 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -981,34 +981,6 @@ eom
assert_syntax_error("a&.x,=0", /multiple assignment destination/)
end
- def test_fluent_dot_with_empty_lines_between
- assert_valid_syntax("a #\n #\n.foo")
- assert_valid_syntax("a #\n #\n&.foo")
- assert_valid_syntax("a\n\n.foo")
- assert_valid_syntax("a \n \n &.foo")
-
- src = <<~RUBY
- def m
- # c
-
- x
- end
- RUBY
- tokens = [
- [:on_kw, "def", ], # EXPR_FNAME],
- [:on_sp, " ", ], # EXPR_FNAME],
- [:on_ident, "m", ], # EXPR_ENDFN],
- [:on_nl, "\n", ], # EXPR_BEG],
- [:on_comment, " # c\n", ], # EXPR_EMPTYLN],
- [:on_sp, " ", ], # EXPR_BEG],
- [:on_ident, "x", ], # EXPR_CMDARG],
- [:on_nl, "\n", ], # EXPR_BEG],
- [:on_kw, "end", ], # EXPR_END],
- [:on_nl, "\n", ], # EXPR_BEG],
- ]
- assert_tokens tokens, src
- end
-
def test_no_warning_logop_literal
assert_warning("") do
eval("true||raise;nil")
@@ -1425,17 +1397,6 @@ eom
assert_equal(expected, @result, message)
end
- def assert_tokens(expected, src, message = nil)
- begin
- require 'ripper'
- actual = Ripper.lex(src).map { |_position, type, value, _state| [type, value] }
- assert_equal(expected, actual, message)
- rescue Exception => err
- puts err
- exit! 1
- end
- end
-
def make_tmpsrc(f, src)
f.open
f.truncate(0)