Revert github/pull/2230, commit miss

This commit is contained in:
Nobuyoshi Nakada 2019-06-15 12:04:16 +09:00
Родитель 6fa4c90448
Коммит 5d79054906
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4BC7D6DF58D8DF60
2 изменённых файлов: 1 добавлений и 47 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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)