Project

General

Profile

Feature #14240 » warn-5-gvars-v2.patch

jeremyevans0 (Jeremy Evans), 07/29/2019 07:03 PM

View differences:

ext/ripper/tools/preproc.rb
while line = f.gets
case line
when /\A%%/
out << '%%' << $/
out << "%%\n"
return
when /\A%token/
out << line.sub(/<\w+>/, '<val>')
......
while line = f.gets
case line
when %r</\*% *ripper(?:\[(.*?)\])?: *(.*?) *%\*/>
out << DSL.new($2, ($1 || "").split(",")).generate << $/
out << DSL.new($2, ($1 || "").split(",")).generate << "\n"
when %r</\*%%%\*/>
out << '#if 0' << $/
out << "#if 0\n"
when %r</\*%>
out << '#endif' << $/
out << "#endif\n"
when %r<%\*/>
out << $/
out << "\n"
when /\A%%/
out << '%%' << $/
out << "%%\n"
return
else
out << line
parse.y
pushback(p, c);
c = '_';
/* fall through */
case '/': /* $/: input record separator */
case '\\': /* $\: output record separator */
case ';': /* $;: field separator */
case ',': /* $,: output field separator */
case '.': /* $.: last read line number */
if (c != '_' && strcmp(p->ruby_sourcefile, "-e")) {
rb_compile_warn(p->ruby_sourcefile, p->ruby_sourceline,
"global variable $%c is deprecated", c);
}
/* fall through */
case '~': /* $~: match-data */
case '*': /* $*: argv */
case '$': /* $$: pid */
case '?': /* $?: last status */
case '!': /* $!: error string */
case '@': /* $@: error position */
case '/': /* $/: input record separator */
case '\\': /* $\: output record separator */
case ';': /* $;: field separator */
case ',': /* $,: output field separator */
case '.': /* $.: last read line number */
case '=': /* $=: ignorecase */
case ':': /* $:: load path */
case '<': /* $<: reading filename */
template/encdb.h.tmpl
else
name = $1
end
check_duplication(defs, $1, fn, $.)
check_duplication(defs, $1, fn, f.line_no)
next if BUILTIN_ENCODINGS[name]
encodings << $1
count += 1
......
when /^ENC_REPLICATE\(\s*"([^"]+)"\s*,\s*"([^"]+)"/
raise ArgumentError,
'%s:%d: ENC_REPLICATE: %s is not defined yet. (replica %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
[fn, f.lineno, $2, $1] unless defs[$2.upcase]
count += 1
when /^ENC_ALIAS\(\s*"([^"]+)"\s*,\s*"([^"]+)"/
raise ArgumentError,
'%s:%d: ENC_ALIAS: %s is not defined yet. (alias %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
[fn, f.lineno, $2, $1] unless defs[$2.upcase]
when /^ENC_DUMMY\w*\(\s*"([^"]+)"/
count += 1
else
next
end
check_duplication(defs, $1, fn, $.)
check_duplication(defs, $1, fn, f.lineno)
lines << line.sub(/;.*/m, "").chomp + ";" if line
end
end
template/transdb.h.tmpl
from_to = "%s to %s" % [$1, $2]
if converters[from_to]
raise ArgumentError, '%s:%d: transcode "%s" is already registered at %s:%d' %
[path, $., from_to, *converters[from_to].values_at(3, 4)]
[path, f.lineno, from_to, *converters[from_to].values_at(3, 4)]
else
converters[from_to] = [$1, $2, fn[0..-3], path, $.]
converters[from_to] = [$1, $2, fn[0..-3], path, f.lineno]
converter_list << from_to
end
end
test/ruby/test_syntax.rb
end
end
def test_deprecated_global_variable
assert_warn(/global variable \$; is deprecated/) { eval('$;') }
assert_warn(/global variable \$, is deprecated/) { eval('$,') }
assert_warn(/global variable \$\/ is deprecated/) { eval('$/') }
assert_warn(/global variable \$\\ is deprecated/) { eval('$\\') }
assert_warn(/global variable \$\. is deprecated/) { eval('$.') }
assert_no_warning(/global variable \$; is deprecated/) { eval('$;', binding, '-e') }
assert_no_warning(/global variable \$, is deprecated/) { eval('$,', binding, '-e') }
assert_no_warning(/global variable \$\/ is deprecated/) { eval('$/', binding, '-e') }
assert_no_warning(/global variable \$\\ is deprecated/) { eval('$\\', binding, '-e') }
assert_no_warning(/global variable \$\. is deprecated/) { eval('$.', binding, '-e') }
end
Bug7559 = '[ruby-dev:46737]'
def test_lineno_command_call_quote
(2-2/3)