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
data/lib/adlint/cpp/subst.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Pre-analysis code substitution mechanism.
|
|
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
|
#
|
|
@@ -37,47 +37,47 @@ module AdLint #:nodoc:
|
|
|
37
37
|
module Cpp #:nodoc:
|
|
38
38
|
|
|
39
39
|
class CodeSubstitution
|
|
40
|
-
def initialize(
|
|
41
|
-
@pattern
|
|
42
|
-
@replacement = StringToPPTokensLexer.new(
|
|
40
|
+
def initialize(ptn_str, repl_str)
|
|
41
|
+
@pattern = StringToPPTokensLexer.new(ptn_str).execute.to_a
|
|
42
|
+
@replacement = StringToPPTokensLexer.new(repl_str).execute.to_a
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
extend Pluggable
|
|
46
46
|
|
|
47
47
|
def_plugin :on_substitution
|
|
48
48
|
|
|
49
|
-
def execute(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
while
|
|
49
|
+
def execute(toks)
|
|
50
|
+
res_toks = []
|
|
51
|
+
idx = 0
|
|
52
|
+
while first_tok = toks[idx]
|
|
53
53
|
matcher = Matcher.new(@pattern)
|
|
54
|
-
|
|
55
|
-
if matcher.accepted? ||
|
|
56
|
-
notify_substitution(
|
|
57
|
-
|
|
58
|
-
Token.new(
|
|
54
|
+
matched_len = matcher.match(toks, idx)
|
|
55
|
+
if matcher.accepted? || idx + matched_len == toks.size
|
|
56
|
+
notify_substitution(toks, idx, matched_len)
|
|
57
|
+
res_toks.concat(@replacement.map { |tok|
|
|
58
|
+
Token.new(tok.type, tok.value, first_tok.location, tok.type_hint)
|
|
59
59
|
})
|
|
60
|
-
|
|
60
|
+
idx += matched_len
|
|
61
61
|
else
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
res_toks.push(first_tok)
|
|
63
|
+
idx += 1
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
|
-
|
|
66
|
+
res_toks
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
private
|
|
70
|
-
def notify_substitution(
|
|
71
|
-
|
|
72
|
-
on_substitution.invoke(
|
|
70
|
+
def notify_substitution(toks, idx, len)
|
|
71
|
+
matched_toks = toks[idx, len]
|
|
72
|
+
on_substitution.invoke(matched_toks) unless matched_toks.empty?
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
class Matcher
|
|
77
|
-
def initialize(
|
|
77
|
+
def initialize(ptn_toks)
|
|
78
78
|
@state = OuterTokenMatching.new(self)
|
|
79
|
-
@pattern_tokens =
|
|
80
|
-
@pattern_index
|
|
79
|
+
@pattern_tokens = ptn_toks
|
|
80
|
+
@pattern_index = 0
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
def rest_pattern_tokens
|
|
@@ -85,24 +85,24 @@ module Cpp #:nodoc:
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def next_pattern_token
|
|
88
|
-
|
|
88
|
+
ptn_tok = @pattern_tokens[@pattern_index]
|
|
89
89
|
@pattern_index += 1
|
|
90
|
-
|
|
90
|
+
ptn_tok
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
def match(
|
|
94
|
-
return 0 if head =
|
|
93
|
+
def match(toks, idx)
|
|
94
|
+
return 0 if head = toks[idx] and head.type == :NEW_LINE
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
while
|
|
98
|
-
unless
|
|
99
|
-
@state = @state.process(
|
|
96
|
+
match_len = 0
|
|
97
|
+
while tok = toks[idx]
|
|
98
|
+
unless tok.type == :NEW_LINE
|
|
99
|
+
@state = @state.process(tok)
|
|
100
100
|
break unless @state.matching?
|
|
101
101
|
end
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
match_len += 1
|
|
103
|
+
idx += 1
|
|
104
104
|
end
|
|
105
|
-
|
|
105
|
+
match_len
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def accepted?
|
|
@@ -124,7 +124,7 @@ module Cpp #:nodoc:
|
|
|
124
124
|
|
|
125
125
|
attr_reader :matcher
|
|
126
126
|
|
|
127
|
-
def process(
|
|
127
|
+
def process(tok)
|
|
128
128
|
subclass_responsibility
|
|
129
129
|
end
|
|
130
130
|
|
|
@@ -185,22 +185,22 @@ module Cpp #:nodoc:
|
|
|
185
185
|
private_constant :Matching
|
|
186
186
|
|
|
187
187
|
class OuterTokenMatching < Matching
|
|
188
|
-
def process(
|
|
189
|
-
if
|
|
190
|
-
if
|
|
191
|
-
case
|
|
188
|
+
def process(tok)
|
|
189
|
+
if ptn_tok = next_pattern_token
|
|
190
|
+
if tok.value == ptn_tok.value
|
|
191
|
+
case tok.value
|
|
192
192
|
when "(", "[", "{"
|
|
193
193
|
InnerTokenMatching.new(matcher, self)
|
|
194
194
|
else
|
|
195
195
|
self
|
|
196
196
|
end
|
|
197
197
|
else
|
|
198
|
-
if
|
|
199
|
-
if
|
|
200
|
-
|
|
201
|
-
case
|
|
198
|
+
if ptn_tok.value == "__adlint__any"
|
|
199
|
+
if sentry_tok = rest_pattern_tokens.first and
|
|
200
|
+
tok.value == sentry_tok.value
|
|
201
|
+
case tok.value
|
|
202
202
|
when "(", "[", "{"
|
|
203
|
-
InnerTokenMatching.new(matcher, self).process(
|
|
203
|
+
InnerTokenMatching.new(matcher, self).process(tok)
|
|
204
204
|
else
|
|
205
205
|
self
|
|
206
206
|
end
|
|
@@ -219,10 +219,10 @@ module Cpp #:nodoc:
|
|
|
219
219
|
private_constant :OuterTokenMatching
|
|
220
220
|
|
|
221
221
|
class OuterAnyMatching < Matching
|
|
222
|
-
def process(
|
|
223
|
-
if
|
|
224
|
-
if
|
|
225
|
-
return OuterTokenMatching.new(@matcher).process(
|
|
222
|
+
def process(tok)
|
|
223
|
+
if sentry_tok = rest_pattern_tokens.first
|
|
224
|
+
if tok.value == sentry_tok.value
|
|
225
|
+
return OuterTokenMatching.new(@matcher).process(tok)
|
|
226
226
|
end
|
|
227
227
|
end
|
|
228
228
|
self
|
|
@@ -231,25 +231,25 @@ module Cpp #:nodoc:
|
|
|
231
231
|
private_constant :OuterAnyMatching
|
|
232
232
|
|
|
233
233
|
class InnerTokenMatching < Matching
|
|
234
|
-
def initialize(matcher,
|
|
234
|
+
def initialize(matcher, prv_state)
|
|
235
235
|
super(matcher)
|
|
236
|
-
@
|
|
236
|
+
@prv_state = prv_state
|
|
237
237
|
end
|
|
238
238
|
|
|
239
|
-
def process(
|
|
240
|
-
if
|
|
241
|
-
if
|
|
242
|
-
case
|
|
239
|
+
def process(tok)
|
|
240
|
+
if ptn_tok = next_pattern_token
|
|
241
|
+
if tok.value == ptn_tok.value
|
|
242
|
+
case tok.value
|
|
243
243
|
when "(", "[", "{"
|
|
244
244
|
InnerTokenMatching.new(matcher, self)
|
|
245
245
|
when ")", "]", "}"
|
|
246
|
-
@
|
|
246
|
+
@prv_state
|
|
247
247
|
else
|
|
248
248
|
self
|
|
249
249
|
end
|
|
250
250
|
else
|
|
251
|
-
if
|
|
252
|
-
case
|
|
251
|
+
if ptn_tok.value == "__adlint__any"
|
|
252
|
+
case tok.value
|
|
253
253
|
when "(", "[", "{"
|
|
254
254
|
InnerAnyMatching.new(matcher, self, 1)
|
|
255
255
|
else
|
|
@@ -267,24 +267,24 @@ module Cpp #:nodoc:
|
|
|
267
267
|
private_constant :InnerTokenMatching
|
|
268
268
|
|
|
269
269
|
class InnerAnyMatching < Matching
|
|
270
|
-
def initialize(matcher,
|
|
270
|
+
def initialize(matcher, prv_state, depth)
|
|
271
271
|
super(matcher)
|
|
272
|
-
@
|
|
272
|
+
@prv_state = prv_state
|
|
273
273
|
@depth = depth
|
|
274
274
|
end
|
|
275
275
|
|
|
276
|
-
def process(
|
|
277
|
-
case
|
|
276
|
+
def process(tok)
|
|
277
|
+
case tok.value
|
|
278
278
|
when "(", "[", "{"
|
|
279
279
|
@depth += 1
|
|
280
280
|
when ")", "]", "}"
|
|
281
281
|
@depth -= 1
|
|
282
282
|
end
|
|
283
283
|
|
|
284
|
-
if
|
|
285
|
-
if
|
|
284
|
+
if sentry_tok = rest_pattern_tokens.first
|
|
285
|
+
if tok.value == sentry_tok.value
|
|
286
286
|
if @depth < 0
|
|
287
|
-
return @
|
|
287
|
+
return @prv_state.process(tok)
|
|
288
288
|
end
|
|
289
289
|
end
|
|
290
290
|
end
|
data/lib/adlint/cpp/syntax.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AST of C preprocessor language.
|
|
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
|
#
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
#++
|
|
31
31
|
|
|
32
32
|
require "adlint/symbol"
|
|
33
|
+
require "adlint/location"
|
|
34
|
+
require "adlint/exam"
|
|
33
35
|
require "adlint/util"
|
|
34
36
|
|
|
35
37
|
module AdLint #:nodoc:
|
|
@@ -37,6 +39,7 @@ module Cpp #:nodoc:
|
|
|
37
39
|
|
|
38
40
|
class SyntaxNode
|
|
39
41
|
include Visitable
|
|
42
|
+
include LocationHolder
|
|
40
43
|
|
|
41
44
|
def location
|
|
42
45
|
subclass_responsibility
|
|
@@ -52,14 +55,14 @@ module Cpp #:nodoc:
|
|
|
52
55
|
end
|
|
53
56
|
|
|
54
57
|
class IdentifierList < SyntaxNode
|
|
55
|
-
def initialize(
|
|
56
|
-
@identifiers =
|
|
58
|
+
def initialize(ids = [])
|
|
59
|
+
@identifiers = ids
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
attr_reader :identifiers
|
|
60
63
|
|
|
61
|
-
def push(
|
|
62
|
-
@identifiers.push(
|
|
64
|
+
def push(id)
|
|
65
|
+
@identifiers.push(id)
|
|
63
66
|
self
|
|
64
67
|
end
|
|
65
68
|
|
|
@@ -86,8 +89,8 @@ module Cpp #:nodoc:
|
|
|
86
89
|
@group.location
|
|
87
90
|
end
|
|
88
91
|
|
|
89
|
-
def concat(
|
|
90
|
-
@group.group_parts.concat(
|
|
92
|
+
def concat(pp_file)
|
|
93
|
+
@group.group_parts.concat(pp_file.group.group_parts)
|
|
91
94
|
end
|
|
92
95
|
|
|
93
96
|
def inspect(indent = 0)
|
|
@@ -123,10 +126,10 @@ module Cpp #:nodoc:
|
|
|
123
126
|
|
|
124
127
|
class IfSection < GroupPart
|
|
125
128
|
def initialize(if_group, elif_groups, else_group, endif_line)
|
|
126
|
-
@if_group
|
|
129
|
+
@if_group = if_group
|
|
127
130
|
@elif_groups = elif_groups
|
|
128
|
-
@else_group
|
|
129
|
-
@endif_line
|
|
131
|
+
@else_group = else_group
|
|
132
|
+
@endif_line = endif_line
|
|
130
133
|
end
|
|
131
134
|
|
|
132
135
|
attr_reader :if_group
|
|
@@ -161,9 +164,9 @@ module Cpp #:nodoc:
|
|
|
161
164
|
end
|
|
162
165
|
|
|
163
166
|
class IfStatement < IfGroup
|
|
164
|
-
def initialize(keyword,
|
|
167
|
+
def initialize(keyword, expr, group)
|
|
165
168
|
super(keyword)
|
|
166
|
-
@expression =
|
|
169
|
+
@expression = expr
|
|
167
170
|
@group = group
|
|
168
171
|
end
|
|
169
172
|
|
|
@@ -178,9 +181,9 @@ module Cpp #:nodoc:
|
|
|
178
181
|
end
|
|
179
182
|
|
|
180
183
|
class IfdefStatement < IfGroup
|
|
181
|
-
def initialize(keyword,
|
|
184
|
+
def initialize(keyword, id, group)
|
|
182
185
|
super(keyword)
|
|
183
|
-
@identifier =
|
|
186
|
+
@identifier = id
|
|
184
187
|
@group = group
|
|
185
188
|
end
|
|
186
189
|
|
|
@@ -194,9 +197,9 @@ module Cpp #:nodoc:
|
|
|
194
197
|
end
|
|
195
198
|
|
|
196
199
|
class IfndefStatement < IfGroup
|
|
197
|
-
def initialize(keyword,
|
|
200
|
+
def initialize(keyword, id, group)
|
|
198
201
|
super(keyword)
|
|
199
|
-
@identifier =
|
|
202
|
+
@identifier = id
|
|
200
203
|
@group = group
|
|
201
204
|
end
|
|
202
205
|
|
|
@@ -217,8 +220,8 @@ module Cpp #:nodoc:
|
|
|
217
220
|
|
|
218
221
|
attr_reader :elif_statements
|
|
219
222
|
|
|
220
|
-
def push(
|
|
221
|
-
@elif_statements.push(
|
|
223
|
+
def push(elif_stmt)
|
|
224
|
+
@elif_statements.push(elif_stmt)
|
|
222
225
|
self
|
|
223
226
|
end
|
|
224
227
|
|
|
@@ -241,9 +244,9 @@ module Cpp #:nodoc:
|
|
|
241
244
|
end
|
|
242
245
|
|
|
243
246
|
class ElifStatement < ElifGroup
|
|
244
|
-
def initialize(keyword,
|
|
247
|
+
def initialize(keyword, expr, group)
|
|
245
248
|
super(keyword)
|
|
246
|
-
@expression =
|
|
249
|
+
@expression = expr
|
|
247
250
|
@group = group
|
|
248
251
|
end
|
|
249
252
|
|
|
@@ -313,7 +316,7 @@ module Cpp #:nodoc:
|
|
|
313
316
|
class IncludeLine < ControlLine
|
|
314
317
|
def initialize(keyword, header_name, include_depth)
|
|
315
318
|
super(keyword)
|
|
316
|
-
@header_name
|
|
319
|
+
@header_name = header_name
|
|
317
320
|
@include_depth = include_depth
|
|
318
321
|
end
|
|
319
322
|
|
|
@@ -323,8 +326,8 @@ module Cpp #:nodoc:
|
|
|
323
326
|
end
|
|
324
327
|
|
|
325
328
|
class UserIncludeLine < IncludeLine
|
|
326
|
-
def initialize(keyword,
|
|
327
|
-
super(keyword,
|
|
329
|
+
def initialize(keyword, usr_header_name, include_depth)
|
|
330
|
+
super(keyword, usr_header_name, include_depth)
|
|
328
331
|
end
|
|
329
332
|
|
|
330
333
|
def inspect(indent = 0)
|
|
@@ -335,8 +338,8 @@ module Cpp #:nodoc:
|
|
|
335
338
|
class UserIncludeNextLine < UserIncludeLine; end
|
|
336
339
|
|
|
337
340
|
class SystemIncludeLine < IncludeLine
|
|
338
|
-
def initialize(keyword,
|
|
339
|
-
super(keyword,
|
|
341
|
+
def initialize(keyword, sys_header_name, include_depth)
|
|
342
|
+
super(keyword, sys_header_name, include_depth)
|
|
340
343
|
end
|
|
341
344
|
|
|
342
345
|
def inspect(indent = 0)
|
|
@@ -349,11 +352,11 @@ module Cpp #:nodoc:
|
|
|
349
352
|
class DefineLine < ControlLine
|
|
350
353
|
include SymbolicElement
|
|
351
354
|
|
|
352
|
-
def initialize(keyword,
|
|
355
|
+
def initialize(keyword, id, repl_list, sym)
|
|
353
356
|
super(keyword)
|
|
354
|
-
@identifier =
|
|
355
|
-
@replacement_list =
|
|
356
|
-
@symbol =
|
|
357
|
+
@identifier = id
|
|
358
|
+
@replacement_list = repl_list
|
|
359
|
+
@symbol = sym
|
|
357
360
|
end
|
|
358
361
|
|
|
359
362
|
attr_reader :identifier
|
|
@@ -369,17 +372,17 @@ module Cpp #:nodoc:
|
|
|
369
372
|
|
|
370
373
|
class PseudoObjectLikeDefineLine < DefineLine
|
|
371
374
|
def initialize(name_str)
|
|
372
|
-
super(
|
|
375
|
+
super(Token.new(:DEFINE, "#define", Location.new),
|
|
376
|
+
Token.new(:PP_TOKEN, name_str, Location.new), nil, nil)
|
|
373
377
|
end
|
|
374
378
|
|
|
375
|
-
def mark_as_referred_by(
|
|
379
|
+
def mark_as_referred_by(tok) end
|
|
376
380
|
end
|
|
377
381
|
|
|
378
382
|
class FunctionLikeDefineLine < DefineLine
|
|
379
|
-
def initialize(keyword,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
@identifier_list = identifier_list
|
|
383
|
+
def initialize(keyword, id, id_list, repl_list, sym)
|
|
384
|
+
super(keyword, id, repl_list, sym)
|
|
385
|
+
@identifier_list = id_list
|
|
383
386
|
end
|
|
384
387
|
|
|
385
388
|
attr_reader :identifier_list
|
|
@@ -395,14 +398,14 @@ module Cpp #:nodoc:
|
|
|
395
398
|
|
|
396
399
|
class PseudoFunctionLikeDefineLine < FunctionLikeDefineLine
|
|
397
400
|
def initialize(name_str, param_names)
|
|
398
|
-
|
|
401
|
+
id_list = IdentifierList.new(
|
|
399
402
|
param_names.map { |str| Token.new(:PP_TOKEN, str, Location.new) })
|
|
400
403
|
|
|
401
|
-
super(
|
|
402
|
-
nil, nil)
|
|
404
|
+
super(Token.new(:DEFINE, "#define", Location.new),
|
|
405
|
+
Token.new(:PP_TOKEN, name_str, Location.new), id_list, nil, nil)
|
|
403
406
|
end
|
|
404
407
|
|
|
405
|
-
def mark_as_referred_by(
|
|
408
|
+
def mark_as_referred_by(tok) end
|
|
406
409
|
end
|
|
407
410
|
|
|
408
411
|
class VaFunctionLikeDefineLine < FunctionLikeDefineLine
|
|
@@ -412,9 +415,9 @@ module Cpp #:nodoc:
|
|
|
412
415
|
end
|
|
413
416
|
|
|
414
417
|
class UndefLine < ControlLine
|
|
415
|
-
def initialize(keyword,
|
|
418
|
+
def initialize(keyword, id)
|
|
416
419
|
super(keyword)
|
|
417
|
-
@identifier =
|
|
420
|
+
@identifier = id
|
|
418
421
|
end
|
|
419
422
|
|
|
420
423
|
attr_reader :identifier
|
|
@@ -425,9 +428,9 @@ module Cpp #:nodoc:
|
|
|
425
428
|
end
|
|
426
429
|
|
|
427
430
|
class LineLine < ControlLine
|
|
428
|
-
def initialize(keyword,
|
|
431
|
+
def initialize(keyword, pp_toks)
|
|
429
432
|
super(keyword)
|
|
430
|
-
@pp_tokens =
|
|
433
|
+
@pp_tokens = pp_toks
|
|
431
434
|
end
|
|
432
435
|
|
|
433
436
|
attr_reader :pp_tokens
|
|
@@ -438,9 +441,9 @@ module Cpp #:nodoc:
|
|
|
438
441
|
end
|
|
439
442
|
|
|
440
443
|
class ErrorLine < ControlLine
|
|
441
|
-
def initialize(keyword,
|
|
444
|
+
def initialize(keyword, pp_toks)
|
|
442
445
|
super(keyword)
|
|
443
|
-
@pp_tokens =
|
|
446
|
+
@pp_tokens = pp_toks
|
|
444
447
|
end
|
|
445
448
|
|
|
446
449
|
attr_reader :pp_tokens
|
|
@@ -452,9 +455,9 @@ module Cpp #:nodoc:
|
|
|
452
455
|
end
|
|
453
456
|
|
|
454
457
|
class PragmaLine < ControlLine
|
|
455
|
-
def initialize(keyword,
|
|
458
|
+
def initialize(keyword, pp_toks)
|
|
456
459
|
super(keyword)
|
|
457
|
-
@pp_tokens =
|
|
460
|
+
@pp_tokens = pp_toks
|
|
458
461
|
end
|
|
459
462
|
|
|
460
463
|
attr_reader :pp_tokens
|
|
@@ -466,8 +469,8 @@ module Cpp #:nodoc:
|
|
|
466
469
|
end
|
|
467
470
|
|
|
468
471
|
class TextLine < GroupPart
|
|
469
|
-
def initialize(
|
|
470
|
-
@token =
|
|
472
|
+
def initialize(tok)
|
|
473
|
+
@token = tok
|
|
471
474
|
end
|
|
472
475
|
|
|
473
476
|
attr_reader :token
|
|
@@ -482,8 +485,8 @@ module Cpp #:nodoc:
|
|
|
482
485
|
end
|
|
483
486
|
|
|
484
487
|
class NullDirective < GroupPart
|
|
485
|
-
def initialize(
|
|
486
|
-
@token =
|
|
488
|
+
def initialize(tok)
|
|
489
|
+
@token = tok
|
|
487
490
|
end
|
|
488
491
|
|
|
489
492
|
attr_reader :token
|
|
@@ -498,8 +501,8 @@ module Cpp #:nodoc:
|
|
|
498
501
|
end
|
|
499
502
|
|
|
500
503
|
class UnknownDirective < GroupPart
|
|
501
|
-
def initialize(
|
|
502
|
-
@token =
|
|
504
|
+
def initialize(tok)
|
|
505
|
+
@token = tok
|
|
503
506
|
end
|
|
504
507
|
|
|
505
508
|
attr_reader :token
|
|
@@ -573,8 +576,8 @@ module Cpp #:nodoc:
|
|
|
573
576
|
|
|
574
577
|
attr_reader :tokens
|
|
575
578
|
|
|
576
|
-
def push(
|
|
577
|
-
@tokens.push(
|
|
579
|
+
def push(tok)
|
|
580
|
+
@tokens.push(tok)
|
|
578
581
|
self
|
|
579
582
|
end
|
|
580
583
|
|
|
@@ -585,8 +588,8 @@ module Cpp #:nodoc:
|
|
|
585
588
|
def may_represent_expression?
|
|
586
589
|
return false if @tokens.size < 2
|
|
587
590
|
|
|
588
|
-
@tokens.all? do |
|
|
589
|
-
case
|
|
591
|
+
@tokens.all? do |pp_tok|
|
|
592
|
+
case pp_tok.value
|
|
590
593
|
when "{", "}"
|
|
591
594
|
false
|
|
592
595
|
when ";"
|
|
@@ -606,8 +609,8 @@ module Cpp #:nodoc:
|
|
|
606
609
|
return false if @tokens.size < 2
|
|
607
610
|
|
|
608
611
|
if @tokens.first.value == "{" && @tokens.last.value == "}"
|
|
609
|
-
@tokens.all? do |
|
|
610
|
-
case
|
|
612
|
+
@tokens.all? do |pp_tok|
|
|
613
|
+
case pp_tok.value
|
|
611
614
|
when "while", "do", "for", "if", "else", "switch", "case", "default",
|
|
612
615
|
"goto", "return", "break", "continue"
|
|
613
616
|
false
|
|
@@ -626,7 +629,7 @@ module Cpp #:nodoc:
|
|
|
626
629
|
return false if @tokens.size < 2
|
|
627
630
|
|
|
628
631
|
if @tokens.first.value == "{" && @tokens.last.value == "}"
|
|
629
|
-
@tokens.any? { |
|
|
632
|
+
@tokens.any? { |pp_tok| pp_tok.value == ";" }
|
|
630
633
|
else
|
|
631
634
|
false
|
|
632
635
|
end
|
|
@@ -641,8 +644,8 @@ module Cpp #:nodoc:
|
|
|
641
644
|
end
|
|
642
645
|
|
|
643
646
|
def may_represent_specifier_qualifier_list?
|
|
644
|
-
@tokens.select { |
|
|
645
|
-
case
|
|
647
|
+
@tokens.select { |pp_tok|
|
|
648
|
+
case pp_tok.value
|
|
646
649
|
when "const", "volatile", "restrict"
|
|
647
650
|
true
|
|
648
651
|
when "*"
|
|
@@ -657,8 +660,8 @@ module Cpp #:nodoc:
|
|
|
657
660
|
end
|
|
658
661
|
|
|
659
662
|
def may_represent_declaration_specifiers_head?
|
|
660
|
-
@tokens.all? do |
|
|
661
|
-
case
|
|
663
|
+
@tokens.all? do |pp_tok|
|
|
664
|
+
case pp_tok.value
|
|
662
665
|
when "typedef", "extern", "static", "auto", "register"
|
|
663
666
|
true
|
|
664
667
|
when "const", "volatile", "restrict"
|
|
@@ -695,7 +698,7 @@ module Cpp #:nodoc:
|
|
|
695
698
|
end
|
|
696
699
|
|
|
697
700
|
def to_s
|
|
698
|
-
@tokens.map { |
|
|
701
|
+
@tokens.map { |tok| tok.value }.join(" ")
|
|
699
702
|
end
|
|
700
703
|
|
|
701
704
|
def inspect(indent = 0)
|
|
@@ -704,8 +707,8 @@ module Cpp #:nodoc:
|
|
|
704
707
|
end
|
|
705
708
|
|
|
706
709
|
class Expression < SyntaxNode
|
|
707
|
-
def initialize(
|
|
708
|
-
@value =
|
|
710
|
+
def initialize(val)
|
|
711
|
+
@value = val
|
|
709
712
|
end
|
|
710
713
|
|
|
711
714
|
attr_reader :value
|
|
@@ -716,9 +719,9 @@ module Cpp #:nodoc:
|
|
|
716
719
|
end
|
|
717
720
|
|
|
718
721
|
class ErrorExpression < Expression
|
|
719
|
-
def initialize(
|
|
722
|
+
def initialize(err_tok)
|
|
720
723
|
super(0)
|
|
721
|
-
@error_token =
|
|
724
|
+
@error_token = err_tok
|
|
722
725
|
end
|
|
723
726
|
|
|
724
727
|
attr_reader :error_token
|
|
@@ -739,9 +742,9 @@ module Cpp #:nodoc:
|
|
|
739
742
|
class PrimaryExpression < Expression; end
|
|
740
743
|
|
|
741
744
|
class ConstantSpecifier < PrimaryExpression
|
|
742
|
-
def initialize(
|
|
743
|
-
super(
|
|
744
|
-
@constant =
|
|
745
|
+
def initialize(val, const)
|
|
746
|
+
super(val)
|
|
747
|
+
@constant = const
|
|
745
748
|
end
|
|
746
749
|
|
|
747
750
|
attr_reader :constant
|
|
@@ -760,9 +763,9 @@ module Cpp #:nodoc:
|
|
|
760
763
|
end
|
|
761
764
|
|
|
762
765
|
class GroupedExpression < PrimaryExpression
|
|
763
|
-
def initialize(
|
|
764
|
-
super(
|
|
765
|
-
@expression =
|
|
766
|
+
def initialize(val, expr)
|
|
767
|
+
super(val)
|
|
768
|
+
@expression = expr
|
|
766
769
|
end
|
|
767
770
|
|
|
768
771
|
attr_reader :expression
|
|
@@ -782,9 +785,9 @@ module Cpp #:nodoc:
|
|
|
782
785
|
end
|
|
783
786
|
|
|
784
787
|
class UnaryExpression < Expression
|
|
785
|
-
def initialize(
|
|
786
|
-
super(
|
|
787
|
-
@operator =
|
|
788
|
+
def initialize(val, op)
|
|
789
|
+
super(val)
|
|
790
|
+
@operator = op
|
|
788
791
|
end
|
|
789
792
|
|
|
790
793
|
attr_reader :operator
|
|
@@ -795,9 +798,9 @@ module Cpp #:nodoc:
|
|
|
795
798
|
end
|
|
796
799
|
|
|
797
800
|
class UnaryArithmeticExpression < UnaryExpression
|
|
798
|
-
def initialize(
|
|
799
|
-
super(
|
|
800
|
-
@expression =
|
|
801
|
+
def initialize(val, op, expr)
|
|
802
|
+
super(val, op)
|
|
803
|
+
@expression = expr
|
|
801
804
|
end
|
|
802
805
|
|
|
803
806
|
attr_reader :expression
|
|
@@ -813,9 +816,9 @@ module Cpp #:nodoc:
|
|
|
813
816
|
end
|
|
814
817
|
|
|
815
818
|
class DefinedExpression < UnaryExpression
|
|
816
|
-
def initialize(
|
|
817
|
-
super(
|
|
818
|
-
@identifier =
|
|
819
|
+
def initialize(val, op, id)
|
|
820
|
+
super(val, op)
|
|
821
|
+
@identifier = id
|
|
819
822
|
end
|
|
820
823
|
|
|
821
824
|
attr_reader :identifier
|
|
@@ -831,11 +834,11 @@ module Cpp #:nodoc:
|
|
|
831
834
|
end
|
|
832
835
|
|
|
833
836
|
class BinaryExpression < Expression
|
|
834
|
-
def initialize(
|
|
835
|
-
super(
|
|
836
|
-
@operator =
|
|
837
|
-
@lhs_expression =
|
|
838
|
-
@rhs_expression =
|
|
837
|
+
def initialize(val, op, lhs_expr, rhs_expr)
|
|
838
|
+
super(val)
|
|
839
|
+
@operator = op
|
|
840
|
+
@lhs_expression = lhs_expr
|
|
841
|
+
@rhs_expression = rhs_expr
|
|
839
842
|
end
|
|
840
843
|
|
|
841
844
|
attr_reader :operator
|
|
@@ -878,11 +881,11 @@ module Cpp #:nodoc:
|
|
|
878
881
|
class LogicalOrExpression < BinaryExpression; end
|
|
879
882
|
|
|
880
883
|
class ConditionalExpression < Expression
|
|
881
|
-
def initialize(
|
|
882
|
-
super(
|
|
883
|
-
@condition =
|
|
884
|
-
@first_expression
|
|
885
|
-
@second_expression =
|
|
884
|
+
def initialize(val, cond, fst_expr, snd_expr)
|
|
885
|
+
super(val)
|
|
886
|
+
@condition = cond
|
|
887
|
+
@first_expression = fst_expr
|
|
888
|
+
@second_expression = snd_expr
|
|
886
889
|
end
|
|
887
890
|
|
|
888
891
|
attr_reader :condition
|
|
@@ -906,8 +909,8 @@ module Cpp #:nodoc:
|
|
|
906
909
|
end
|
|
907
910
|
|
|
908
911
|
class CommaSeparatedExpression < Expression
|
|
909
|
-
def initialize(
|
|
910
|
-
super(
|
|
912
|
+
def initialize(val)
|
|
913
|
+
super(val)
|
|
911
914
|
@expressions = []
|
|
912
915
|
end
|
|
913
916
|
|
|
@@ -1102,7 +1105,7 @@ module Cpp #:nodoc:
|
|
|
1102
1105
|
end
|
|
1103
1106
|
|
|
1104
1107
|
def visit_comma_separated_expression(node)
|
|
1105
|
-
node.expressions.each { |
|
|
1108
|
+
node.expressions.each { |expr| expr.accept(self) }
|
|
1106
1109
|
end
|
|
1107
1110
|
end
|
|
1108
1111
|
|
|
@@ -1196,177 +1199,58 @@ module Cpp #:nodoc:
|
|
|
1196
1199
|
def_plugin :enter_comma_separated_expression
|
|
1197
1200
|
def_plugin :leave_comma_separated_expression
|
|
1198
1201
|
|
|
1199
|
-
def
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
end
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
def visit_user_include_next_line(node)
|
|
1252
|
-
visit_with_notifying(__method__, node) { super }
|
|
1253
|
-
end
|
|
1254
|
-
|
|
1255
|
-
def visit_system_include_next_line(node)
|
|
1256
|
-
visit_with_notifying(__method__, node) { super }
|
|
1257
|
-
end
|
|
1258
|
-
|
|
1259
|
-
def visit_object_like_define_line(node)
|
|
1260
|
-
visit_with_notifying(__method__, node) { super }
|
|
1261
|
-
end
|
|
1262
|
-
|
|
1263
|
-
def visit_function_like_define_line(node)
|
|
1264
|
-
visit_with_notifying(__method__, node) { super }
|
|
1265
|
-
end
|
|
1266
|
-
|
|
1267
|
-
def visit_va_function_like_define_line(node)
|
|
1268
|
-
visit_with_notifying(__method__, node) { super }
|
|
1269
|
-
end
|
|
1270
|
-
|
|
1271
|
-
def visit_undef_line(node)
|
|
1272
|
-
visit_with_notifying(__method__, node) { super }
|
|
1273
|
-
end
|
|
1274
|
-
|
|
1275
|
-
def visit_line_line(node)
|
|
1276
|
-
visit_with_notifying(__method__, node) { super }
|
|
1277
|
-
end
|
|
1278
|
-
|
|
1279
|
-
def visit_error_line(node)
|
|
1280
|
-
visit_with_notifying(__method__, node) { super }
|
|
1281
|
-
end
|
|
1282
|
-
|
|
1283
|
-
def visit_pragma_line(node)
|
|
1284
|
-
visit_with_notifying(__method__, node) { super }
|
|
1285
|
-
end
|
|
1286
|
-
|
|
1287
|
-
def visit_text_line(node)
|
|
1288
|
-
visit_with_notifying(__method__, node) { super }
|
|
1289
|
-
end
|
|
1290
|
-
|
|
1291
|
-
def visit_null_directive(node)
|
|
1292
|
-
visit_with_notifying(__method__, node) { super }
|
|
1293
|
-
end
|
|
1294
|
-
|
|
1295
|
-
def visit_unknown_directive(node)
|
|
1296
|
-
visit_with_notifying(__method__, node) { super }
|
|
1297
|
-
end
|
|
1298
|
-
|
|
1299
|
-
def visit_pp_tokens(node)
|
|
1300
|
-
visit_with_notifying(__method__, node) { super }
|
|
1301
|
-
end
|
|
1302
|
-
|
|
1303
|
-
def visit_error_expression(node)
|
|
1304
|
-
visit_with_notifying(__method__, node) { super }
|
|
1305
|
-
end
|
|
1306
|
-
|
|
1307
|
-
def visit_constant_specifier(node)
|
|
1308
|
-
visit_with_notifying(__method__, node) { super }
|
|
1309
|
-
end
|
|
1310
|
-
|
|
1311
|
-
def visit_grouped_expression(node)
|
|
1312
|
-
visit_with_notifying(__method__, node) { super }
|
|
1313
|
-
end
|
|
1314
|
-
|
|
1315
|
-
def visit_unary_arithmetic_expression(node)
|
|
1316
|
-
visit_with_notifying(__method__, node) { super }
|
|
1317
|
-
end
|
|
1318
|
-
|
|
1319
|
-
def visit_defined_expression(node)
|
|
1320
|
-
visit_with_notifying(__method__, node) { super }
|
|
1321
|
-
end
|
|
1322
|
-
|
|
1323
|
-
def visit_multiplicative_expression(node)
|
|
1324
|
-
visit_with_notifying(__method__, node) { super }
|
|
1325
|
-
end
|
|
1326
|
-
|
|
1327
|
-
def visit_additive_expression(node)
|
|
1328
|
-
visit_with_notifying(__method__, node) { super }
|
|
1329
|
-
end
|
|
1330
|
-
|
|
1331
|
-
def visit_shift_expression(node)
|
|
1332
|
-
visit_with_notifying(__method__, node) { super }
|
|
1333
|
-
end
|
|
1334
|
-
|
|
1335
|
-
def visit_relational_expression(node)
|
|
1336
|
-
visit_with_notifying(__method__, node) { super }
|
|
1337
|
-
end
|
|
1338
|
-
|
|
1339
|
-
def visit_equality_expression(node)
|
|
1340
|
-
visit_with_notifying(__method__, node) { super }
|
|
1341
|
-
end
|
|
1342
|
-
|
|
1343
|
-
def visit_and_expression(node)
|
|
1344
|
-
visit_with_notifying(__method__, node) { super }
|
|
1345
|
-
end
|
|
1346
|
-
|
|
1347
|
-
def visit_exclusive_or_expression(node)
|
|
1348
|
-
visit_with_notifying(__method__, node) { super }
|
|
1349
|
-
end
|
|
1350
|
-
|
|
1351
|
-
def visit_inclusive_or_expression(node)
|
|
1352
|
-
visit_with_notifying(__method__, node) { super }
|
|
1353
|
-
end
|
|
1354
|
-
|
|
1355
|
-
def visit_logical_and_expression(node)
|
|
1356
|
-
visit_with_notifying(__method__, node) { super }
|
|
1357
|
-
end
|
|
1358
|
-
|
|
1359
|
-
def visit_logical_or_expression(node)
|
|
1360
|
-
visit_with_notifying(__method__, node) { super }
|
|
1361
|
-
end
|
|
1362
|
-
|
|
1363
|
-
def visit_conditional_expression(node)
|
|
1364
|
-
visit_with_notifying(__method__, node) { super }
|
|
1365
|
-
end
|
|
1366
|
-
|
|
1367
|
-
def visit_comma_separated_expression(node)
|
|
1368
|
-
visit_with_notifying(__method__, node) { super }
|
|
1369
|
-
end
|
|
1202
|
+
def self.def_visitor_method(node_name)
|
|
1203
|
+
class_eval <<-EOS
|
|
1204
|
+
define_method("visit_#{node_name}") do |*args|
|
|
1205
|
+
visit_with_notifying(__method__, args.first) { super(args.first) }
|
|
1206
|
+
end
|
|
1207
|
+
EOS
|
|
1208
|
+
end
|
|
1209
|
+
private_class_method :def_visitor_method
|
|
1210
|
+
|
|
1211
|
+
def_visitor_method :identifier_list
|
|
1212
|
+
def_visitor_method :preprocessing_file
|
|
1213
|
+
def_visitor_method :group
|
|
1214
|
+
def_visitor_method :if_section
|
|
1215
|
+
def_visitor_method :if_statement
|
|
1216
|
+
def_visitor_method :ifdef_statement
|
|
1217
|
+
def_visitor_method :ifndef_statement
|
|
1218
|
+
def_visitor_method :elif_groups
|
|
1219
|
+
def_visitor_method :elif_statement
|
|
1220
|
+
def_visitor_method :else_statement
|
|
1221
|
+
def_visitor_method :endif_line
|
|
1222
|
+
def_visitor_method :user_include_line
|
|
1223
|
+
def_visitor_method :system_include_line
|
|
1224
|
+
def_visitor_method :user_include_next_line
|
|
1225
|
+
def_visitor_method :system_include_next_line
|
|
1226
|
+
def_visitor_method :object_like_define_line
|
|
1227
|
+
def_visitor_method :function_like_define_line
|
|
1228
|
+
def_visitor_method :va_function_like_define_line
|
|
1229
|
+
def_visitor_method :undef_line
|
|
1230
|
+
def_visitor_method :line_line
|
|
1231
|
+
def_visitor_method :error_line
|
|
1232
|
+
def_visitor_method :pragma_line
|
|
1233
|
+
def_visitor_method :text_line
|
|
1234
|
+
def_visitor_method :null_directive
|
|
1235
|
+
def_visitor_method :unknown_directive
|
|
1236
|
+
def_visitor_method :pp_tokens
|
|
1237
|
+
def_visitor_method :error_expression
|
|
1238
|
+
def_visitor_method :constant_specifier
|
|
1239
|
+
def_visitor_method :grouped_expression
|
|
1240
|
+
def_visitor_method :unary_arithmetic_expression
|
|
1241
|
+
def_visitor_method :defined_expression
|
|
1242
|
+
def_visitor_method :multiplicative_expression
|
|
1243
|
+
def_visitor_method :additive_expression
|
|
1244
|
+
def_visitor_method :shift_expression
|
|
1245
|
+
def_visitor_method :relational_expression
|
|
1246
|
+
def_visitor_method :equality_expression
|
|
1247
|
+
def_visitor_method :and_expression
|
|
1248
|
+
def_visitor_method :exclusive_or_expression
|
|
1249
|
+
def_visitor_method :inclusive_or_expression
|
|
1250
|
+
def_visitor_method :logical_and_expression
|
|
1251
|
+
def_visitor_method :logical_or_expression
|
|
1252
|
+
def_visitor_method :conditional_expression
|
|
1253
|
+
def_visitor_method :comma_separated_expression
|
|
1370
1254
|
|
|
1371
1255
|
private
|
|
1372
1256
|
def visit_with_notifying(caller_method, node, &block)
|
|
@@ -1380,9 +1264,7 @@ module Cpp #:nodoc:
|
|
|
1380
1264
|
module SyntaxNodeCollector
|
|
1381
1265
|
def collect_define_lines(node)
|
|
1382
1266
|
if node
|
|
1383
|
-
DefineLineCollector.new.tap { |
|
|
1384
|
-
node.accept(collector)
|
|
1385
|
-
}.define_lines
|
|
1267
|
+
DefineLineCollector.new.tap { |col| node.accept(col) }.define_lines
|
|
1386
1268
|
else
|
|
1387
1269
|
[]
|
|
1388
1270
|
end
|
|
@@ -1391,9 +1273,7 @@ module Cpp #:nodoc:
|
|
|
1391
1273
|
|
|
1392
1274
|
def collect_undef_lines(node)
|
|
1393
1275
|
if node
|
|
1394
|
-
UndefLineCollector.new.tap { |
|
|
1395
|
-
node.accept(collector)
|
|
1396
|
-
}.undef_lines
|
|
1276
|
+
UndefLineCollector.new.tap { |col| node.accept(col) }.undef_lines
|
|
1397
1277
|
else
|
|
1398
1278
|
[]
|
|
1399
1279
|
end
|