adlint 2.6.14 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +1 -3
- data/ChangeLog +511 -0
- data/INSTALL +1 -1
- data/MANIFEST +57 -37
- data/NEWS +36 -7
- data/README +2 -2
- data/Rakefile +6 -6
- data/TODO +1 -1
- data/bin/adlint +25 -16
- data/bin/adlint_chk +22 -12
- data/bin/adlint_cma +17 -12
- data/bin/adlint_sma +22 -12
- data/bin/adlintize +98 -17
- data/etc/conf.d/fallback/cinit.erb +1 -1
- data/etc/conf.d/fallback/traits.erb +37 -37
- data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +41 -41
- data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +40 -40
- data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +40 -40
- data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +40 -40
- data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
- data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
- data/etc/conf.d/noarch/pinit.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
- data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +42 -42
- data/etc/mesg.d/c_builtin/en_US/messages.yml +33 -33
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +5 -5
- data/etc/mesg.d/core/en_US/messages.yml +2 -2
- data/etc/mesg.d/core/ja_JP/messages.yml +2 -2
- data/features/code_check/W0018.feature +197 -0
- data/features/code_check/W0019.feature +79 -0
- data/features/code_check/W0021.feature +81 -0
- data/features/code_check/W0023.feature +203 -0
- data/features/code_check/W0024.feature +226 -0
- data/features/code_check/W0025.feature +5 -0
- data/features/code_check/W0088.feature +2 -2
- data/features/code_check/W0109.feature +2 -2
- data/features/code_check/W0477.feature +0 -3
- data/features/code_check/W0478.feature +0 -1
- data/features/code_check/W0582.feature +3 -3
- data/features/code_check/W0583.feature +4 -7
- data/features/code_check/W0646.feature +0 -1
- data/features/code_check/W0695.feature +0 -1
- data/features/code_check/W0705.feature +8 -0
- data/features/code_check/W0723.feature +0 -1
- data/features/code_check/W0745.feature +1 -0
- data/features/code_check/W0781.feature +1 -0
- data/features/code_check/W1057.feature +141 -0
- data/features/code_check/W1058.feature +93 -0
- data/features/code_check/W1059.feature +86 -0
- data/features/code_check/W1060.feature +77 -0
- data/features/code_check/W1061.feature +143 -0
- data/features/code_check/W1062.feature +162 -0
- data/features/code_check/W1063.feature +123 -0
- data/features/code_check/W1064.feature +83 -0
- data/features/code_check/W1065.feature +82 -0
- data/features/code_check/W9003.feature +2 -0
- data/features/step_definitions/code_check_steps.rb +1 -0
- data/features/support/env.rb +16 -13
- data/lib/adlint.rb +7 -4
- data/lib/adlint/analyzer.rb +131 -157
- data/lib/adlint/annot.rb +149 -0
- data/lib/adlint/cc1.rb +57 -0
- data/lib/adlint/{c → cc1}/branch.rb +74 -62
- data/lib/adlint/{c → cc1}/builtin.rb +21 -21
- data/lib/adlint/{c → cc1}/const.rb +119 -117
- data/lib/adlint/{c → cc1}/conv.rb +76 -78
- data/lib/adlint/{c → cc1}/ctrlexpr.rb +69 -86
- data/lib/adlint/cc1/domain.rb +8103 -0
- data/lib/adlint/{c → cc1}/enum.rb +3 -3
- data/lib/adlint/{c → cc1}/environ.rb +21 -21
- data/lib/adlint/{c → cc1}/expr.rb +232 -218
- data/lib/adlint/{c → cc1}/format.rb +305 -342
- data/lib/adlint/{c → cc1}/interp.rb +269 -220
- data/lib/adlint/cc1/lexer.rb +246 -0
- data/lib/adlint/{c → cc1}/mediator.rb +78 -84
- data/lib/adlint/{c → cc1}/object.rb +261 -264
- data/lib/adlint/{c → cc1}/operator.rb +7 -7
- data/lib/adlint/{c → cc1}/option.rb +4 -3
- data/lib/adlint/{c → cc1}/parser.rb +274 -506
- data/lib/adlint/{c → cc1}/parser.y +69 -301
- data/lib/adlint/cc1/phase.rb +138 -0
- data/lib/adlint/{c → cc1}/resolver.rb +66 -78
- data/lib/adlint/{c → cc1}/scanner.rb +57 -49
- data/lib/adlint/{c → cc1}/scope.rb +3 -3
- data/lib/adlint/{c → cc1}/seqp.rb +13 -5
- data/lib/adlint/{c → cc1}/syntax.rb +819 -1122
- data/lib/adlint/{c → cc1}/type.rb +1498 -1479
- data/lib/adlint/{c → cc1}/util.rb +20 -12
- data/lib/adlint/{c → cc1}/value.rb +699 -642
- data/lib/adlint/code.rb +163 -164
- data/lib/adlint/cpp.rb +2 -2
- data/lib/adlint/cpp/asm.rb +13 -14
- data/lib/adlint/cpp/constexpr.rb +42 -38
- data/lib/adlint/cpp/constexpr.y +44 -40
- data/lib/adlint/cpp/eval.rb +435 -435
- data/lib/adlint/cpp/lexer.rb +343 -340
- data/lib/adlint/cpp/macro.rb +188 -190
- data/lib/adlint/cpp/phase.rb +66 -45
- data/lib/adlint/cpp/scanner.rb +14 -17
- data/lib/adlint/cpp/source.rb +49 -55
- data/lib/adlint/cpp/subst.rb +65 -65
- data/lib/adlint/cpp/syntax.rb +155 -275
- data/lib/adlint/cpp/util.rb +22 -19
- data/lib/adlint/driver.rb +86 -93
- data/lib/adlint/error.rb +33 -52
- data/lib/adlint/exam.rb +158 -24
- data/lib/adlint/exam/c_builtin.rb +7 -7
- data/lib/adlint/exam/c_builtin/cc1_check.rb +20522 -0
- data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +957 -0
- data/lib/adlint/exam/c_builtin/cc1_code.rb +459 -0
- data/lib/adlint/exam/c_builtin/cc1_metric.rb +794 -0
- data/lib/adlint/exam/c_builtin/cpp_check.rb +486 -441
- data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +36 -39
- data/lib/adlint/exam/c_builtin/cpp_code.rb +63 -65
- data/lib/adlint/exam/c_builtin/ld_check.rb +136 -129
- data/lib/adlint/exam/c_builtin/ld_metric.rb +11 -11
- data/lib/adlint/lang.rb +25 -25
- data/lib/adlint/ld.rb +2 -2
- data/lib/adlint/ld/object.rb +220 -188
- data/lib/adlint/ld/phase.rb +94 -63
- data/lib/adlint/ld/typedef.rb +22 -11
- data/lib/adlint/ld/util.rb +43 -35
- data/lib/adlint/lexer.rb +59 -56
- data/lib/adlint/location.rb +140 -0
- data/lib/adlint/memo.rb +157 -0
- data/lib/adlint/message.rb +207 -156
- data/lib/adlint/metric.rb +139 -217
- data/lib/adlint/monitor.rb +45 -43
- data/lib/adlint/phase.rb +56 -29
- data/lib/adlint/prelude.rb +66 -54
- data/lib/adlint/report.rb +253 -332
- data/lib/adlint/source.rb +26 -27
- data/lib/adlint/supp.rb +131 -0
- data/lib/adlint/symbol.rb +14 -16
- data/lib/adlint/token.rb +19 -91
- data/lib/adlint/traits.rb +242 -226
- data/lib/adlint/util.rb +116 -205
- data/lib/adlint/version.rb +8 -8
- data/share/HEADER +2 -2
- data/share/doc/developers_guide_ja.html +148 -19
- data/share/doc/developers_guide_ja.texi +141 -11
- data/share/doc/samples/GNUmakefile +1 -1
- data/share/doc/samples/adlint_traits.yml +45 -36
- data/share/doc/users_guide_en.html +1321 -1252
- data/share/doc/users_guide_en.texi +475 -408
- data/share/doc/users_guide_ja.html +1932 -1878
- data/share/doc/users_guide_ja.texi +324 -273
- data/share/sample/bison-2.5/adlint/GNUmakefile +5 -1
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +38 -38
- data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +50 -42
- data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +50 -42
- data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +50 -42
- data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +46 -38
- data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +50 -42
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +50 -42
- data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +50 -42
- data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +49 -41
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +46 -38
- data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +50 -42
- data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +50 -42
- data/spec/adlint/{c → cc1}/ctrlexpr_spec.rb +51 -49
- data/spec/adlint/{c → cc1}/domain_spec.rb +210 -179
- data/spec/adlint/{c → cc1}/operator_spec.rb +3 -3
- data/spec/adlint/{c → cc1}/syntax_spec.rb +10 -12
- data/spec/adlint/{c → cc1}/type_spec.rb +61 -68
- data/{lib/adlint/c.rb → spec/adlint/location_spec.rb} +24 -29
- data/spec/conf.d/default_traits.yml +38 -37
- data/spec/conf.d/empty_cinit.h +1 -1
- data/spec/conf.d/empty_pinit.h +1 -1
- data/spec/conf.d/project/foo.c +0 -0
- data/spec/spec_helper.rb +2 -2
- metadata +60 -40
- data/lib/adlint/c/domain.rb +0 -7931
- data/lib/adlint/c/lexer.rb +0 -252
- data/lib/adlint/c/phase.rb +0 -135
- data/lib/adlint/exam/c_builtin/c_check.rb +0 -20745
- data/lib/adlint/exam/c_builtin/c_check_shima.rb +0 -983
- data/lib/adlint/exam/c_builtin/c_code.rb +0 -477
- data/lib/adlint/exam/c_builtin/c_metric.rb +0 -818
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Format of the formatted input/output functions.
|
|
2
2
|
#
|
|
3
3
|
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
4
|
-
# Copyright:: Copyright (C) 2010-
|
|
4
|
+
# Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
5
5
|
# License:: GPLv3+: GNU General Public License version 3 or later
|
|
6
6
|
#
|
|
7
7
|
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
|
12
12
|
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
|
13
13
|
# / __ |/ /_/ / /___/ / /| / / /
|
|
14
|
-
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-
|
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
|
|
15
15
|
#
|
|
16
16
|
# This file is part of AdLint.
|
|
17
17
|
#
|
|
@@ -29,15 +29,15 @@
|
|
|
29
29
|
#
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
|
-
require "adlint/
|
|
32
|
+
require "adlint/cc1/mediator"
|
|
33
33
|
|
|
34
34
|
module AdLint #:nodoc:
|
|
35
|
-
module
|
|
35
|
+
module Cc1 #:nodoc:
|
|
36
36
|
|
|
37
37
|
class PrintfFormat
|
|
38
|
-
def initialize(
|
|
39
|
-
@location =
|
|
40
|
-
@directives = create_directives(
|
|
38
|
+
def initialize(fmt_str, loc, trailing_args, env)
|
|
39
|
+
@location = loc
|
|
40
|
+
@directives = create_directives(fmt_str, trailing_args, env)
|
|
41
41
|
@extra_arguments = trailing_args
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -46,65 +46,65 @@ module C #:nodoc:
|
|
|
46
46
|
attr_reader :extra_arguments
|
|
47
47
|
|
|
48
48
|
def conversion_specifiers
|
|
49
|
-
@directives.select { |
|
|
49
|
+
@directives.select { |dire| dire.conversion_specifier? }
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def min_length
|
|
53
|
-
@directives.reduce(0) { |len,
|
|
53
|
+
@directives.reduce(0) { |len, dire| len + dire.min_length }
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def max_length
|
|
57
|
-
@directives.reduce(0) { |len,
|
|
57
|
+
@directives.reduce(0) { |len, dire| len + dire.max_length }
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
private
|
|
61
|
-
def create_directives(
|
|
62
|
-
|
|
63
|
-
str =
|
|
61
|
+
def create_directives(fmt_str, trailing_args, env)
|
|
62
|
+
dires = []
|
|
63
|
+
str = fmt_str.dup
|
|
64
64
|
until str.empty?
|
|
65
|
-
|
|
65
|
+
dires.push(Directive.guess(str, trailing_args, env))
|
|
66
66
|
end
|
|
67
|
-
|
|
67
|
+
dires
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# == DESCRIPTION
|
|
71
71
|
# === Directive class hierarchy
|
|
72
72
|
# Directive
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
#
|
|
98
|
-
#
|
|
99
|
-
#
|
|
73
|
+
# <-- Ordinary
|
|
74
|
+
# <-- ConversionSpecifier
|
|
75
|
+
# <-- CompleteConversionSpecifier
|
|
76
|
+
# <-- NumberConversionSpecifier
|
|
77
|
+
# <-- Conversion_d
|
|
78
|
+
# <-- Conversion_i
|
|
79
|
+
# <-- Conversion_o
|
|
80
|
+
# <-- Conversion_u
|
|
81
|
+
# <-- Conversion_x
|
|
82
|
+
# <-- Conversion_X
|
|
83
|
+
# <-- Conversion_f
|
|
84
|
+
# <-- Conversion_F
|
|
85
|
+
# <-- Conversion_e
|
|
86
|
+
# <-- Conversion_E
|
|
87
|
+
# <-- Conversion_g
|
|
88
|
+
# <-- Conversion_G
|
|
89
|
+
# <-- Conversion_a
|
|
90
|
+
# <-- Conversion_A
|
|
91
|
+
# <-- Conversion_p
|
|
92
|
+
# <-- CharacterConversionSpecifier
|
|
93
|
+
# <-- Conversion_c
|
|
94
|
+
# <-- StringConversionSpecifier
|
|
95
|
+
# <-- Conversion_s
|
|
96
|
+
# <-- Conversion_n
|
|
97
|
+
# <-- Conversion_percent
|
|
98
|
+
# <-- UndefinedConversionSpecifier
|
|
99
|
+
# <-- IncompleteConversionSpecifier
|
|
100
100
|
class Directive
|
|
101
|
-
def self.guess(
|
|
102
|
-
try_to_create_ordinary(
|
|
103
|
-
try_to_create_conversion_specifier(
|
|
101
|
+
def self.guess(fmt_str, trailing_args, env)
|
|
102
|
+
try_to_create_ordinary(fmt_str) or
|
|
103
|
+
try_to_create_conversion_specifier(fmt_str, trailing_args, env)
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
def initialize(
|
|
107
|
-
@format =
|
|
106
|
+
def initialize(fmt, consume_args)
|
|
107
|
+
@format = fmt
|
|
108
108
|
@consume_arguments = consume_args
|
|
109
109
|
end
|
|
110
110
|
|
|
@@ -205,26 +205,25 @@ module C #:nodoc:
|
|
|
205
205
|
subclass_responsibility
|
|
206
206
|
end
|
|
207
207
|
|
|
208
|
-
def self.try_to_create_ordinary(
|
|
209
|
-
(
|
|
208
|
+
def self.try_to_create_ordinary(fmt_str)
|
|
209
|
+
(fmt = Ordinary.scan(fmt_str)) ? Ordinary.new(fmt) : nil
|
|
210
210
|
end
|
|
211
211
|
private_class_method :try_to_create_ordinary
|
|
212
212
|
|
|
213
|
-
def self.try_to_create_conversion_specifier(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
ConversionSpecifier.scan(format_str)
|
|
213
|
+
def self.try_to_create_conversion_specifier(fmt_str, trailing_args, env)
|
|
214
|
+
fmt, flags, field_width, prec, len_mod, cs_char =
|
|
215
|
+
ConversionSpecifier.scan(fmt_str)
|
|
217
216
|
|
|
218
217
|
case
|
|
219
218
|
when cs_char.nil?
|
|
220
|
-
IncompleteConversionSpecifier.new(
|
|
221
|
-
|
|
219
|
+
IncompleteConversionSpecifier.new(fmt, flags, field_width, prec,
|
|
220
|
+
len_mod)
|
|
222
221
|
when cs_class = CONVERSION_SPECIFIER_TBL[cs_char]
|
|
223
|
-
cs_class.new(
|
|
224
|
-
|
|
222
|
+
cs_class.new(fmt, trailing_args, env, flags, field_width, prec,
|
|
223
|
+
len_mod, cs_char)
|
|
225
224
|
else
|
|
226
|
-
UndefinedConversionSpecifier.new(
|
|
227
|
-
|
|
225
|
+
UndefinedConversionSpecifier.new(fmt, flags, field_width, prec,
|
|
226
|
+
len_mod, cs_char)
|
|
228
227
|
end
|
|
229
228
|
end
|
|
230
229
|
private_class_method :try_to_create_conversion_specifier
|
|
@@ -232,7 +231,7 @@ module C #:nodoc:
|
|
|
232
231
|
private_constant :Directive
|
|
233
232
|
|
|
234
233
|
class Ordinary < Directive
|
|
235
|
-
def self.scan(
|
|
234
|
+
def self.scan(fmt_str)
|
|
236
235
|
# NOTE: The ISO C99 standard says;
|
|
237
236
|
#
|
|
238
237
|
# 7.19.6.1 The fprintf function
|
|
@@ -245,11 +244,11 @@ module C #:nodoc:
|
|
|
245
244
|
# subsequent arguments, converting them, if applicable, according to
|
|
246
245
|
# the corresponding conversion specifier, and then writing the result
|
|
247
246
|
# to the output stream.
|
|
248
|
-
|
|
247
|
+
fmt_str.slice!(/\A[^%]+/)
|
|
249
248
|
end
|
|
250
249
|
|
|
251
|
-
def initialize(
|
|
252
|
-
super(
|
|
250
|
+
def initialize(fmt)
|
|
251
|
+
super(fmt, false)
|
|
253
252
|
end
|
|
254
253
|
|
|
255
254
|
def conversion_specifier?
|
|
@@ -337,7 +336,7 @@ module C #:nodoc:
|
|
|
337
336
|
include TypeTableMediator
|
|
338
337
|
include MemoryPoolMediator
|
|
339
338
|
|
|
340
|
-
def self.scan(
|
|
339
|
+
def self.scan(fmt_str)
|
|
341
340
|
# NOTE: The ISO C99 standard says;
|
|
342
341
|
#
|
|
343
342
|
# 7.19.6.1 The fprintf function
|
|
@@ -369,51 +368,50 @@ module C #:nodoc:
|
|
|
369
368
|
# -- A conversion specifier character that specifies the type of
|
|
370
369
|
# conversion to be applied.
|
|
371
370
|
|
|
372
|
-
if header =
|
|
371
|
+
if header = fmt_str.slice!(/\A%/)
|
|
373
372
|
scanned = header
|
|
374
373
|
else
|
|
375
374
|
return nil, nil, nil, nil, nil, nil
|
|
376
375
|
end
|
|
377
376
|
|
|
378
|
-
if flags =
|
|
377
|
+
if flags = fmt_str.slice!(/\A#{flags_re}/)
|
|
379
378
|
scanned += flags
|
|
380
379
|
end
|
|
381
380
|
|
|
382
|
-
if field_width =
|
|
381
|
+
if field_width = fmt_str.slice!(/\A#{field_width_re}/)
|
|
383
382
|
scanned += field_width
|
|
384
383
|
end
|
|
385
384
|
|
|
386
|
-
if
|
|
387
|
-
scanned +=
|
|
385
|
+
if prec = fmt_str.slice!(/\A#{precision_re}/)
|
|
386
|
+
scanned += prec
|
|
388
387
|
end
|
|
389
388
|
|
|
390
|
-
if
|
|
391
|
-
scanned +=
|
|
389
|
+
if len_mod = fmt_str.slice!(/\A#{length_modifier_re}/)
|
|
390
|
+
scanned += len_mod
|
|
392
391
|
end
|
|
393
392
|
|
|
394
|
-
if cs_char =
|
|
393
|
+
if cs_char = fmt_str.slice!(/\A#{cs_char_re}/)
|
|
395
394
|
scanned += cs_char
|
|
396
395
|
else
|
|
397
396
|
# NOTE: If no valid conversion specifier character, force to scan
|
|
398
397
|
# the heading 1 character as a conversion specifier character.
|
|
399
|
-
if cs_char =
|
|
398
|
+
if cs_char = fmt_str.slice!(/\A[a-z]/i)
|
|
400
399
|
scanned += cs_char
|
|
401
400
|
end
|
|
402
401
|
end
|
|
403
402
|
|
|
404
|
-
return scanned, flags, field_width,
|
|
403
|
+
return scanned, flags, field_width, prec, len_mod, cs_char
|
|
405
404
|
end
|
|
406
405
|
|
|
407
|
-
def initialize(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
super(format, consume_args)
|
|
406
|
+
def initialize(fmt, trailing_args, env, consume_args, flags, field_width,
|
|
407
|
+
prec, len_mod, cs_char)
|
|
408
|
+
super(fmt, consume_args)
|
|
411
409
|
|
|
412
410
|
@flags = flags
|
|
413
411
|
@field_width = field_width
|
|
414
|
-
@precision =
|
|
415
|
-
@length_modifier =
|
|
416
|
-
@conversion_specifier_character =
|
|
412
|
+
@precision = prec
|
|
413
|
+
@length_modifier = len_mod
|
|
414
|
+
@conversion_specifier_character = cs_char
|
|
417
415
|
|
|
418
416
|
if consume_arguments? && @field_width == "*"
|
|
419
417
|
@field_width_argument = trailing_args.shift
|
|
@@ -433,7 +431,7 @@ module C #:nodoc:
|
|
|
433
431
|
@conversion_argument = nil
|
|
434
432
|
end
|
|
435
433
|
|
|
436
|
-
@environment =
|
|
434
|
+
@environment = env
|
|
437
435
|
end
|
|
438
436
|
|
|
439
437
|
def conversion_specifier?
|
|
@@ -747,13 +745,13 @@ module C #:nodoc:
|
|
|
747
745
|
"%#{flags}#{fw}#{pr}#{conversion_specifier_character}"
|
|
748
746
|
end
|
|
749
747
|
|
|
750
|
-
|
|
751
|
-
@environment.type_table
|
|
752
|
-
end
|
|
748
|
+
extend Forwardable
|
|
753
749
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
750
|
+
def_delegator :@environment, :type_table
|
|
751
|
+
private :type_table
|
|
752
|
+
|
|
753
|
+
def_delegator :@environment, :memory_pool
|
|
754
|
+
private :memory_pool
|
|
757
755
|
end
|
|
758
756
|
private_constant :ConversionSpecifier
|
|
759
757
|
|
|
@@ -765,15 +763,15 @@ module C #:nodoc:
|
|
|
765
763
|
# Boolean -- True if types of arguments match this directive.
|
|
766
764
|
def acceptable?
|
|
767
765
|
if @field_width_argument
|
|
768
|
-
unless @field_width_argument.type.convertible?(
|
|
769
|
-
@field_width_argument.type.convertible?(
|
|
766
|
+
unless @field_width_argument.type.convertible?(signed_int_t) ||
|
|
767
|
+
@field_width_argument.type.convertible?(unsigned_int_t)
|
|
770
768
|
return false
|
|
771
769
|
end
|
|
772
770
|
end
|
|
773
771
|
|
|
774
772
|
if @precision_argument
|
|
775
|
-
unless @precision_argument.type.convertible?(
|
|
776
|
-
@precision_argument.type.convertible?(
|
|
773
|
+
unless @precision_argument.type.convertible?(signed_int_t) ||
|
|
774
|
+
@precision_argument.type.convertible?(unsigned_int_t)
|
|
777
775
|
return false
|
|
778
776
|
end
|
|
779
777
|
end
|
|
@@ -838,12 +836,10 @@ module C #:nodoc:
|
|
|
838
836
|
private_constant :CompleteConversionSpecifier
|
|
839
837
|
|
|
840
838
|
class NumberConversionSpecifier < CompleteConversionSpecifier
|
|
841
|
-
def initialize(
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
flags, field_width, precision, length_modifier,
|
|
846
|
-
conversion_specifier_character)
|
|
839
|
+
def initialize(fmt, trailing_args, env, flags, field_width, prec,
|
|
840
|
+
len_mod, cs_char)
|
|
841
|
+
super(fmt, trailing_args, env, true, flags, field_width, prec, len_mod,
|
|
842
|
+
cs_char)
|
|
847
843
|
end
|
|
848
844
|
|
|
849
845
|
def valid_conversion_specifier_character?
|
|
@@ -852,15 +848,15 @@ module C #:nodoc:
|
|
|
852
848
|
|
|
853
849
|
def min_length
|
|
854
850
|
# NOTE: Ruby has the buitin mostly C compliant sprintf.
|
|
855
|
-
|
|
851
|
+
(ruby_sprintf_format % 0).length
|
|
856
852
|
end
|
|
857
853
|
|
|
858
854
|
def max_length
|
|
859
855
|
# NOTE: Ruby has the buitin mostly C compliant sprintf.
|
|
860
856
|
if conversion_type.signed?
|
|
861
|
-
|
|
857
|
+
(ruby_sprintf_format % conversion_type.min).length
|
|
862
858
|
else
|
|
863
|
-
|
|
859
|
+
(ruby_sprintf_format % conversion_type.max).length
|
|
864
860
|
end
|
|
865
861
|
end
|
|
866
862
|
|
|
@@ -951,24 +947,24 @@ module C #:nodoc:
|
|
|
951
947
|
# specifier applies to a pointer to a ptrdiff_t argument.
|
|
952
948
|
case length_modifier
|
|
953
949
|
when "hh"
|
|
954
|
-
[
|
|
950
|
+
[signed_char_t, unsigned_char_t]
|
|
955
951
|
when "h"
|
|
956
|
-
[
|
|
952
|
+
[signed_short_t, unsigned_short_t]
|
|
957
953
|
when "l"
|
|
958
|
-
[
|
|
954
|
+
[signed_long_t, unsigned_long_t]
|
|
959
955
|
when "ll"
|
|
960
|
-
[
|
|
956
|
+
[signed_long_long_t, unsigned_long_long_t]
|
|
961
957
|
when "j"
|
|
962
958
|
# FIXME: `intmax_t' and `uintmax_t' are not supported yet.
|
|
963
|
-
[
|
|
959
|
+
[signed_long_long_t, unsigned_long_long_t]
|
|
964
960
|
when "z"
|
|
965
961
|
# FIXME: `size_t' is not supported yet.
|
|
966
|
-
[
|
|
962
|
+
[unsigned_long_t]
|
|
967
963
|
when "t"
|
|
968
964
|
# FIXME: `ptrdiff_t' is not supported yet.
|
|
969
|
-
[
|
|
965
|
+
[signed_int_t]
|
|
970
966
|
else
|
|
971
|
-
[
|
|
967
|
+
[signed_int_t, unsigned_int_t]
|
|
972
968
|
end
|
|
973
969
|
end
|
|
974
970
|
|
|
@@ -980,48 +976,48 @@ module C #:nodoc:
|
|
|
980
976
|
case length_modifier
|
|
981
977
|
when "hh"
|
|
982
978
|
if conversion_argument && conversion_argument.type.signed?
|
|
983
|
-
|
|
979
|
+
signed_char_t
|
|
984
980
|
else
|
|
985
|
-
|
|
981
|
+
unsigned_char_t
|
|
986
982
|
end
|
|
987
983
|
when "h"
|
|
988
984
|
if conversion_argument && conversion_argument.type.signed?
|
|
989
|
-
|
|
985
|
+
signed_short_t
|
|
990
986
|
else
|
|
991
|
-
|
|
987
|
+
unsigned_short_t
|
|
992
988
|
end
|
|
993
989
|
when "l"
|
|
994
990
|
if conversion_argument && conversion_argument.type.signed?
|
|
995
|
-
|
|
991
|
+
signed_long_t
|
|
996
992
|
else
|
|
997
|
-
|
|
993
|
+
unsigned_long_t
|
|
998
994
|
end
|
|
999
995
|
when "ll"
|
|
1000
996
|
if conversion_argument && conversion_argument.type.signed?
|
|
1001
|
-
|
|
997
|
+
signed_long_long_t
|
|
1002
998
|
else
|
|
1003
|
-
|
|
999
|
+
unsigned_long_long_t
|
|
1004
1000
|
end
|
|
1005
1001
|
when "j"
|
|
1006
1002
|
# FIXME: `intmax_t' and `uintmax_t' are not supported yet.
|
|
1007
1003
|
if conversion_argument && conversion_argument.type.signed?
|
|
1008
|
-
|
|
1004
|
+
signed_long_long_t
|
|
1009
1005
|
else
|
|
1010
|
-
|
|
1006
|
+
unsigned_long_long_t
|
|
1011
1007
|
end
|
|
1012
1008
|
when "z"
|
|
1013
1009
|
# FIXME: `size_t' is not supported yet.
|
|
1014
|
-
|
|
1010
|
+
unsigned_long_t
|
|
1015
1011
|
when "t"
|
|
1016
1012
|
# FIXME: `ptrdiff_t' is not supported yet.
|
|
1017
|
-
|
|
1013
|
+
signed_int_t
|
|
1018
1014
|
else
|
|
1019
1015
|
default_conversion_type
|
|
1020
1016
|
end
|
|
1021
1017
|
end
|
|
1022
1018
|
|
|
1023
1019
|
def default_conversion_type
|
|
1024
|
-
|
|
1020
|
+
signed_int_t
|
|
1025
1021
|
end
|
|
1026
1022
|
end
|
|
1027
1023
|
private_constant :Conversion_d
|
|
@@ -1040,7 +1036,7 @@ module C #:nodoc:
|
|
|
1040
1036
|
|
|
1041
1037
|
private
|
|
1042
1038
|
def default_conversion_type
|
|
1043
|
-
|
|
1039
|
+
unsigned_int_t
|
|
1044
1040
|
end
|
|
1045
1041
|
end
|
|
1046
1042
|
private_constant :Conversion_o
|
|
@@ -1140,11 +1136,11 @@ module C #:nodoc:
|
|
|
1140
1136
|
# conversion specifier applies to a long double argument.
|
|
1141
1137
|
case length_modifier
|
|
1142
1138
|
when "L"
|
|
1143
|
-
[
|
|
1139
|
+
[long_double_t]
|
|
1144
1140
|
else
|
|
1145
1141
|
# NOTE: The argument will be argument promoted, so float type should
|
|
1146
1142
|
# be acceptable, too.
|
|
1147
|
-
[
|
|
1143
|
+
[float_t, double_t]
|
|
1148
1144
|
end
|
|
1149
1145
|
end
|
|
1150
1146
|
|
|
@@ -1155,9 +1151,9 @@ module C #:nodoc:
|
|
|
1155
1151
|
def conversion_type
|
|
1156
1152
|
case length_modifier
|
|
1157
1153
|
when "L"
|
|
1158
|
-
|
|
1154
|
+
long_double_t
|
|
1159
1155
|
else
|
|
1160
|
-
|
|
1156
|
+
double_t
|
|
1161
1157
|
end
|
|
1162
1158
|
end
|
|
1163
1159
|
end
|
|
@@ -1246,12 +1242,10 @@ module C #:nodoc:
|
|
|
1246
1242
|
private_constant :Conversion_A
|
|
1247
1243
|
|
|
1248
1244
|
class CharacterConversionSpecifier < CompleteConversionSpecifier
|
|
1249
|
-
def initialize(
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
flags, field_width, precision, length_modifier,
|
|
1254
|
-
conversion_specifier_character)
|
|
1245
|
+
def initialize(fmt, trailing_args, env, flags, field_width, prec,
|
|
1246
|
+
len_mod, cs_char)
|
|
1247
|
+
super(fmt, trailing_args, env, true, flags, field_width, prec, len_mod,
|
|
1248
|
+
cs_char)
|
|
1255
1249
|
end
|
|
1256
1250
|
|
|
1257
1251
|
def valid_conversion_specifier_character?
|
|
@@ -1260,7 +1254,7 @@ module C #:nodoc:
|
|
|
1260
1254
|
|
|
1261
1255
|
def min_length
|
|
1262
1256
|
# NOTE: Ruby has the buitin mostly C compliant sprintf.
|
|
1263
|
-
|
|
1257
|
+
(ruby_sprintf_format % " ").length
|
|
1264
1258
|
end
|
|
1265
1259
|
|
|
1266
1260
|
def max_length
|
|
@@ -1297,13 +1291,13 @@ module C #:nodoc:
|
|
|
1297
1291
|
case length_modifier
|
|
1298
1292
|
when "l"
|
|
1299
1293
|
# FIXME: `wint_t' is not supported yet.
|
|
1300
|
-
[
|
|
1294
|
+
[wchar_t]
|
|
1301
1295
|
else
|
|
1302
1296
|
# NOTE: The argument will be integer promoted, so the argument type
|
|
1303
1297
|
# whose conversion-rank is less than one of the int should be
|
|
1304
1298
|
# acceptable, too.
|
|
1305
|
-
[
|
|
1306
|
-
|
|
1299
|
+
[signed_char_t, unsigned_char_t, signed_short_t,
|
|
1300
|
+
unsigned_short_t, signed_int_t, unsigned_int_t]
|
|
1307
1301
|
end
|
|
1308
1302
|
end
|
|
1309
1303
|
|
|
@@ -1314,12 +1308,10 @@ module C #:nodoc:
|
|
|
1314
1308
|
private_constant :Conversion_c
|
|
1315
1309
|
|
|
1316
1310
|
class StringConversionSpecifier < CompleteConversionSpecifier
|
|
1317
|
-
def initialize(
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
flags, field_width, precision, length_modifier,
|
|
1322
|
-
conversion_specifier_character)
|
|
1311
|
+
def initialize(fmt, trailing_args, env, flags, field_width, prec,
|
|
1312
|
+
len_mod, cs_char)
|
|
1313
|
+
super(fmt, trailing_args, env, true, flags, field_width, prec, len_mod,
|
|
1314
|
+
cs_char)
|
|
1323
1315
|
end
|
|
1324
1316
|
|
|
1325
1317
|
def valid_conversion_specifier_character?
|
|
@@ -1328,15 +1320,15 @@ module C #:nodoc:
|
|
|
1328
1320
|
|
|
1329
1321
|
def min_length
|
|
1330
1322
|
# NOTE: Ruby has the buitin mostly C compliant sprintf.
|
|
1331
|
-
|
|
1323
|
+
(ruby_sprintf_format % "").length
|
|
1332
1324
|
end
|
|
1333
1325
|
|
|
1334
1326
|
def max_length
|
|
1335
1327
|
# NOTE: Ruby has the buitin mostly C compliant sprintf.
|
|
1336
1328
|
if conversion_argument && conversion_argument.type.pointer? and
|
|
1337
1329
|
pointee = pointee_of(conversion_argument) and pointee.type.array?
|
|
1338
|
-
|
|
1339
|
-
|
|
1330
|
+
len = pointee.type.length ? pointee.type.length - 1 : 0
|
|
1331
|
+
(ruby_sprintf_format % (" " * len)).length
|
|
1340
1332
|
else
|
|
1341
1333
|
min_length
|
|
1342
1334
|
end
|
|
@@ -1371,10 +1363,10 @@ module C #:nodoc:
|
|
|
1371
1363
|
# or G conversion specifier.
|
|
1372
1364
|
case length_modifier
|
|
1373
1365
|
when "l"
|
|
1374
|
-
[pointer_type(qualified_type(
|
|
1366
|
+
[pointer_type(qualified_type(wchar_t, :const))]
|
|
1375
1367
|
else
|
|
1376
|
-
[pointer_type(qualified_type(
|
|
1377
|
-
pointer_type(qualified_type(
|
|
1368
|
+
[pointer_type(qualified_type(signed_char_t, :const)),
|
|
1369
|
+
pointer_type(qualified_type(unsigned_char_t, :const))]
|
|
1378
1370
|
end
|
|
1379
1371
|
end
|
|
1380
1372
|
|
|
@@ -1392,14 +1384,13 @@ module C #:nodoc:
|
|
|
1392
1384
|
def min_length
|
|
1393
1385
|
# NOTE: `%p' conversion specifier of the Ruby's builtin sprintf does
|
|
1394
1386
|
# not convert the argument.
|
|
1395
|
-
|
|
1387
|
+
("%##{flags}#{field_width}#{precision}x" % 0).length
|
|
1396
1388
|
end
|
|
1397
1389
|
|
|
1398
1390
|
def max_length
|
|
1399
1391
|
# NOTE: `%p' conversion specifier of the Ruby's builtin sprintf does
|
|
1400
1392
|
# not convert the argument.
|
|
1401
|
-
|
|
1402
|
-
conversion_type.max_value).length
|
|
1393
|
+
("%##{flags}#{field_width}#{precision}x" % conversion_type.max).length
|
|
1403
1394
|
end
|
|
1404
1395
|
|
|
1405
1396
|
private
|
|
@@ -1411,7 +1402,7 @@ module C #:nodoc:
|
|
|
1411
1402
|
if conversion_argument && conversion_argument.type.pointer?
|
|
1412
1403
|
[conversion_argument.type.unqualify]
|
|
1413
1404
|
else
|
|
1414
|
-
[pointer_type(qualified_type(
|
|
1405
|
+
[pointer_type(qualified_type(void_t, :const))]
|
|
1415
1406
|
end
|
|
1416
1407
|
end
|
|
1417
1408
|
|
|
@@ -1420,7 +1411,7 @@ module C #:nodoc:
|
|
|
1420
1411
|
end
|
|
1421
1412
|
|
|
1422
1413
|
def conversion_type
|
|
1423
|
-
pointer_type(
|
|
1414
|
+
pointer_type(void_t)
|
|
1424
1415
|
end
|
|
1425
1416
|
end
|
|
1426
1417
|
private_constant :Conversion_p
|
|
@@ -1430,12 +1421,10 @@ module C #:nodoc:
|
|
|
1430
1421
|
"n"
|
|
1431
1422
|
end
|
|
1432
1423
|
|
|
1433
|
-
def initialize(
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
flags, field_width, precision, length_modifier,
|
|
1438
|
-
conversion_specifier_character)
|
|
1424
|
+
def initialize(fmt, trailing_args, env, flags, field_width, prec,
|
|
1425
|
+
len_mod, cs_char)
|
|
1426
|
+
super(fmt, trailing_args, env, true, flags, field_width, prec, len_mod,
|
|
1427
|
+
cs_char)
|
|
1439
1428
|
end
|
|
1440
1429
|
|
|
1441
1430
|
def valid_conversion_specifier_character?
|
|
@@ -1503,24 +1492,24 @@ module C #:nodoc:
|
|
|
1503
1492
|
# specifier applies to a pointer to a ptrdiff_t argument.
|
|
1504
1493
|
case length_modifier
|
|
1505
1494
|
when "hh"
|
|
1506
|
-
[pointer_type(qualified_type(
|
|
1495
|
+
[pointer_type(qualified_type(signed_char_t, :const))]
|
|
1507
1496
|
when "h"
|
|
1508
|
-
[pointer_type(qualified_type(
|
|
1497
|
+
[pointer_type(qualified_type(signed_short_t, :const))]
|
|
1509
1498
|
when "l"
|
|
1510
|
-
[pointer_type(qualified_type(
|
|
1499
|
+
[pointer_type(qualified_type(signed_long_t, :const))]
|
|
1511
1500
|
when "ll"
|
|
1512
|
-
[pointer_type(qualified_type(
|
|
1501
|
+
[pointer_type(qualified_type(signed_long_long_t, :const))]
|
|
1513
1502
|
when "j"
|
|
1514
1503
|
# FIXME: `intmax_t' is not supported yet.
|
|
1515
|
-
[pointer_type(qualified_type(
|
|
1504
|
+
[pointer_type(qualified_type(signed_long_long_t, :const))]
|
|
1516
1505
|
when "z"
|
|
1517
1506
|
# FIXME: `size_t' is not supported yet.
|
|
1518
|
-
[pointer_type(qualified_type(
|
|
1507
|
+
[pointer_type(qualified_type(signed_long_t, :const))]
|
|
1519
1508
|
when "t"
|
|
1520
1509
|
# FIXME: `ptrdiff_t' is not supported yet.
|
|
1521
|
-
[pointer_type(qualified_type(
|
|
1510
|
+
[pointer_type(qualified_type(signed_int_t, :const))]
|
|
1522
1511
|
else
|
|
1523
|
-
[pointer_type(qualified_type(
|
|
1512
|
+
[pointer_type(qualified_type(signed_int_t, :const))]
|
|
1524
1513
|
end
|
|
1525
1514
|
end
|
|
1526
1515
|
|
|
@@ -1535,12 +1524,10 @@ module C #:nodoc:
|
|
|
1535
1524
|
"%"
|
|
1536
1525
|
end
|
|
1537
1526
|
|
|
1538
|
-
def initialize(
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
flags, field_width, precision, length_modifier,
|
|
1543
|
-
conversion_specifier_character)
|
|
1527
|
+
def initialize(fmt, trailing_args, env, flags, field_width, prec,
|
|
1528
|
+
len_mod, cs_char)
|
|
1529
|
+
super(fmt, trailing_args, env, false, flags, field_width, prec,
|
|
1530
|
+
len_mod, cs_char)
|
|
1544
1531
|
end
|
|
1545
1532
|
|
|
1546
1533
|
def valid_flags?
|
|
@@ -1587,11 +1574,8 @@ module C #:nodoc:
|
|
|
1587
1574
|
private_constant :Conversion_percent
|
|
1588
1575
|
|
|
1589
1576
|
class UndefinedConversionSpecifier < CompleteConversionSpecifier
|
|
1590
|
-
def initialize(
|
|
1591
|
-
|
|
1592
|
-
super(format, [], nil, false,
|
|
1593
|
-
flags, field_width, precision, length_modifier,
|
|
1594
|
-
conversion_specifier_character)
|
|
1577
|
+
def initialize(fmt, flags, field_width, prec, len_mod, cs_char)
|
|
1578
|
+
super(fmt, [], nil, false, flags, field_width, prec, len_mod, cs_char)
|
|
1595
1579
|
end
|
|
1596
1580
|
|
|
1597
1581
|
def undefined?
|
|
@@ -1626,9 +1610,8 @@ module C #:nodoc:
|
|
|
1626
1610
|
private_constant :UndefinedConversionSpecifier
|
|
1627
1611
|
|
|
1628
1612
|
class IncompleteConversionSpecifier < ConversionSpecifier
|
|
1629
|
-
def initialize(
|
|
1630
|
-
super(
|
|
1631
|
-
flags, field_width, precision, length_modifier, nil)
|
|
1613
|
+
def initialize(fmt, flags, field_width, prec, len_mod)
|
|
1614
|
+
super(fmt, [], nil, false, flags, field_width, prec, len_mod, nil)
|
|
1632
1615
|
end
|
|
1633
1616
|
|
|
1634
1617
|
# === DESCRIPTION
|
|
@@ -1724,9 +1707,9 @@ module C #:nodoc:
|
|
|
1724
1707
|
end
|
|
1725
1708
|
|
|
1726
1709
|
class ScanfFormat
|
|
1727
|
-
def initialize(
|
|
1728
|
-
@location
|
|
1729
|
-
@directives
|
|
1710
|
+
def initialize(fmt_str, loc, trailing_args, env)
|
|
1711
|
+
@location = loc
|
|
1712
|
+
@directives = create_directives(fmt_str, trailing_args, env)
|
|
1730
1713
|
@extra_arguments = trailing_args
|
|
1731
1714
|
end
|
|
1732
1715
|
|
|
@@ -1735,57 +1718,57 @@ module C #:nodoc:
|
|
|
1735
1718
|
attr_reader :extra_arguments
|
|
1736
1719
|
|
|
1737
1720
|
def conversion_specifiers
|
|
1738
|
-
@directives.select { |
|
|
1721
|
+
@directives.select { |dire| dire.conversion_specifier? }
|
|
1739
1722
|
end
|
|
1740
1723
|
|
|
1741
1724
|
private
|
|
1742
|
-
def create_directives(
|
|
1743
|
-
|
|
1744
|
-
str =
|
|
1725
|
+
def create_directives(fmt_str, trailing_args, env)
|
|
1726
|
+
dires = []
|
|
1727
|
+
str = fmt_str.dup
|
|
1745
1728
|
until str.empty?
|
|
1746
|
-
|
|
1729
|
+
dires.push(Directive.guess(str, trailing_args, env))
|
|
1747
1730
|
end
|
|
1748
|
-
|
|
1731
|
+
dires
|
|
1749
1732
|
end
|
|
1750
1733
|
|
|
1751
1734
|
# == DESCRIPTION
|
|
1752
1735
|
# === Directive class hierarchy
|
|
1753
1736
|
# Directive
|
|
1754
|
-
#
|
|
1755
|
-
#
|
|
1756
|
-
#
|
|
1757
|
-
#
|
|
1758
|
-
#
|
|
1759
|
-
#
|
|
1760
|
-
#
|
|
1761
|
-
#
|
|
1762
|
-
#
|
|
1763
|
-
#
|
|
1764
|
-
#
|
|
1765
|
-
#
|
|
1766
|
-
#
|
|
1767
|
-
#
|
|
1768
|
-
#
|
|
1769
|
-
#
|
|
1770
|
-
#
|
|
1771
|
-
#
|
|
1772
|
-
#
|
|
1773
|
-
#
|
|
1774
|
-
#
|
|
1775
|
-
#
|
|
1776
|
-
#
|
|
1777
|
-
#
|
|
1778
|
-
#
|
|
1779
|
-
#
|
|
1737
|
+
# <-- Whitespace
|
|
1738
|
+
# <-- Ordinary
|
|
1739
|
+
# <-- ConversionSpecifier
|
|
1740
|
+
# <-- CompleteConversionSpecifier
|
|
1741
|
+
# <-- Conversion_d
|
|
1742
|
+
# <-- Conversion_i
|
|
1743
|
+
# <-- Conversion_o
|
|
1744
|
+
# <-- Conversion_u
|
|
1745
|
+
# <-- Conversion_x
|
|
1746
|
+
# <-- Conversion_X
|
|
1747
|
+
# <-- Conversion_a
|
|
1748
|
+
# <-- Conversion_A
|
|
1749
|
+
# <-- Conversion_e
|
|
1750
|
+
# <-- Conversion_E
|
|
1751
|
+
# <-- Conversion_f
|
|
1752
|
+
# <-- Conversion_F
|
|
1753
|
+
# <-- Conversion_g
|
|
1754
|
+
# <-- Conversion_G
|
|
1755
|
+
# <-- Conversion_c
|
|
1756
|
+
# <-- Conversion_s
|
|
1757
|
+
# <-- Conversion_bracket
|
|
1758
|
+
# <-- Conversion_p
|
|
1759
|
+
# <-- Conversion_n
|
|
1760
|
+
# <-- Conversion_percent
|
|
1761
|
+
# <-- UndefinedConversionSpecifier
|
|
1762
|
+
# <-- IncompleteConversionSpecifier
|
|
1780
1763
|
class Directive
|
|
1781
|
-
def self.guess(
|
|
1782
|
-
try_to_create_whitespace(
|
|
1783
|
-
try_to_create_ordinary(
|
|
1784
|
-
try_to_create_conversion_specifier(
|
|
1764
|
+
def self.guess(fmt_str, trailing_args, env)
|
|
1765
|
+
try_to_create_whitespace(fmt_str) or
|
|
1766
|
+
try_to_create_ordinary(fmt_str) or
|
|
1767
|
+
try_to_create_conversion_specifier(fmt_str, trailing_args, env)
|
|
1785
1768
|
end
|
|
1786
1769
|
|
|
1787
|
-
def initialize(
|
|
1788
|
-
@format =
|
|
1770
|
+
def initialize(fmt)
|
|
1771
|
+
@format = fmt
|
|
1789
1772
|
end
|
|
1790
1773
|
|
|
1791
1774
|
attr_reader :format
|
|
@@ -1881,34 +1864,33 @@ module C #:nodoc:
|
|
|
1881
1864
|
subclass_responsibility
|
|
1882
1865
|
end
|
|
1883
1866
|
|
|
1884
|
-
def self.try_to_create_whitespace(
|
|
1885
|
-
(
|
|
1867
|
+
def self.try_to_create_whitespace(fmt_str)
|
|
1868
|
+
(fmt = Whitespace.scan(fmt_str)) ? Whitespace.new(fmt) : nil
|
|
1886
1869
|
end
|
|
1887
1870
|
private_class_method :try_to_create_whitespace
|
|
1888
1871
|
|
|
1889
|
-
def self.try_to_create_ordinary(
|
|
1890
|
-
(
|
|
1872
|
+
def self.try_to_create_ordinary(fmt_str)
|
|
1873
|
+
(fmt = Ordinary.scan(fmt_str)) ? Ordinary.new(fmt) : nil
|
|
1891
1874
|
end
|
|
1892
1875
|
private_class_method :try_to_create_ordinary
|
|
1893
1876
|
|
|
1894
|
-
def self.try_to_create_conversion_specifier(
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
ConversionSpecifier.scan(format_str)
|
|
1877
|
+
def self.try_to_create_conversion_specifier(fmt_str, trailing_args, env)
|
|
1878
|
+
fmt, as_char, field_width, len_mod, cs_char, scanset =
|
|
1879
|
+
ConversionSpecifier.scan(fmt_str)
|
|
1898
1880
|
|
|
1899
1881
|
case
|
|
1900
1882
|
when cs_char.nil?
|
|
1901
|
-
IncompleteConversionSpecifier.new(
|
|
1902
|
-
|
|
1883
|
+
IncompleteConversionSpecifier.new(fmt, as_char, field_width, len_mod,
|
|
1884
|
+
nil)
|
|
1903
1885
|
when cs_char == "[" && scanset.nil?
|
|
1904
|
-
IncompleteConversionSpecifier.new(
|
|
1905
|
-
|
|
1886
|
+
IncompleteConversionSpecifier.new(fmt, as_char, field_width, len_mod,
|
|
1887
|
+
cs_char)
|
|
1906
1888
|
when cs_class = CONVERSION_SPECIFIER_TBL[cs_char]
|
|
1907
|
-
cs_class.new(
|
|
1908
|
-
|
|
1889
|
+
cs_class.new(fmt, trailing_args, env, as_char, field_width, len_mod,
|
|
1890
|
+
cs_char, scanset)
|
|
1909
1891
|
else
|
|
1910
|
-
UndefinedConversionSpecifier.new(
|
|
1911
|
-
|
|
1892
|
+
UndefinedConversionSpecifier.new(fmt, as_char, field_width, len_mod,
|
|
1893
|
+
cs_char)
|
|
1912
1894
|
end
|
|
1913
1895
|
end
|
|
1914
1896
|
private_class_method :try_to_create_conversion_specifier
|
|
@@ -1916,7 +1898,7 @@ module C #:nodoc:
|
|
|
1916
1898
|
private_constant :Directive
|
|
1917
1899
|
|
|
1918
1900
|
class Whitespace < Directive
|
|
1919
|
-
def self.scan(
|
|
1901
|
+
def self.scan(fmt_str)
|
|
1920
1902
|
# NOTE: The ISO C99 standard says;
|
|
1921
1903
|
#
|
|
1922
1904
|
# 7.19.6.2 The fscanf function
|
|
@@ -1936,7 +1918,7 @@ module C #:nodoc:
|
|
|
1936
1918
|
# receiving object.
|
|
1937
1919
|
# -- A conversion specifier character that specifies the type of
|
|
1938
1920
|
# conversion to be applied.
|
|
1939
|
-
|
|
1921
|
+
fmt_str.slice!(/\A\s+/)
|
|
1940
1922
|
end
|
|
1941
1923
|
|
|
1942
1924
|
def whitespace?
|
|
@@ -2025,7 +2007,7 @@ module C #:nodoc:
|
|
|
2025
2007
|
private_constant :Whitespace
|
|
2026
2008
|
|
|
2027
2009
|
class Ordinary < Directive
|
|
2028
|
-
def self.scan(
|
|
2010
|
+
def self.scan(fmt_str)
|
|
2029
2011
|
# NOTE: The ISO C99 standard says;
|
|
2030
2012
|
#
|
|
2031
2013
|
# 7.19.6.2 The fscanf function
|
|
@@ -2045,7 +2027,7 @@ module C #:nodoc:
|
|
|
2045
2027
|
# receiving object.
|
|
2046
2028
|
# -- A conversion specifier character that specifies the type of
|
|
2047
2029
|
# conversion to be applied.
|
|
2048
|
-
|
|
2030
|
+
fmt_str.slice!(/\A[^%\s]+/)
|
|
2049
2031
|
end
|
|
2050
2032
|
|
|
2051
2033
|
def whitespace?
|
|
@@ -2136,7 +2118,7 @@ module C #:nodoc:
|
|
|
2136
2118
|
class ConversionSpecifier < Directive
|
|
2137
2119
|
include TypeTableMediator
|
|
2138
2120
|
|
|
2139
|
-
def self.scan(
|
|
2121
|
+
def self.scan(fmt_str)
|
|
2140
2122
|
# NOTE: The ISO C99 standard says;
|
|
2141
2123
|
#
|
|
2142
2124
|
# 7.19.6.2 The fscanf function
|
|
@@ -2157,60 +2139,59 @@ module C #:nodoc:
|
|
|
2157
2139
|
# -- A conversion specifier character that specifies the type of
|
|
2158
2140
|
# conversion to be applied.
|
|
2159
2141
|
|
|
2160
|
-
if header =
|
|
2142
|
+
if header = fmt_str.slice!(/\A%/)
|
|
2161
2143
|
scanned = header
|
|
2162
2144
|
else
|
|
2163
2145
|
return nil, nil, nil, nil, nil, nil
|
|
2164
2146
|
end
|
|
2165
2147
|
|
|
2166
|
-
if as_char =
|
|
2148
|
+
if as_char = fmt_str.slice!(/\A#{as_char_re}/)
|
|
2167
2149
|
scanned += as_char
|
|
2168
2150
|
end
|
|
2169
2151
|
|
|
2170
|
-
if field_width =
|
|
2152
|
+
if field_width = fmt_str.slice!(/\A#{field_width_re}/)
|
|
2171
2153
|
scanned += field_width
|
|
2172
2154
|
end
|
|
2173
2155
|
|
|
2174
|
-
if
|
|
2175
|
-
scanned +=
|
|
2156
|
+
if len_mod = fmt_str.slice!(/\A#{length_modifier_re}/)
|
|
2157
|
+
scanned += len_mod
|
|
2176
2158
|
end
|
|
2177
2159
|
|
|
2178
|
-
if cs_char =
|
|
2160
|
+
if cs_char = fmt_str.slice!(/\A#{cs_char_re}/)
|
|
2179
2161
|
scanned += cs_char
|
|
2180
2162
|
else
|
|
2181
2163
|
# NOTE: If no valid conversion specifier character, force to scan
|
|
2182
2164
|
# the heading 1 character as a conversion specifier character.
|
|
2183
|
-
if cs_char =
|
|
2165
|
+
if cs_char = fmt_str.slice!(/\A[a-z]/i)
|
|
2184
2166
|
scanned += cs_char
|
|
2185
2167
|
end
|
|
2186
2168
|
end
|
|
2187
2169
|
|
|
2188
2170
|
if cs_char == "["
|
|
2189
|
-
if scanset =
|
|
2171
|
+
if scanset = fmt_str.slice!(/\A#{scanset_re}/)
|
|
2190
2172
|
scanned += scanset
|
|
2191
2173
|
end
|
|
2192
2174
|
else
|
|
2193
2175
|
scanset = nil
|
|
2194
2176
|
end
|
|
2195
2177
|
|
|
2196
|
-
return scanned, as_char, field_width,
|
|
2178
|
+
return scanned, as_char, field_width, len_mod, cs_char, scanset
|
|
2197
2179
|
end
|
|
2198
2180
|
|
|
2199
|
-
def initialize(
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
super(format)
|
|
2181
|
+
def initialize(fmt, trailing_args, env, consume_args, as_char,
|
|
2182
|
+
field_width, len_mod, cs_char, scanset)
|
|
2183
|
+
super(fmt)
|
|
2203
2184
|
|
|
2204
|
-
if
|
|
2185
|
+
if as_char == "*"
|
|
2205
2186
|
@consume_arguments = false
|
|
2206
2187
|
else
|
|
2207
2188
|
@consume_arguments = consume_args
|
|
2208
2189
|
end
|
|
2209
2190
|
|
|
2210
|
-
@assignment_suppressing_character =
|
|
2191
|
+
@assignment_suppressing_character = as_char
|
|
2211
2192
|
@field_width = field_width
|
|
2212
|
-
@length_modifier =
|
|
2213
|
-
@conversion_specifier_character =
|
|
2193
|
+
@length_modifier = len_mod
|
|
2194
|
+
@conversion_specifier_character = cs_char
|
|
2214
2195
|
@scanset = scanset
|
|
2215
2196
|
|
|
2216
2197
|
if consume_arguments?
|
|
@@ -2219,7 +2200,7 @@ module C #:nodoc:
|
|
|
2219
2200
|
@conversion_argument = nil
|
|
2220
2201
|
end
|
|
2221
2202
|
|
|
2222
|
-
@environment =
|
|
2203
|
+
@environment = env
|
|
2223
2204
|
end
|
|
2224
2205
|
|
|
2225
2206
|
def whitespace?
|
|
@@ -2486,10 +2467,10 @@ module C #:nodoc:
|
|
|
2486
2467
|
end
|
|
2487
2468
|
private_class_method :scanset_re
|
|
2488
2469
|
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2470
|
+
extend Forwardable
|
|
2471
|
+
|
|
2472
|
+
def_delegator :@environment, :type_table
|
|
2473
|
+
private :type_table
|
|
2493
2474
|
end
|
|
2494
2475
|
private_constant :ConversionSpecifier
|
|
2495
2476
|
|
|
@@ -2556,12 +2537,10 @@ module C #:nodoc:
|
|
|
2556
2537
|
"d"
|
|
2557
2538
|
end
|
|
2558
2539
|
|
|
2559
|
-
def initialize(
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
assignment_suppressing_character, field_width,
|
|
2564
|
-
length_modifier, conversion_specifier_character, scanset)
|
|
2540
|
+
def initialize(fmt, trailing_args, env, as_char, field_width, len_mod,
|
|
2541
|
+
cs_char, scanset)
|
|
2542
|
+
super(fmt, trailing_args, env, true, as_char, field_width, len_mod,
|
|
2543
|
+
cs_char, scanset)
|
|
2565
2544
|
end
|
|
2566
2545
|
|
|
2567
2546
|
def valid_assignment_suppressing_character?
|
|
@@ -2614,24 +2593,24 @@ module C #:nodoc:
|
|
|
2614
2593
|
# or the corresponding unsigned integer type.
|
|
2615
2594
|
case length_modifier
|
|
2616
2595
|
when "hh"
|
|
2617
|
-
[pointer_type(
|
|
2596
|
+
[pointer_type(signed_char_t), pointer_type(unsigned_char_t)]
|
|
2618
2597
|
when "h"
|
|
2619
|
-
[pointer_type(
|
|
2598
|
+
[pointer_type(signed_short_t), pointer_type(unsigned_short_t)]
|
|
2620
2599
|
when "l"
|
|
2621
|
-
[pointer_type(
|
|
2600
|
+
[pointer_type(signed_long_t), pointer_type(unsigned_long_t)]
|
|
2622
2601
|
when "ll"
|
|
2623
|
-
[pointer_type(
|
|
2624
|
-
pointer_type(
|
|
2602
|
+
[pointer_type(signed_long_long_t),
|
|
2603
|
+
pointer_type(unsigned_long_long_t)]
|
|
2625
2604
|
when "j"
|
|
2626
2605
|
# FIXME: `intmax_t' and `uintmax_t' are not supported yet.
|
|
2627
|
-
[pointer_type(
|
|
2628
|
-
pointer_type(
|
|
2606
|
+
[pointer_type(signed_long_long_t),
|
|
2607
|
+
pointer_type(unsigned_long_long_t)]
|
|
2629
2608
|
when "z"
|
|
2630
2609
|
# FIXME: `size_t' is not supported yet.
|
|
2631
|
-
[pointer_type(
|
|
2610
|
+
[pointer_type(signed_long_t), pointer_type(unsigned_long_t)]
|
|
2632
2611
|
when "t"
|
|
2633
2612
|
# FIXME: `ptrdiff_t' is not supported yet.
|
|
2634
|
-
[pointer_type(
|
|
2613
|
+
[pointer_type(signed_int_t), pointer_type(unsigned_int_t)]
|
|
2635
2614
|
else
|
|
2636
2615
|
default_argument_types
|
|
2637
2616
|
end
|
|
@@ -2642,7 +2621,7 @@ module C #:nodoc:
|
|
|
2642
2621
|
end
|
|
2643
2622
|
|
|
2644
2623
|
def default_argument_types
|
|
2645
|
-
[pointer_type(
|
|
2624
|
+
[pointer_type(signed_int_t)]
|
|
2646
2625
|
end
|
|
2647
2626
|
end
|
|
2648
2627
|
private_constant :Conversion_d
|
|
@@ -2661,7 +2640,7 @@ module C #:nodoc:
|
|
|
2661
2640
|
|
|
2662
2641
|
private
|
|
2663
2642
|
def default_argument_types
|
|
2664
|
-
[pointer_type(
|
|
2643
|
+
[pointer_type(unsigned_int_t)]
|
|
2665
2644
|
end
|
|
2666
2645
|
end
|
|
2667
2646
|
private_constant :Conversion_o
|
|
@@ -2692,12 +2671,10 @@ module C #:nodoc:
|
|
|
2692
2671
|
"a"
|
|
2693
2672
|
end
|
|
2694
2673
|
|
|
2695
|
-
def initialize(
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
assignment_suppressing_character, field_width,
|
|
2700
|
-
length_modifier, conversion_specifier_character, scanset)
|
|
2674
|
+
def initialize(fmt, trailing_args, env, as_char, field_width, len_mod,
|
|
2675
|
+
cs_char, scanset)
|
|
2676
|
+
super(fmt, trailing_args, env, true, as_char, field_width, len_mod,
|
|
2677
|
+
cs_char, scanset)
|
|
2701
2678
|
end
|
|
2702
2679
|
|
|
2703
2680
|
def valid_assignment_suppressing_character?
|
|
@@ -2735,11 +2712,11 @@ module C #:nodoc:
|
|
|
2735
2712
|
# double.
|
|
2736
2713
|
case length_modifier
|
|
2737
2714
|
when "l"
|
|
2738
|
-
[pointer_type(
|
|
2715
|
+
[pointer_type(double_t)]
|
|
2739
2716
|
when "L"
|
|
2740
|
-
[pointer_type(
|
|
2717
|
+
[pointer_type(long_double_t)]
|
|
2741
2718
|
else
|
|
2742
|
-
[pointer_type(
|
|
2719
|
+
[pointer_type(float_t)]
|
|
2743
2720
|
end
|
|
2744
2721
|
end
|
|
2745
2722
|
|
|
@@ -2803,12 +2780,10 @@ module C #:nodoc:
|
|
|
2803
2780
|
"c"
|
|
2804
2781
|
end
|
|
2805
2782
|
|
|
2806
|
-
def initialize(
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
assignment_suppressing_character, field_width,
|
|
2811
|
-
length_modifier, conversion_specifier_character, scanset)
|
|
2783
|
+
def initialize(fmt, trailing_args, env, as_char, field_width, len_mod,
|
|
2784
|
+
cs_char, scanset)
|
|
2785
|
+
super(fmt, trailing_args, env, true, as_char, field_width, len_mod,
|
|
2786
|
+
cs_char, scanset)
|
|
2812
2787
|
end
|
|
2813
2788
|
|
|
2814
2789
|
def valid_assignment_suppressing_character?
|
|
@@ -2843,9 +2818,9 @@ module C #:nodoc:
|
|
|
2843
2818
|
# applies to an argument with type pointer to wchar_t.
|
|
2844
2819
|
case length_modifier
|
|
2845
2820
|
when "l"
|
|
2846
|
-
[pointer_type(
|
|
2821
|
+
[pointer_type(wchar_t)]
|
|
2847
2822
|
else
|
|
2848
|
-
[pointer_type(
|
|
2823
|
+
[pointer_type(signed_char_t), pointer_type(unsigned_char_t)]
|
|
2849
2824
|
end
|
|
2850
2825
|
end
|
|
2851
2826
|
|
|
@@ -2871,9 +2846,9 @@ module C #:nodoc:
|
|
|
2871
2846
|
# NOTE: The `-' character in the scanset causes implementation-defined
|
|
2872
2847
|
# behavior. So, AdLint treats the `-' character as an ordinary
|
|
2873
2848
|
# character in the scanset.
|
|
2874
|
-
|
|
2875
|
-
uniq_set =
|
|
2876
|
-
|
|
2849
|
+
org_set = scanset.chop.chars.to_a
|
|
2850
|
+
uniq_set = org_set.uniq
|
|
2851
|
+
org_set.size == uniq_set.size
|
|
2877
2852
|
end
|
|
2878
2853
|
end
|
|
2879
2854
|
private_constant :Conversion_bracket
|
|
@@ -2883,12 +2858,10 @@ module C #:nodoc:
|
|
|
2883
2858
|
"p"
|
|
2884
2859
|
end
|
|
2885
2860
|
|
|
2886
|
-
def initialize(
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
assignment_suppressing_character, field_width,
|
|
2891
|
-
length_modifier, conversion_specifier_character, scanset)
|
|
2861
|
+
def initialize(fmt, trailing_args, env, as_char, field_width, len_mod,
|
|
2862
|
+
cs_char, scanset)
|
|
2863
|
+
super(fmt, trailing_args, env, true, as_char, field_width, len_mod,
|
|
2864
|
+
cs_char, scanset)
|
|
2892
2865
|
end
|
|
2893
2866
|
|
|
2894
2867
|
def valid_assignment_suppressing_character?
|
|
@@ -2912,7 +2885,7 @@ module C #:nodoc:
|
|
|
2912
2885
|
if conversion_argument && conversion_argument.type.pointer?
|
|
2913
2886
|
[conversion_argument.type.unqualify]
|
|
2914
2887
|
else
|
|
2915
|
-
[pointer_type(
|
|
2888
|
+
[pointer_type(void_t)]
|
|
2916
2889
|
end
|
|
2917
2890
|
end
|
|
2918
2891
|
|
|
@@ -2927,12 +2900,10 @@ module C #:nodoc:
|
|
|
2927
2900
|
"n"
|
|
2928
2901
|
end
|
|
2929
2902
|
|
|
2930
|
-
def initialize(
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
assignment_suppressing_character, field_width,
|
|
2935
|
-
length_modifier, conversion_specifier_character, scanset)
|
|
2903
|
+
def initialize(fmt, trailing_args, env, as_char, field_width, len_mod,
|
|
2904
|
+
cs_char, scanset)
|
|
2905
|
+
super(fmt, trailing_args, env, true, as_char, field_width, len_mod,
|
|
2906
|
+
cs_char, scanset)
|
|
2936
2907
|
end
|
|
2937
2908
|
|
|
2938
2909
|
def valid_assignment_suppressing_character?
|
|
@@ -3001,26 +2972,26 @@ module C #:nodoc:
|
|
|
3001
2972
|
# or the corresponding unsigned integer type.
|
|
3002
2973
|
case length_modifier
|
|
3003
2974
|
when "hh"
|
|
3004
|
-
[pointer_type(
|
|
2975
|
+
[pointer_type(signed_char_t), pointer_type(unsigned_char_t)]
|
|
3005
2976
|
when "h"
|
|
3006
|
-
[pointer_type(
|
|
2977
|
+
[pointer_type(signed_short_t), pointer_type(unsigned_short_t)]
|
|
3007
2978
|
when "l"
|
|
3008
|
-
[pointer_type(
|
|
2979
|
+
[pointer_type(signed_long_t), pointer_type(unsigned_long_t)]
|
|
3009
2980
|
when "ll"
|
|
3010
|
-
[pointer_type(
|
|
3011
|
-
pointer_type(
|
|
2981
|
+
[pointer_type(signed_long_long_t),
|
|
2982
|
+
pointer_type(unsigned_long_long_t)]
|
|
3012
2983
|
when "j"
|
|
3013
2984
|
# FIXME: `intmax_t' and `uintmax_t' are not supported yet.
|
|
3014
|
-
[pointer_type(
|
|
3015
|
-
pointer_type(
|
|
2985
|
+
[pointer_type(signed_long_long_t),
|
|
2986
|
+
pointer_type(unsigned_long_long_t)]
|
|
3016
2987
|
when "z"
|
|
3017
2988
|
# FIXME: `size_t' is not supported yet.
|
|
3018
|
-
[pointer_type(
|
|
2989
|
+
[pointer_type(signed_long_t), pointer_type(unsigned_long_t)]
|
|
3019
2990
|
when "t"
|
|
3020
2991
|
# FIXME: `ptrdiff_t' is not supported yet.
|
|
3021
|
-
[pointer_type(
|
|
2992
|
+
[pointer_type(signed_int_t), pointer_type(unsigned_int_t)]
|
|
3022
2993
|
else
|
|
3023
|
-
[pointer_type(
|
|
2994
|
+
[pointer_type(signed_int_t)]
|
|
3024
2995
|
end
|
|
3025
2996
|
end
|
|
3026
2997
|
|
|
@@ -3035,12 +3006,10 @@ module C #:nodoc:
|
|
|
3035
3006
|
"%"
|
|
3036
3007
|
end
|
|
3037
3008
|
|
|
3038
|
-
def initialize(
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
assignment_suppressing_character, field_width,
|
|
3043
|
-
length_modifier, conversion_specifier_character, scanset)
|
|
3009
|
+
def initialize(fmt, trailing_args, env, as_char, field_width, len_mod,
|
|
3010
|
+
cs_char, scanset)
|
|
3011
|
+
super(fmt, trailing_args, env, false, as_char, field_width, len_mod,
|
|
3012
|
+
cs_char, scanset)
|
|
3044
3013
|
end
|
|
3045
3014
|
|
|
3046
3015
|
def valid_assignment_suppressing_character?
|
|
@@ -3080,11 +3049,8 @@ module C #:nodoc:
|
|
|
3080
3049
|
private_constant :Conversion_percent
|
|
3081
3050
|
|
|
3082
3051
|
class UndefinedConversionSpecifier < CompleteConversionSpecifier
|
|
3083
|
-
def initialize(
|
|
3084
|
-
|
|
3085
|
-
super(format, [], nil, false,
|
|
3086
|
-
assignment_suppressing_character, field_width,
|
|
3087
|
-
length_modifier, conversion_specifier_character, nil)
|
|
3052
|
+
def initialize(fmt, as_char, field_width, len_mod, cs_char)
|
|
3053
|
+
super(fmt, [], nil, false, as_char, field_width, len_mod, cs_char, nil)
|
|
3088
3054
|
end
|
|
3089
3055
|
|
|
3090
3056
|
def undefined?
|
|
@@ -3119,11 +3085,8 @@ module C #:nodoc:
|
|
|
3119
3085
|
private_constant :UndefinedConversionSpecifier
|
|
3120
3086
|
|
|
3121
3087
|
class IncompleteConversionSpecifier < ConversionSpecifier
|
|
3122
|
-
def initialize(
|
|
3123
|
-
|
|
3124
|
-
super(format, [], nil, false, assignment_suppressing_character,
|
|
3125
|
-
field_width, length_modifier, conversion_specifier_character,
|
|
3126
|
-
nil)
|
|
3088
|
+
def initialize(fmt, as_char, field_width, len_mod, cs_char)
|
|
3089
|
+
super(fmt, [], nil, false, as_char, field_width, len_mod, cs_char, nil)
|
|
3127
3090
|
end
|
|
3128
3091
|
|
|
3129
3092
|
# === DESCRIPTION
|