From 246c76e261ee033210527cfcd37c8eb4bfe680c7 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Fri, 15 May 2020 18:04:57 +0900 Subject: 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 --- Rakefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'Rakefile') 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 -- cgit v1.2.3