summaryrefslogtreecommitdiffhomepage
path: root/Rakefile
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-05-15 18:04:57 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 16:20:53 +0900
commit246c76e261ee033210527cfcd37c8eb4bfe680c7 (patch)
treee762576d908e093025eb22404344dbed5842a8eb /Rakefile
parent6128ae61a81d12892eac5397af74e4ce6ab99b06 (diff)
downloadmruby-246c76e261ee033210527cfcd37c8eb4bfe680c7.tar.gz
mruby-246c76e261ee033210527cfcd37c8eb4bfe680c7.zip
Rename `MRB_OPSYM()` to `MRB_QSYM()`.
Where `QSYM` means quoted symbols, which cannot be represented C symbols, so specify aliases instead. - operators: name of the operation, e.g. add for `+` - predicates: add `_p` suffix instead of `?` - bang methods: add `_b` suffix instead of `!` - instance variables: add `a_` prefix instead of `@` - global variables: add `d_` prefix instead of `@` - class variables: unsupported; don't use them
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile16
1 files changed, 14 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index f4a5c7573..9de12fb57 100644
--- a/Rakefile
+++ b/Rakefile
@@ -173,13 +173,25 @@ file presym_inc => presym_file do
"~" => "neg",
}
f.print "/* MRB_PRESYM_CSYM(sym, num) - symbol which is valid C id name */\n"
- f.print "/* MRB_PRESYM_OPSYM(op, sym, num) - symbol which is an operator id */\n"
+ f.print "/* MRB_PRESYM_QSYM(sym, name, num) - symbol with alias name */\n"
f.print "/* MRB_PRESYM_SYM(sym, num) - symbol which is not valid C id */\n\n"
presyms.each.with_index do |sym,i|
if /\A\w+\Z/ =~ sym
f.print "MRB_PRESYM_CSYM(#{sym}, #{i+1})\n"
elsif op_table.key?(sym)
- f.print "MRB_PRESYM_OPSYM(#{sym}, #{op_table[sym]}, #{i+1})\n"
+ f.print "MRB_PRESYM_QSYM(#{sym}, #{op_table[sym]}, #{i+1})\n"
+ elsif /\?\Z/ =~ sym
+ s = sym.dup; s[-1] = "_p"
+ f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n"
+ elsif /\!\Z/ =~ sym
+ s = sym.dup; s[-1] = "_b"
+ f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n"
+ elsif /\A@/ =~ sym
+ s = sym.dup; s[0] = "a_"
+ f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n"
+ elsif /\A$/ =~ sym
+ s = sym.dup; s[0] = "d_"
+ f.print "MRB_PRESYM_QSYM(#{sym}, #{s}, #{i+1})\n"
else
f.print "MRB_PRESYM_SYM(#{sym}, #{i+1})\n"
end