summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2020-01-20 16:53:31 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-20 16:58:58 +0900
commit9f99760dafac6eaa53287470b8ff59b1be0bf6d6 (patch)
treecdf96ad34f8e0c4add4af206fc710ea2201be3fe /template
parentf31b90f2b99b04dc9e003436a39fd08732eef004 (diff)
Get rid of use of special variables
Use `"\n"` and `IO#fileno` instead of `$/` and `$.` respectively. [Feature #14240]
Diffstat (limited to 'template')
-rw-r--r--template/encdb.h.tmpl8
-rw-r--r--template/transdb.h.tmpl4
2 files changed, 6 insertions, 6 deletions
diff --git a/template/encdb.h.tmpl b/template/encdb.h.tmpl
index 06afb5dbe1..b3bd54548a 100644
--- a/template/encdb.h.tmpl
+++ b/template/encdb.h.tmpl
@@ -58,7 +58,7 @@ encdirs.each do |encdir|
else
name = $1
end
- check_duplication(defs, $1, fn, $.)
+ check_duplication(defs, $1, fn, f.lineno)
next if BUILTIN_ENCODINGS[name]
encodings << $1
count += 1
@@ -71,18 +71,18 @@ encdirs.each do |encdir|
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
diff --git a/template/transdb.h.tmpl b/template/transdb.h.tmpl
index 16565dd638..990a8639d0 100644
--- a/template/transdb.h.tmpl
+++ b/template/transdb.h.tmpl
@@ -44,9 +44,9 @@ transdirs.each do |transdir|
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