diff options
| author | Uchio Kondo <[email protected]> | 2020-09-05 08:57:49 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 18:20:20 +0900 |
| commit | 0c242e278d406dd158c0b048c4fdc13c62824827 (patch) | |
| tree | e36875b33ec6e73760d29b2f92ec608210c69723 /Rakefile | |
| parent | 932b93fd12a3da6748b21ce74caf998a6d97cdbd (diff) | |
| download | mruby-0c242e278d406dd158c0b048c4fdc13c62824827.tar.gz mruby-0c242e278d406dd158c0b048c4fdc13c62824827.zip | |
Ensure exact match for symbols like foo!/foo?/foo=
e.g. symbols like "foo[]=" make invalid C codes
Diffstat (limited to 'Rakefile')
| -rw-r--r-- | Rakefile | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -174,7 +174,7 @@ file presym_file => cfiles+rbfiles+psfiles+[__FILE__] do src.scan(/mrb_define_global_const\([^\n"]*"([^\n"]*)"/), src.scan(/MRB_SYM\((\w+)\)/), src.scan(/MRB_QSYM\((\w+)\)/).map{|x,| - x.sub!(/_p$/, "?") || x.sub!(/_b$/, "!") || x.sub!(/_e$/, "=") || x.sub!(/^0_/, "@") || x.sub!(/^00_/, "@@") + x.sub!(/_p$/, "?") || x.sub!(/_b$/, "!") || x.sub!(/_e$/, "=") || x.sub!(/^0_/, "@") || x.sub!(/^00_/, "@@") }.compact] end rbsymbols = rbfiles.map do |f| @@ -219,13 +219,13 @@ file presym_inc => presym_file do f.print "MRB_PRESYM_CSYM(#{sym}, #{i+1})\n" elsif op_table.key?(sym) f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{op_table[sym]}, #{i+1})\n" - elsif /\?\Z/ =~ sym + elsif /\A\w+\?\Z/ =~ sym s = sym.dup; s[-1] = "_p" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n" - elsif /\!\Z/ =~ sym + elsif /\A\w+\!\Z/ =~ sym s = sym.dup; s[-1] = "_b" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n" - elsif /\=\Z/ =~ sym + elsif /\A\w+\=\Z/ =~ sym s = sym.dup; s[-1] = "_e" f.print "MRB_PRESYM_QSYM(\"#{sym}\", #{s}, #{i+1})\n" elsif /\A@@/ =~ sym |
