adlint 2.6.14 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (401) hide show
  1. data/AUTHORS +1 -3
  2. data/ChangeLog +511 -0
  3. data/INSTALL +1 -1
  4. data/MANIFEST +57 -37
  5. data/NEWS +36 -7
  6. data/README +2 -2
  7. data/Rakefile +6 -6
  8. data/TODO +1 -1
  9. data/bin/adlint +25 -16
  10. data/bin/adlint_chk +22 -12
  11. data/bin/adlint_cma +17 -12
  12. data/bin/adlint_sma +22 -12
  13. data/bin/adlintize +98 -17
  14. data/etc/conf.d/fallback/cinit.erb +1 -1
  15. data/etc/conf.d/fallback/traits.erb +37 -37
  16. data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
  17. data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +41 -41
  18. data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
  19. data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +40 -40
  20. data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
  21. data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +40 -40
  22. data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
  23. data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +40 -40
  24. data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
  25. data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
  26. data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
  27. data/etc/conf.d/noarch/pinit.erb +1 -1
  28. data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
  29. data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +42 -42
  30. data/etc/mesg.d/c_builtin/en_US/messages.yml +33 -33
  31. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +5 -5
  32. data/etc/mesg.d/core/en_US/messages.yml +2 -2
  33. data/etc/mesg.d/core/ja_JP/messages.yml +2 -2
  34. data/features/code_check/W0018.feature +197 -0
  35. data/features/code_check/W0019.feature +79 -0
  36. data/features/code_check/W0021.feature +81 -0
  37. data/features/code_check/W0023.feature +203 -0
  38. data/features/code_check/W0024.feature +226 -0
  39. data/features/code_check/W0025.feature +5 -0
  40. data/features/code_check/W0088.feature +2 -2
  41. data/features/code_check/W0109.feature +2 -2
  42. data/features/code_check/W0477.feature +0 -3
  43. data/features/code_check/W0478.feature +0 -1
  44. data/features/code_check/W0582.feature +3 -3
  45. data/features/code_check/W0583.feature +4 -7
  46. data/features/code_check/W0646.feature +0 -1
  47. data/features/code_check/W0695.feature +0 -1
  48. data/features/code_check/W0705.feature +8 -0
  49. data/features/code_check/W0723.feature +0 -1
  50. data/features/code_check/W0745.feature +1 -0
  51. data/features/code_check/W0781.feature +1 -0
  52. data/features/code_check/W1057.feature +141 -0
  53. data/features/code_check/W1058.feature +93 -0
  54. data/features/code_check/W1059.feature +86 -0
  55. data/features/code_check/W1060.feature +77 -0
  56. data/features/code_check/W1061.feature +143 -0
  57. data/features/code_check/W1062.feature +162 -0
  58. data/features/code_check/W1063.feature +123 -0
  59. data/features/code_check/W1064.feature +83 -0
  60. data/features/code_check/W1065.feature +82 -0
  61. data/features/code_check/W9003.feature +2 -0
  62. data/features/step_definitions/code_check_steps.rb +1 -0
  63. data/features/support/env.rb +16 -13
  64. data/lib/adlint.rb +7 -4
  65. data/lib/adlint/analyzer.rb +131 -157
  66. data/lib/adlint/annot.rb +149 -0
  67. data/lib/adlint/cc1.rb +57 -0
  68. data/lib/adlint/{c → cc1}/branch.rb +74 -62
  69. data/lib/adlint/{c → cc1}/builtin.rb +21 -21
  70. data/lib/adlint/{c → cc1}/const.rb +119 -117
  71. data/lib/adlint/{c → cc1}/conv.rb +76 -78
  72. data/lib/adlint/{c → cc1}/ctrlexpr.rb +69 -86
  73. data/lib/adlint/cc1/domain.rb +8103 -0
  74. data/lib/adlint/{c → cc1}/enum.rb +3 -3
  75. data/lib/adlint/{c → cc1}/environ.rb +21 -21
  76. data/lib/adlint/{c → cc1}/expr.rb +232 -218
  77. data/lib/adlint/{c → cc1}/format.rb +305 -342
  78. data/lib/adlint/{c → cc1}/interp.rb +269 -220
  79. data/lib/adlint/cc1/lexer.rb +246 -0
  80. data/lib/adlint/{c → cc1}/mediator.rb +78 -84
  81. data/lib/adlint/{c → cc1}/object.rb +261 -264
  82. data/lib/adlint/{c → cc1}/operator.rb +7 -7
  83. data/lib/adlint/{c → cc1}/option.rb +4 -3
  84. data/lib/adlint/{c → cc1}/parser.rb +274 -506
  85. data/lib/adlint/{c → cc1}/parser.y +69 -301
  86. data/lib/adlint/cc1/phase.rb +138 -0
  87. data/lib/adlint/{c → cc1}/resolver.rb +66 -78
  88. data/lib/adlint/{c → cc1}/scanner.rb +57 -49
  89. data/lib/adlint/{c → cc1}/scope.rb +3 -3
  90. data/lib/adlint/{c → cc1}/seqp.rb +13 -5
  91. data/lib/adlint/{c → cc1}/syntax.rb +819 -1122
  92. data/lib/adlint/{c → cc1}/type.rb +1498 -1479
  93. data/lib/adlint/{c → cc1}/util.rb +20 -12
  94. data/lib/adlint/{c → cc1}/value.rb +699 -642
  95. data/lib/adlint/code.rb +163 -164
  96. data/lib/adlint/cpp.rb +2 -2
  97. data/lib/adlint/cpp/asm.rb +13 -14
  98. data/lib/adlint/cpp/constexpr.rb +42 -38
  99. data/lib/adlint/cpp/constexpr.y +44 -40
  100. data/lib/adlint/cpp/eval.rb +435 -435
  101. data/lib/adlint/cpp/lexer.rb +343 -340
  102. data/lib/adlint/cpp/macro.rb +188 -190
  103. data/lib/adlint/cpp/phase.rb +66 -45
  104. data/lib/adlint/cpp/scanner.rb +14 -17
  105. data/lib/adlint/cpp/source.rb +49 -55
  106. data/lib/adlint/cpp/subst.rb +65 -65
  107. data/lib/adlint/cpp/syntax.rb +155 -275
  108. data/lib/adlint/cpp/util.rb +22 -19
  109. data/lib/adlint/driver.rb +86 -93
  110. data/lib/adlint/error.rb +33 -52
  111. data/lib/adlint/exam.rb +158 -24
  112. data/lib/adlint/exam/c_builtin.rb +7 -7
  113. data/lib/adlint/exam/c_builtin/cc1_check.rb +20522 -0
  114. data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +957 -0
  115. data/lib/adlint/exam/c_builtin/cc1_code.rb +459 -0
  116. data/lib/adlint/exam/c_builtin/cc1_metric.rb +794 -0
  117. data/lib/adlint/exam/c_builtin/cpp_check.rb +486 -441
  118. data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +36 -39
  119. data/lib/adlint/exam/c_builtin/cpp_code.rb +63 -65
  120. data/lib/adlint/exam/c_builtin/ld_check.rb +136 -129
  121. data/lib/adlint/exam/c_builtin/ld_metric.rb +11 -11
  122. data/lib/adlint/lang.rb +25 -25
  123. data/lib/adlint/ld.rb +2 -2
  124. data/lib/adlint/ld/object.rb +220 -188
  125. data/lib/adlint/ld/phase.rb +94 -63
  126. data/lib/adlint/ld/typedef.rb +22 -11
  127. data/lib/adlint/ld/util.rb +43 -35
  128. data/lib/adlint/lexer.rb +59 -56
  129. data/lib/adlint/location.rb +140 -0
  130. data/lib/adlint/memo.rb +157 -0
  131. data/lib/adlint/message.rb +207 -156
  132. data/lib/adlint/metric.rb +139 -217
  133. data/lib/adlint/monitor.rb +45 -43
  134. data/lib/adlint/phase.rb +56 -29
  135. data/lib/adlint/prelude.rb +66 -54
  136. data/lib/adlint/report.rb +253 -332
  137. data/lib/adlint/source.rb +26 -27
  138. data/lib/adlint/supp.rb +131 -0
  139. data/lib/adlint/symbol.rb +14 -16
  140. data/lib/adlint/token.rb +19 -91
  141. data/lib/adlint/traits.rb +242 -226
  142. data/lib/adlint/util.rb +116 -205
  143. data/lib/adlint/version.rb +8 -8
  144. data/share/HEADER +2 -2
  145. data/share/doc/developers_guide_ja.html +148 -19
  146. data/share/doc/developers_guide_ja.texi +141 -11
  147. data/share/doc/samples/GNUmakefile +1 -1
  148. data/share/doc/samples/adlint_traits.yml +45 -36
  149. data/share/doc/users_guide_en.html +1321 -1252
  150. data/share/doc/users_guide_en.texi +475 -408
  151. data/share/doc/users_guide_ja.html +1932 -1878
  152. data/share/doc/users_guide_ja.texi +324 -273
  153. data/share/sample/bison-2.5/adlint/GNUmakefile +5 -1
  154. data/share/sample/bison-2.5/adlint/adlint_traits.yml +38 -38
  155. data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
  156. data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
  157. data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
  158. data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +50 -42
  159. data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
  160. data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
  161. data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
  162. data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +50 -42
  163. data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
  164. data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
  165. data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
  166. data/share/sample/ctags-5.8/adlint/adlint_traits.yml +50 -42
  167. data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
  168. data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
  169. data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
  170. data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +50 -42
  171. data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
  172. data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +46 -38
  173. data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
  174. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
  175. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
  176. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +50 -42
  177. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
  178. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
  179. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
  180. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +50 -42
  181. data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
  182. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
  183. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
  184. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +50 -42
  185. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
  186. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
  187. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
  188. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +50 -42
  189. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
  190. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
  191. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
  192. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +50 -42
  193. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
  194. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
  195. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
  196. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +50 -42
  197. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
  198. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
  199. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
  200. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +50 -42
  201. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
  202. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
  203. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
  204. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +50 -42
  205. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
  206. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
  207. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
  208. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +50 -42
  209. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
  210. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
  211. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
  212. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +50 -42
  213. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
  214. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
  215. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
  216. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +50 -42
  217. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
  218. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
  219. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
  220. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +50 -42
  221. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
  222. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
  223. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
  224. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +50 -42
  225. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
  226. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
  227. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
  228. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +50 -42
  229. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
  230. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
  231. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
  232. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +50 -42
  233. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
  234. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
  235. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
  236. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +50 -42
  237. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
  238. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
  239. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
  240. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +50 -42
  241. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
  242. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
  243. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
  244. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +50 -42
  245. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
  246. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
  247. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
  248. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +50 -42
  249. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
  250. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
  251. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
  252. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +50 -42
  253. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
  254. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
  255. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
  256. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +50 -42
  257. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
  258. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
  259. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
  260. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +50 -42
  261. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
  262. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
  263. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
  264. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +50 -42
  265. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
  266. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
  267. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
  268. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +50 -42
  269. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
  270. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
  271. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
  272. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +50 -42
  273. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
  274. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
  275. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
  276. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +50 -42
  277. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
  278. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
  279. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
  280. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +50 -42
  281. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
  282. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
  283. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
  284. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +50 -42
  285. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
  286. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
  287. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
  288. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +50 -42
  289. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
  290. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
  291. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
  292. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +50 -42
  293. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
  294. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
  295. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
  296. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +50 -42
  297. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
  298. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
  299. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
  300. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +50 -42
  301. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
  302. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
  303. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
  304. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +50 -42
  305. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
  306. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
  307. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
  308. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +50 -42
  309. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
  310. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
  311. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
  312. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +50 -42
  313. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
  314. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
  315. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
  316. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +50 -42
  317. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
  318. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
  319. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
  320. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +50 -42
  321. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
  322. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
  323. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
  324. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +50 -42
  325. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
  326. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
  327. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
  328. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +50 -42
  329. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
  330. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
  331. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
  332. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +50 -42
  333. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
  334. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
  335. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
  336. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +50 -42
  337. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
  338. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
  339. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
  340. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +50 -42
  341. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
  342. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
  343. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
  344. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +50 -42
  345. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
  346. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
  347. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
  348. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +50 -42
  349. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
  350. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
  351. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
  352. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +50 -42
  353. data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
  354. data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
  355. data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
  356. data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +50 -42
  357. data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
  358. data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
  359. data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
  360. data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +50 -42
  361. data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
  362. data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
  363. data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
  364. data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +49 -41
  365. data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
  366. data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +46 -38
  367. data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
  368. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
  369. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
  370. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +50 -42
  371. data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
  372. data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
  373. data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
  374. data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +50 -42
  375. data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
  376. data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
  377. data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
  378. data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +50 -42
  379. data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
  380. data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
  381. data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
  382. data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +50 -42
  383. data/spec/adlint/{c → cc1}/ctrlexpr_spec.rb +51 -49
  384. data/spec/adlint/{c → cc1}/domain_spec.rb +210 -179
  385. data/spec/adlint/{c → cc1}/operator_spec.rb +3 -3
  386. data/spec/adlint/{c → cc1}/syntax_spec.rb +10 -12
  387. data/spec/adlint/{c → cc1}/type_spec.rb +61 -68
  388. data/{lib/adlint/c.rb → spec/adlint/location_spec.rb} +24 -29
  389. data/spec/conf.d/default_traits.yml +38 -37
  390. data/spec/conf.d/empty_cinit.h +1 -1
  391. data/spec/conf.d/empty_pinit.h +1 -1
  392. data/spec/conf.d/project/foo.c +0 -0
  393. data/spec/spec_helper.rb +2 -2
  394. metadata +60 -40
  395. data/lib/adlint/c/domain.rb +0 -7931
  396. data/lib/adlint/c/lexer.rb +0 -252
  397. data/lib/adlint/c/phase.rb +0 -135
  398. data/lib/adlint/exam/c_builtin/c_check.rb +0 -20745
  399. data/lib/adlint/exam/c_builtin/c_check_shima.rb +0 -983
  400. data/lib/adlint/exam/c_builtin/c_code.rb +0 -477
  401. data/lib/adlint/exam/c_builtin/c_metric.rb +0 -818
@@ -1,7 +1,7 @@
1
1
  # The ISO C99 parser.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
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-2012, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -29,7 +29,7 @@
29
29
  #
30
30
  #++
31
31
 
32
- class AdLint::C::Parser
32
+ class AdLint::Cc1::Parser
33
33
 
34
34
  token IDENTIFIER
35
35
  TYPEDEF_NAME
@@ -89,35 +89,30 @@ primary_expression
89
89
  : IDENTIFIER
90
90
  {
91
91
  checkpoint(val[0].location)
92
-
93
92
  result = ObjectSpecifier.new(val[0])
94
93
  result.head_token = result.tail_token = val[0]
95
94
  }
96
95
  | CONSTANT
97
96
  {
98
97
  checkpoint(val[0].location)
99
-
100
98
  result = ConstantSpecifier.new(val[0])
101
99
  result.head_token = result.tail_token = val[0]
102
100
  }
103
101
  | STRING_LITERAL
104
102
  {
105
103
  checkpoint(val[0].location)
106
-
107
104
  result = StringLiteralSpecifier.new(val[0])
108
105
  result.head_token = result.tail_token = val[0]
109
106
  }
110
107
  | NULL
111
108
  {
112
109
  checkpoint(val[0].location)
113
-
114
110
  result = NullConstantSpecifier.new(val[0])
115
111
  result.head_token = result.tail_token = val[0]
116
112
  }
117
113
  | "(" expression ")"
118
114
  {
119
115
  checkpoint(val[0].location)
120
-
121
116
  result = GroupedExpression.new(val[1])
122
117
  result.head_token = val[0]
123
118
  result.tail_token = val[2]
@@ -125,7 +120,6 @@ primary_expression
125
120
  | "(" compound_statement ")"
126
121
  {
127
122
  checkpoint(val[0].location)
128
-
129
123
  E(:E0013, val[0].location)
130
124
  result = ErrorExpression.new(val[0])
131
125
  result.head_token = val[0]
@@ -138,7 +132,6 @@ postfix_expression
138
132
  | postfix_expression "[" expression "]"
139
133
  {
140
134
  checkpoint(val[0].location)
141
-
142
135
  result = ArraySubscriptExpression.new(val[0], val[2], val[1])
143
136
  result.head_token = val[0].head_token
144
137
  result.tail_token = val[3]
@@ -146,7 +139,6 @@ postfix_expression
146
139
  | postfix_expression "(" ")"
147
140
  {
148
141
  checkpoint(val[0].location)
149
-
150
142
  result = FunctionCallExpression.new(val[0], [], val[1])
151
143
  result.head_token = val[0].head_token
152
144
  result.tail_token = val[2]
@@ -154,7 +146,6 @@ postfix_expression
154
146
  | postfix_expression "(" argument_expression_list ")"
155
147
  {
156
148
  checkpoint(val[0].location)
157
-
158
149
  result = FunctionCallExpression.new(val[0], val[2], val [1])
159
150
  result.head_token = val[0].head_token
160
151
  result.tail_token = val[3]
@@ -162,7 +153,6 @@ postfix_expression
162
153
  | postfix_expression "." IDENTIFIER
163
154
  {
164
155
  checkpoint(val[0].location)
165
-
166
156
  result = MemberAccessByValueExpression.new(val[0], val[2], val[1])
167
157
  result.head_token = val[0].head_token
168
158
  result.tail_token = val[2]
@@ -170,7 +160,6 @@ postfix_expression
170
160
  | postfix_expression "->" IDENTIFIER
171
161
  {
172
162
  checkpoint(val[0].location)
173
-
174
163
  result = MemberAccessByPointerExpression.new(val[0], val[2], val[1])
175
164
  result.head_token = val[0].head_token
176
165
  result.tail_token = val[2]
@@ -178,7 +167,6 @@ postfix_expression
178
167
  | postfix_expression "." CONSTANT
179
168
  {
180
169
  checkpoint(val[0].location)
181
-
182
170
  result = BitAccessByValueExpression.new(val[0], val[2], val[1])
183
171
  result.head_token = val[0].head_token
184
172
  result.tail_token = val[2]
@@ -186,7 +174,6 @@ postfix_expression
186
174
  | postfix_expression "->" CONSTANT
187
175
  {
188
176
  checkpoint(val[0].location)
189
-
190
177
  result = BitAccessByPointerExpression.new(val[0], val[2], val[1])
191
178
  result.head_token = val[0].head_token
192
179
  result.tail_token = val[2]
@@ -194,7 +181,6 @@ postfix_expression
194
181
  | postfix_expression "++"
195
182
  {
196
183
  checkpoint(val[0].location)
197
-
198
184
  result = PostfixIncrementExpression.new(val[1], val[0])
199
185
  result.head_token = val[0].head_token
200
186
  result.tail_token = val[1]
@@ -202,7 +188,6 @@ postfix_expression
202
188
  | postfix_expression "--"
203
189
  {
204
190
  checkpoint(val[0].location)
205
-
206
191
  result = PostfixDecrementExpression.new(val[1], val[0])
207
192
  result.head_token = val[0].head_token
208
193
  result.tail_token = val[1]
@@ -210,7 +195,6 @@ postfix_expression
210
195
  | "(" type_name ")" "{" initializer_list "}"
211
196
  {
212
197
  checkpoint(val[0].location)
213
-
214
198
  result = CompoundLiteralExpression.new(val[1], val[4], val[0])
215
199
  result.head_token = val[0]
216
200
  result.tail_token = val[5]
@@ -218,7 +202,6 @@ postfix_expression
218
202
  | "(" type_name ")" "{" initializer_list "," "}"
219
203
  {
220
204
  checkpoint(val[0].location)
221
-
222
205
  result = CompoundLiteralExpression.new(val[1], val[4], val[0])
223
206
  result.head_token = val[0]
224
207
  result.tail_token = val[6]
@@ -229,13 +212,11 @@ argument_expression_list
229
212
  : assignment_expression
230
213
  {
231
214
  checkpoint(val[0].location)
232
-
233
215
  result = val
234
216
  }
235
217
  | argument_expression_list "," assignment_expression
236
218
  {
237
219
  checkpoint(val[0].first.location)
238
-
239
220
  result = val[0].push(val[2])
240
221
  }
241
222
  ;
@@ -245,7 +226,6 @@ unary_expression
245
226
  | "++" unary_expression
246
227
  {
247
228
  checkpoint(val[0].location)
248
-
249
229
  result = PrefixIncrementExpression.new(val[0], val[1])
250
230
  result.head_token = val[0]
251
231
  result.tail_token = val[1].tail_token
@@ -253,7 +233,6 @@ unary_expression
253
233
  | "--" unary_expression
254
234
  {
255
235
  checkpoint(val[0].location)
256
-
257
236
  result = PrefixDecrementExpression.new(val[0], val[1])
258
237
  result.head_token = val[0]
259
238
  result.tail_token = val[1].tail_token
@@ -261,7 +240,6 @@ unary_expression
261
240
  | "&" cast_expression
262
241
  {
263
242
  checkpoint(val[0].location)
264
-
265
243
  result = AddressExpression.new(val[0], val[1])
266
244
  result.head_token = val[0]
267
245
  result.tail_token = val[1].tail_token
@@ -269,7 +247,6 @@ unary_expression
269
247
  | "*" cast_expression
270
248
  {
271
249
  checkpoint(val[0].location)
272
-
273
250
  result = IndirectionExpression.new(val[0], val[1])
274
251
  result.head_token = val[0]
275
252
  result.tail_token = val[1].tail_token
@@ -277,7 +254,6 @@ unary_expression
277
254
  | unary_arithmetic_operator cast_expression
278
255
  {
279
256
  checkpoint(val[0].location)
280
-
281
257
  result = UnaryArithmeticExpression.new(val[0], val[1])
282
258
  result.head_token = val[0]
283
259
  result.tail_token = val[1].tail_token
@@ -285,7 +261,6 @@ unary_expression
285
261
  | SIZEOF unary_expression
286
262
  {
287
263
  checkpoint(val[0].location)
288
-
289
264
  result = SizeofExpression.new(val[0], val[1])
290
265
  result.head_token = val[0]
291
266
  result.tail_token = val[1].tail_token
@@ -293,7 +268,6 @@ unary_expression
293
268
  | SIZEOF "(" type_name ")"
294
269
  {
295
270
  checkpoint(val[0].location)
296
-
297
271
  result = SizeofTypeExpression.new(val[0], val[2])
298
272
  result.head_token = val[0]
299
273
  result.tail_token = val[3]
@@ -301,7 +275,6 @@ unary_expression
301
275
  | ALIGNOF unary_expression
302
276
  {
303
277
  checkpoint(val[0].location)
304
-
305
278
  result = AlignofExpression.new(val[0], val[1])
306
279
  result.head_token = val[0]
307
280
  result.tail_token = val[1].tail_token
@@ -309,7 +282,6 @@ unary_expression
309
282
  | ALIGNOF "(" type_name ")"
310
283
  {
311
284
  checkpoint(val[0].location)
312
-
313
285
  result = AlignofTypeExpression.new(val[0], val[2])
314
286
  result.head_token = val[0]
315
287
  result.tail_token = val[3]
@@ -317,7 +289,6 @@ unary_expression
317
289
  | "&&" unary_expression
318
290
  {
319
291
  checkpoint(val[0].location)
320
-
321
292
  E(:E0014, val[0].location, val[0].value)
322
293
  result = ErrorExpression.new(val[0])
323
294
  result.head_token = val[0]
@@ -337,7 +308,6 @@ cast_expression
337
308
  | "(" type_name ")" cast_expression
338
309
  {
339
310
  checkpoint(val[0].location)
340
-
341
311
  result = CastExpression.new(val[1], val[3])
342
312
  result.head_token = val[0]
343
313
  result.tail_token = val[3].tail_token
@@ -349,7 +319,6 @@ multiplicative_expression
349
319
  | multiplicative_expression "*" cast_expression
350
320
  {
351
321
  checkpoint(val[0].location)
352
-
353
322
  result = MultiplicativeExpression.new(val[1], val[0], val[2])
354
323
  result.head_token = val[0].head_token
355
324
  result.tail_token = val[2].tail_token
@@ -357,7 +326,6 @@ multiplicative_expression
357
326
  | multiplicative_expression "/" cast_expression
358
327
  {
359
328
  checkpoint(val[0].location)
360
-
361
329
  result = MultiplicativeExpression.new(val[1], val[0], val[2])
362
330
  result.head_token = val[0].head_token
363
331
  result.tail_token = val[2].tail_token
@@ -365,7 +333,6 @@ multiplicative_expression
365
333
  | multiplicative_expression "%" cast_expression
366
334
  {
367
335
  checkpoint(val[0].location)
368
-
369
336
  result = MultiplicativeExpression.new(val[1], val[0], val[2])
370
337
  result.head_token = val[0].head_token
371
338
  result.tail_token = val[2].tail_token
@@ -377,7 +344,6 @@ additive_expression
377
344
  | additive_expression "+" multiplicative_expression
378
345
  {
379
346
  checkpoint(val[0].location)
380
-
381
347
  result = AdditiveExpression.new(val[1], val[0], val[2])
382
348
  result.head_token = val[0].head_token
383
349
  result.tail_token = val[2].tail_token
@@ -385,7 +351,6 @@ additive_expression
385
351
  | additive_expression "-" multiplicative_expression
386
352
  {
387
353
  checkpoint(val[0].location)
388
-
389
354
  result = AdditiveExpression.new(val[1], val[0], val[2])
390
355
  result.head_token = val[0].head_token
391
356
  result.tail_token = val[2].tail_token
@@ -397,7 +362,6 @@ shift_expression
397
362
  | shift_expression "<<" additive_expression
398
363
  {
399
364
  checkpoint(val[0].location)
400
-
401
365
  result = ShiftExpression.new(val[1], val[0], val[2])
402
366
  result.head_token = val[0].head_token
403
367
  result.tail_token = val[2].tail_token
@@ -405,7 +369,6 @@ shift_expression
405
369
  | shift_expression ">>" additive_expression
406
370
  {
407
371
  checkpoint(val[0].location)
408
-
409
372
  result = ShiftExpression.new(val[1], val[0], val[2])
410
373
  result.head_token = val[0].head_token
411
374
  result.tail_token = val[2].tail_token
@@ -417,7 +380,6 @@ relational_expression
417
380
  | relational_expression "<" shift_expression
418
381
  {
419
382
  checkpoint(val[0].location)
420
-
421
383
  result = RelationalExpression.new(val[1], val[0], val[2])
422
384
  result.head_token = val[0].head_token
423
385
  result.tail_token = val[2].tail_token
@@ -425,7 +387,6 @@ relational_expression
425
387
  | relational_expression ">" shift_expression
426
388
  {
427
389
  checkpoint(val[0].location)
428
-
429
390
  result = RelationalExpression.new(val[1], val[0], val[2])
430
391
  result.head_token = val[0].head_token
431
392
  result.tail_token = val[2].tail_token
@@ -433,7 +394,6 @@ relational_expression
433
394
  | relational_expression "<=" shift_expression
434
395
  {
435
396
  checkpoint(val[0].location)
436
-
437
397
  result = RelationalExpression.new(val[1], val[0], val[2])
438
398
  result.head_token = val[0].head_token
439
399
  result.tail_token = val[2].tail_token
@@ -441,7 +401,6 @@ relational_expression
441
401
  | relational_expression ">=" shift_expression
442
402
  {
443
403
  checkpoint(val[0].location)
444
-
445
404
  result = RelationalExpression.new(val[1], val[0], val[2])
446
405
  result.head_token = val[0].head_token
447
406
  result.tail_token = val[2].tail_token
@@ -453,7 +412,6 @@ equality_expression
453
412
  | equality_expression "==" relational_expression
454
413
  {
455
414
  checkpoint(val[0].location)
456
-
457
415
  result = EqualityExpression.new(val[1], val[0], val[2])
458
416
  result.head_token = val[0].head_token
459
417
  result.tail_token = val[2].tail_token
@@ -461,7 +419,6 @@ equality_expression
461
419
  | equality_expression "!=" relational_expression
462
420
  {
463
421
  checkpoint(val[0].location)
464
-
465
422
  result = EqualityExpression.new(val[1], val[0], val[2])
466
423
  result.head_token = val[0].head_token
467
424
  result.tail_token = val[2].tail_token
@@ -473,7 +430,6 @@ and_expression
473
430
  | and_expression "&" equality_expression
474
431
  {
475
432
  checkpoint(val[0].location)
476
-
477
433
  result = AndExpression.new(val[1], val[0], val[2])
478
434
  result.head_token = val[0].head_token
479
435
  result.tail_token = val[2].tail_token
@@ -485,7 +441,6 @@ exclusive_or_expression
485
441
  | exclusive_or_expression "^" and_expression
486
442
  {
487
443
  checkpoint(val[0].location)
488
-
489
444
  result = ExclusiveOrExpression.new(val[1], val[0], val[2])
490
445
  result.head_token = val[0].head_token
491
446
  result.tail_token = val[2].tail_token
@@ -497,7 +452,6 @@ inclusive_or_expression
497
452
  | inclusive_or_expression "|" exclusive_or_expression
498
453
  {
499
454
  checkpoint(val[0].location)
500
-
501
455
  result = InclusiveOrExpression.new(val[1], val[0], val[2])
502
456
  result.head_token = val[0].head_token
503
457
  result.tail_token = val[2].tail_token
@@ -509,7 +463,6 @@ logical_and_expression
509
463
  | logical_and_expression "&&" inclusive_or_expression
510
464
  {
511
465
  checkpoint(val[0].location)
512
-
513
466
  result = LogicalAndExpression.new(val[1], val[0], val[2])
514
467
  result.head_token = val[0].head_token
515
468
  result.tail_token = val[2].tail_token
@@ -521,7 +474,6 @@ logical_or_expression
521
474
  | logical_or_expression "||" logical_and_expression
522
475
  {
523
476
  checkpoint(val[0].location)
524
-
525
477
  result = LogicalOrExpression.new(val[1], val[0], val[2])
526
478
  result.head_token = val[0].head_token
527
479
  result.tail_token = val[2].tail_token
@@ -533,7 +485,6 @@ conditional_expression
533
485
  | logical_or_expression "?" expression ":" conditional_expression
534
486
  {
535
487
  checkpoint(val[0].location)
536
-
537
488
  result = ConditionalExpression.new(val[0], val[2], val[4], val[1])
538
489
  result.head_token = val[0].head_token
539
490
  result.tail_token = val[4].tail_token
@@ -545,7 +496,6 @@ assignment_expression
545
496
  | cast_expression "=" assignment_expression
546
497
  {
547
498
  checkpoint(val[0].location)
548
-
549
499
  result = SimpleAssignmentExpression.new(val[1], val[0], val[2])
550
500
  result.head_token = val[0].head_token
551
501
  result.tail_token = val[2].tail_token
@@ -553,7 +503,6 @@ assignment_expression
553
503
  | cast_expression compound_assignment_operator assignment_expression
554
504
  {
555
505
  checkpoint(val[0].location)
556
-
557
506
  result = CompoundAssignmentExpression.new(val[1], val[0], val[2])
558
507
  result.head_token = val[0].head_token
559
508
  result.tail_token = val[2].tail_token
@@ -578,15 +527,11 @@ expression
578
527
  | expression "," assignment_expression
579
528
  {
580
529
  checkpoint(val[0].location)
581
-
582
530
  case val[0]
583
531
  when CommaSeparatedExpression
584
532
  result = val[0].push(val[2])
585
- result.tail_token = val[2].tail_token
586
533
  else
587
534
  result = CommaSeparatedExpression.new(val[0]).push(val[2])
588
- result.head_token = val[0].head_token
589
- result.tail_token = val[2].tail_token
590
535
  end
591
536
  }
592
537
  ;
@@ -602,21 +547,17 @@ declaration
602
547
  : declaration_specifiers ";"
603
548
  {
604
549
  checkpoint(val[0].location)
605
-
606
550
  @lexer.start_identifier_translation
607
-
608
- result = Declaration.new(val[0], [], @symbol_table)
551
+ result = Declaration.new(val[0], [], @sym_tbl)
609
552
  result.head_token = val[0].head_token
610
553
  result.tail_token = val[1]
611
554
  }
612
555
  | declaration_specifiers init_declarator_list ";"
613
556
  {
614
557
  checkpoint(val[0].location)
615
-
616
- result = Declaration.new(val[0], val[1], @symbol_table)
558
+ result = Declaration.new(val[0], val[1], @sym_tbl)
617
559
  result.head_token = val[0].head_token
618
560
  result.tail_token = val[2]
619
-
620
561
  result.items.each do |item|
621
562
  case item
622
563
  when TypedefDeclaration
@@ -633,8 +574,7 @@ global_declaration
633
574
  | init_declarator_list ";"
634
575
  {
635
576
  checkpoint(val[0].first.location)
636
-
637
- result = Declaration.new(nil, val[0], @symbol_table)
577
+ result = Declaration.new(nil, val[0], @sym_tbl)
638
578
  result.head_token = val[0].first.head_token
639
579
  result.tail_token = val[1]
640
580
  }
@@ -644,7 +584,6 @@ declaration_specifiers
644
584
  : storage_class_specifier
645
585
  {
646
586
  checkpoint(val[0].location)
647
-
648
587
  result = DeclarationSpecifiers.new
649
588
  result.storage_class_specifier = val[0]
650
589
  result.head_token = result.tail_token = val[0]
@@ -652,7 +591,6 @@ declaration_specifiers
652
591
  | declaration_specifiers storage_class_specifier
653
592
  {
654
593
  checkpoint(val[0].location)
655
-
656
594
  result = val[0]
657
595
  result.storage_class_specifier = val[1]
658
596
  result.tail_token = val[1]
@@ -660,9 +598,7 @@ declaration_specifiers
660
598
  | type_specifier
661
599
  {
662
600
  checkpoint(val[0].location)
663
-
664
601
  @lexer.stop_identifier_translation
665
-
666
602
  result = DeclarationSpecifiers.new
667
603
  result.type_specifiers.push(val[0])
668
604
  result.head_token = val[0].head_token
@@ -671,9 +607,7 @@ declaration_specifiers
671
607
  | declaration_specifiers type_specifier
672
608
  {
673
609
  checkpoint(val[0].location)
674
-
675
610
  @lexer.stop_identifier_translation
676
-
677
611
  result = val[0]
678
612
  result.type_specifiers.push(val[1])
679
613
  result.tail_token = val[1].tail_token
@@ -681,7 +615,6 @@ declaration_specifiers
681
615
  | type_qualifier
682
616
  {
683
617
  checkpoint(val[0].location)
684
-
685
618
  result = DeclarationSpecifiers.new
686
619
  result.type_qualifiers.push(val[0])
687
620
  result.head_token = result.tail_token = val[0]
@@ -689,7 +622,6 @@ declaration_specifiers
689
622
  | declaration_specifiers type_qualifier
690
623
  {
691
624
  checkpoint(val[0].location)
692
-
693
625
  result = val[0]
694
626
  result.type_qualifiers.push(val[1])
695
627
  result.tail_token = val[1]
@@ -697,7 +629,6 @@ declaration_specifiers
697
629
  | function_specifier
698
630
  {
699
631
  checkpoint(val[0].location)
700
-
701
632
  result = DeclarationSpecifiers.new
702
633
  result.function_specifier = val[0]
703
634
  result.head_token = result.tail_token = val[0]
@@ -705,7 +636,6 @@ declaration_specifiers
705
636
  | declaration_specifiers function_specifier
706
637
  {
707
638
  checkpoint(val[0].location)
708
-
709
639
  result = val[0]
710
640
  result.function_specifier = val[1]
711
641
  result.tail_token = val[1]
@@ -716,13 +646,11 @@ init_declarator_list
716
646
  : init_declarator
717
647
  {
718
648
  checkpoint(val[0].location)
719
-
720
649
  result = val
721
650
  }
722
651
  | init_declarator_list "," init_declarator
723
652
  {
724
653
  checkpoint(val[0].first.location)
725
-
726
654
  result = val[0].push(val[2])
727
655
  }
728
656
  ;
@@ -731,7 +659,6 @@ init_declarator
731
659
  : declarator
732
660
  {
733
661
  checkpoint(val[0].location)
734
-
735
662
  result = InitDeclarator.new(val[0], nil)
736
663
  result.head_token = val[0].head_token
737
664
  result.tail_token = val[0].tail_token
@@ -739,7 +666,6 @@ init_declarator
739
666
  | declarator "=" initializer
740
667
  {
741
668
  checkpoint(val[0].location)
742
-
743
669
  result = InitDeclarator.new(val[0], val[2])
744
670
  result.head_token = val[0].head_token
745
671
  result.tail_token = val[2].tail_token
@@ -758,91 +684,78 @@ type_specifier
758
684
  : VOID
759
685
  {
760
686
  checkpoint(val[0].location)
761
-
762
687
  result = StandardTypeSpecifier.new(val[0])
763
688
  result.head_token = result.tail_token = val[0]
764
689
  }
765
690
  | CHAR
766
691
  {
767
692
  checkpoint(val[0].location)
768
-
769
693
  result = StandardTypeSpecifier.new(val[0])
770
694
  result.head_token = result.tail_token = val[0]
771
695
  }
772
696
  | SHORT
773
697
  {
774
698
  checkpoint(val[0].location)
775
-
776
699
  result = StandardTypeSpecifier.new(val[0])
777
700
  result.head_token = result.tail_token = val[0]
778
701
  }
779
702
  | INT
780
703
  {
781
704
  checkpoint(val[0].location)
782
-
783
705
  result = StandardTypeSpecifier.new(val[0])
784
706
  result.head_token = result.tail_token = val[0]
785
707
  }
786
708
  | LONG
787
709
  {
788
710
  checkpoint(val[0].location)
789
-
790
711
  result = StandardTypeSpecifier.new(val[0])
791
712
  result.head_token = result.tail_token = val[0]
792
713
  }
793
714
  | FLOAT
794
715
  {
795
716
  checkpoint(val[0].location)
796
-
797
717
  result = StandardTypeSpecifier.new(val[0])
798
718
  result.head_token = result.tail_token = val[0]
799
719
  }
800
720
  | DOUBLE
801
721
  {
802
722
  checkpoint(val[0].location)
803
-
804
723
  result = StandardTypeSpecifier.new(val[0])
805
724
  result.head_token = result.tail_token = val[0]
806
725
  }
807
726
  | SIGNED
808
727
  {
809
728
  checkpoint(val[0].location)
810
-
811
729
  result = StandardTypeSpecifier.new(val[0])
812
730
  result.head_token = result.tail_token = val[0]
813
731
  }
814
732
  | UNSIGNED
815
733
  {
816
734
  checkpoint(val[0].location)
817
-
818
735
  result = StandardTypeSpecifier.new(val[0])
819
736
  result.head_token = result.tail_token = val[0]
820
737
  }
821
738
  | BOOL
822
739
  {
823
740
  checkpoint(val[0].location)
824
-
825
741
  result = StandardTypeSpecifier.new(val[0])
826
742
  result.head_token = result.tail_token = val[0]
827
743
  }
828
744
  | COMPLEX
829
745
  {
830
746
  checkpoint(val[0].location)
831
-
832
747
  result = StandardTypeSpecifier.new(val[0])
833
748
  result.head_token = result.tail_token = val[0]
834
749
  }
835
750
  | IMAGINARY
836
751
  {
837
752
  checkpoint(val[0].location)
838
-
839
753
  result = StandardTypeSpecifier.new(val[0])
840
754
  result.head_token = result.tail_token = val[0]
841
755
  }
842
756
  | TYPEDEF_NAME
843
757
  {
844
758
  checkpoint(val[0].location)
845
-
846
759
  result = TypedefTypeSpecifier.new(val[0])
847
760
  result.head_token = result.tail_token = val[0]
848
761
  }
@@ -851,7 +764,6 @@ type_specifier
851
764
  | TYPEOF "(" constant_expression ")"
852
765
  {
853
766
  checkpoint(val[0].location)
854
-
855
767
  val[2].full = true
856
768
  result = TypeofTypeSpecifier.new(val[2], nil)
857
769
  result.head_token = val[0]
@@ -860,7 +772,6 @@ type_specifier
860
772
  | TYPEOF "(" type_name ")"
861
773
  {
862
774
  checkpoint(val[0].location)
863
-
864
775
  result = TypeofTypeSpecifier.new(nil, val[2])
865
776
  result.head_token = val[0]
866
777
  result.tail_token = val[3]
@@ -871,7 +782,6 @@ struct_or_union_specifier
871
782
  : STRUCT IDENTIFIER "{" struct_declaration_list "}"
872
783
  {
873
784
  checkpoint(val[0].location)
874
-
875
785
  result = StructSpecifier.new(val[1], val[3])
876
786
  result.head_token = val[0]
877
787
  result.tail_token = val[4]
@@ -879,7 +789,6 @@ struct_or_union_specifier
879
789
  | STRUCT IDENTIFIER "{" "}"
880
790
  {
881
791
  checkpoint(val[0].location)
882
-
883
792
  result = StructSpecifier.new(val[1], [])
884
793
  result.head_token = val[0]
885
794
  result.tail_token = val[3]
@@ -887,7 +796,6 @@ struct_or_union_specifier
887
796
  | UNION IDENTIFIER "{" struct_declaration_list "}"
888
797
  {
889
798
  checkpoint(val[0].location)
890
-
891
799
  result = UnionSpecifier.new(val[1], val[3])
892
800
  result.head_token = val[0]
893
801
  result.tail_token = val[4]
@@ -895,7 +803,6 @@ struct_or_union_specifier
895
803
  | UNION IDENTIFIER "{" "}"
896
804
  {
897
805
  checkpoint(val[0].location)
898
-
899
806
  result = UnionSpecifier.new(val[1], [])
900
807
  result.head_token = val[0]
901
808
  result.tail_token = val[3]
@@ -903,39 +810,34 @@ struct_or_union_specifier
903
810
  | STRUCT "{" struct_declaration_list "}"
904
811
  {
905
812
  checkpoint(val[0].location)
906
-
907
- result = StructSpecifier.new(create_unnamed_tag_name(val[0]), val[2])
813
+ result = StructSpecifier.new(create_anon_tag_name(val[0]), val[2])
908
814
  result.head_token = val[0]
909
815
  result.tail_token = val[3]
910
816
  }
911
817
  | STRUCT "{" "}"
912
818
  {
913
819
  checkpoint(val[0].location)
914
-
915
- result = StructSpecifier.new(create_unnamed_tag_name(val[0]), [])
820
+ result = StructSpecifier.new(create_anon_tag_name(val[0]), [])
916
821
  result.head_token = val[0]
917
822
  result.tail_token = val[2]
918
823
  }
919
824
  | UNION "{" struct_declaration_list "}"
920
825
  {
921
826
  checkpoint(val[0].location)
922
-
923
- result = UnionSpecifier.new(create_unnamed_tag_name(val[0]), val[2])
827
+ result = UnionSpecifier.new(create_anon_tag_name(val[0]), val[2])
924
828
  result.head_token = val[0]
925
829
  result.tail_token = val[3]
926
830
  }
927
831
  | UNION "{" "}"
928
832
  {
929
833
  checkpoint(val[0].location)
930
-
931
- result = UnionSpecifier.new(create_unnamed_tag_name(val[0]), [])
834
+ result = UnionSpecifier.new(create_anon_tag_name(val[0]), [])
932
835
  result.head_token = val[0]
933
836
  result.tail_token = val[2]
934
837
  }
935
838
  | STRUCT IDENTIFIER
936
839
  {
937
840
  checkpoint(val[0].location)
938
-
939
841
  result = StructSpecifier.new(val[1], nil)
940
842
  result.head_token = val[0]
941
843
  result.tail_token = val[1]
@@ -943,7 +845,6 @@ struct_or_union_specifier
943
845
  | UNION IDENTIFIER
944
846
  {
945
847
  checkpoint(val[0].location)
946
-
947
848
  result = UnionSpecifier.new(val[1], nil)
948
849
  result.head_token = val[0]
949
850
  result.tail_token = val[1]
@@ -954,13 +855,11 @@ struct_declaration_list
954
855
  : struct_declaration
955
856
  {
956
857
  checkpoint(val[0].location)
957
-
958
858
  result = val
959
859
  }
960
860
  | struct_declaration_list struct_declaration
961
861
  {
962
862
  checkpoint(val[0].first.location)
963
-
964
863
  result = val[0].push(val[1])
965
864
  }
966
865
  ;
@@ -969,9 +868,7 @@ struct_declaration
969
868
  : specifier_qualifier_list ";"
970
869
  {
971
870
  checkpoint(val[0].location)
972
-
973
871
  @lexer.start_identifier_translation
974
-
975
872
  result = StructDeclaration.new(val[0], [])
976
873
  result.head_token = val[0].head_token
977
874
  result.tail_token = val[1]
@@ -980,7 +877,6 @@ struct_declaration
980
877
  struct_declarator_list ";"
981
878
  {
982
879
  checkpoint(val[0].location)
983
-
984
880
  result = StructDeclaration.new(val[0], val[2])
985
881
  result.head_token = val[0].head_token
986
882
  result.tail_token = val[3]
@@ -991,9 +887,7 @@ specifier_qualifier_list
991
887
  : specifier_qualifier_list type_specifier
992
888
  {
993
889
  checkpoint(val[0].location)
994
-
995
890
  @lexer.stop_identifier_translation
996
-
997
891
  result = val[0]
998
892
  result.type_specifiers.push(val[1])
999
893
  result.tail_token = val[1].tail_token
@@ -1001,9 +895,7 @@ specifier_qualifier_list
1001
895
  | type_specifier
1002
896
  {
1003
897
  checkpoint(val[0].location)
1004
-
1005
898
  @lexer.stop_identifier_translation
1006
-
1007
899
  result = SpecifierQualifierList.new
1008
900
  result.type_specifiers.push(val[0])
1009
901
  result.head_token = val[0].head_token
@@ -1012,7 +904,6 @@ specifier_qualifier_list
1012
904
  | specifier_qualifier_list type_qualifier
1013
905
  {
1014
906
  checkpoint(val[0].location)
1015
-
1016
907
  result = val[0]
1017
908
  result.type_qualifiers.push(val[1])
1018
909
  result.tail_token = val[1]
@@ -1020,7 +911,6 @@ specifier_qualifier_list
1020
911
  | type_qualifier
1021
912
  {
1022
913
  checkpoint(val[0].location)
1023
-
1024
914
  result = SpecifierQualifierList.new
1025
915
  result.type_qualifiers.push(val[0])
1026
916
  result.head_token = result.tail_token = val[0]
@@ -1031,13 +921,11 @@ struct_declarator_list
1031
921
  : struct_declarator
1032
922
  {
1033
923
  checkpoint(val[0].location)
1034
-
1035
924
  result = val
1036
925
  }
1037
926
  | struct_declarator_list "," struct_declarator
1038
927
  {
1039
928
  checkpoint(val[0].first.location)
1040
-
1041
929
  result = val[0].push(val[2])
1042
930
  }
1043
931
  ;
@@ -1046,7 +934,6 @@ struct_declarator
1046
934
  : declarator
1047
935
  {
1048
936
  checkpoint(val[0].location)
1049
-
1050
937
  result = StructDeclarator.new(val[0], nil)
1051
938
  result.head_token = val[0].head_token
1052
939
  result.tail_token = val[0].tail_token
@@ -1054,7 +941,6 @@ struct_declarator
1054
941
  | ":" constant_expression
1055
942
  {
1056
943
  checkpoint(val[0].location)
1057
-
1058
944
  val[1].full = true
1059
945
  result = StructDeclarator.new(nil, val[1])
1060
946
  result.head_token = val[0]
@@ -1063,7 +949,6 @@ struct_declarator
1063
949
  | declarator ":" constant_expression
1064
950
  {
1065
951
  checkpoint(val[0].location)
1066
-
1067
952
  val[2].full = true
1068
953
  result = StructDeclarator.new(val[0], val[2])
1069
954
  result.head_token = val[0].head_token
@@ -1075,15 +960,13 @@ enum_specifier
1075
960
  : ENUM "{" enumerator_list "}"
1076
961
  {
1077
962
  checkpoint(val[0].location)
1078
-
1079
- result = EnumSpecifier.new(create_unnamed_tag_name(val[0]), val[2])
963
+ result = EnumSpecifier.new(create_anon_tag_name(val[0]), val[2])
1080
964
  result.head_token = val[0]
1081
965
  result.tail_token = val[3]
1082
966
  }
1083
967
  | ENUM IDENTIFIER "{" enumerator_list "}"
1084
968
  {
1085
969
  checkpoint(val[0].location)
1086
-
1087
970
  result = EnumSpecifier.new(val[1], val[3])
1088
971
  result.head_token = val[0]
1089
972
  result.tail_token = val[4]
@@ -1091,16 +974,14 @@ enum_specifier
1091
974
  | ENUM "{" enumerator_list "," "}"
1092
975
  {
1093
976
  checkpoint(val[0].location)
1094
-
1095
- result = EnumSpecifier.new(create_unnamed_tag_name(val[0]), val[2],
1096
- val[3])
977
+ result = EnumSpecifier.new(create_anon_tag_name(val[0]),
978
+ val[2], val[3])
1097
979
  result.head_token = val[0]
1098
980
  result.tail_token = val[4]
1099
981
  }
1100
982
  | ENUM IDENTIFIER "{" enumerator_list "," "}"
1101
983
  {
1102
984
  checkpoint(val[0].location)
1103
-
1104
985
  result = EnumSpecifier.new(val[1], val[3], val[4])
1105
986
  result.head_token = val[0]
1106
987
  result.tail_token = val[5]
@@ -1108,7 +989,6 @@ enum_specifier
1108
989
  | ENUM IDENTIFIER
1109
990
  {
1110
991
  checkpoint(val[0].location)
1111
-
1112
992
  result = EnumSpecifier.new(val[1], nil)
1113
993
  result.head_token = val[0]
1114
994
  result.tail_token = val[1]
@@ -1119,13 +999,11 @@ enumerator_list
1119
999
  : enumerator
1120
1000
  {
1121
1001
  checkpoint(val[0].location)
1122
-
1123
1002
  result = val
1124
1003
  }
1125
1004
  | enumerator_list "," enumerator
1126
1005
  {
1127
1006
  checkpoint(val[0].first.location)
1128
-
1129
1007
  result = val[0].push(val[2])
1130
1008
  }
1131
1009
  ;
@@ -1134,18 +1012,16 @@ enumerator
1134
1012
  : IDENTIFIER
1135
1013
  {
1136
1014
  checkpoint(val[0].location)
1137
-
1138
- symbol = @symbol_table.create_new_symbol(EnumeratorName, val[0])
1139
- result = Enumerator.new(val[0], nil, symbol)
1015
+ sym = @sym_tbl.create_new_symbol(EnumeratorName, val[0])
1016
+ result = Enumerator.new(val[0], nil, sym)
1140
1017
  result.head_token = result.tail_token = val[0]
1141
1018
  }
1142
1019
  | IDENTIFIER "=" constant_expression
1143
1020
  {
1144
1021
  checkpoint(val[0].location)
1145
-
1146
1022
  val[2].full = true
1147
- symbol = @symbol_table.create_new_symbol(EnumeratorName, val[0])
1148
- result = Enumerator.new(val[0], val[2], symbol)
1023
+ sym = @sym_tbl.create_new_symbol(EnumeratorName, val[0])
1024
+ result = Enumerator.new(val[0], val[2], sym)
1149
1025
  result.head_token = val[0]
1150
1026
  result.tail_token = val[2].tail_token
1151
1027
  }
@@ -1165,7 +1041,6 @@ declarator
1165
1041
  : pointer direct_declarator
1166
1042
  {
1167
1043
  checkpoint(val[0].first.location)
1168
-
1169
1044
  result = val[1]
1170
1045
  result.pointer = val[0]
1171
1046
  result.head_token = val[0].first
@@ -1174,7 +1049,6 @@ declarator
1174
1049
  | direct_declarator
1175
1050
  {
1176
1051
  checkpoint(val[0].location)
1177
-
1178
1052
  result = val[0]
1179
1053
  result.full = true
1180
1054
  }
@@ -1184,16 +1058,13 @@ direct_declarator
1184
1058
  : IDENTIFIER
1185
1059
  {
1186
1060
  checkpoint(val[0].location)
1187
-
1188
1061
  @lexer.start_identifier_translation
1189
-
1190
1062
  result = IdentifierDeclarator.new(val[0])
1191
1063
  result.head_token = result.tail_token = val[0]
1192
1064
  }
1193
1065
  | "(" declarator ")"
1194
1066
  {
1195
1067
  checkpoint(val[0].location)
1196
-
1197
1068
  result = GroupedDeclarator.new(val[1])
1198
1069
  result.head_token = val[0]
1199
1070
  result.tail_token = val[2]
@@ -1201,7 +1072,6 @@ direct_declarator
1201
1072
  | direct_declarator "[" type_qualifier_list assignment_expression "]"
1202
1073
  {
1203
1074
  checkpoint(val[0].location)
1204
-
1205
1075
  val[3].full = true
1206
1076
  result = ArrayDeclarator.new(val[0], val[3])
1207
1077
  result.head_token = val[0].head_token
@@ -1210,7 +1080,6 @@ direct_declarator
1210
1080
  | direct_declarator "[" type_qualifier_list "]"
1211
1081
  {
1212
1082
  checkpoint(val[0].location)
1213
-
1214
1083
  result = ArrayDeclarator.new(val[0], nil)
1215
1084
  result.head_token = val[0].head_token
1216
1085
  result.tail_token = val[3]
@@ -1218,7 +1087,6 @@ direct_declarator
1218
1087
  | direct_declarator "[" assignment_expression "]"
1219
1088
  {
1220
1089
  checkpoint(val[0].location)
1221
-
1222
1090
  val[2].full = true
1223
1091
  result = ArrayDeclarator.new(val[0], val[2])
1224
1092
  result.head_token = val[0].head_token
@@ -1228,7 +1096,6 @@ direct_declarator
1228
1096
  "[" STATIC type_qualifier_list assignment_expression "]"
1229
1097
  {
1230
1098
  checkpoint(val[0].location)
1231
-
1232
1099
  val[4].full = true
1233
1100
  result = ArrayDeclarator.new(val[0], val[4])
1234
1101
  result.head_token = val[0].head_token
@@ -1238,7 +1105,6 @@ direct_declarator
1238
1105
  "[" type_qualifier_list STATIC assignment_expression "]"
1239
1106
  {
1240
1107
  checkpoint(val[0].location)
1241
-
1242
1108
  val[4].full = true
1243
1109
  result = ArrayDeclarator.new(val[0], val[4])
1244
1110
  result.head_token = val[0].head_token
@@ -1247,7 +1113,6 @@ direct_declarator
1247
1113
  | direct_declarator "[" type_qualifier_list "*" "]"
1248
1114
  {
1249
1115
  checkpoint(val[0].location)
1250
-
1251
1116
  result = ArrayDeclarator.new(val[0], nil)
1252
1117
  result.head_token = val[0].head_token
1253
1118
  result.tail_token = val[4]
@@ -1255,7 +1120,6 @@ direct_declarator
1255
1120
  | direct_declarator "[" "*" "]"
1256
1121
  {
1257
1122
  checkpoint(val[0].location)
1258
-
1259
1123
  result = ArrayDeclarator.new(val[0], nil)
1260
1124
  result.head_token = val[0].head_token
1261
1125
  result.tail_token = val[3]
@@ -1263,7 +1127,6 @@ direct_declarator
1263
1127
  | direct_declarator "[" "]"
1264
1128
  {
1265
1129
  checkpoint(val[0].location)
1266
-
1267
1130
  result = ArrayDeclarator.new(val[0], nil)
1268
1131
  result.head_token = val[0].head_token
1269
1132
  result.tail_token = val[2]
@@ -1271,7 +1134,6 @@ direct_declarator
1271
1134
  | direct_declarator "(" parameter_type_list ")"
1272
1135
  {
1273
1136
  checkpoint(val[0].location)
1274
-
1275
1137
  result = AnsiFunctionDeclarator.new(val[0], val[2])
1276
1138
  result.head_token = val[0].head_token
1277
1139
  result.tail_token = val[3]
@@ -1279,7 +1141,6 @@ direct_declarator
1279
1141
  | direct_declarator "(" identifier_list ")"
1280
1142
  {
1281
1143
  checkpoint(val[0].location)
1282
-
1283
1144
  result = KandRFunctionDeclarator.new(val[0], val[2])
1284
1145
  result.head_token = val[0].head_token
1285
1146
  result.tail_token = val[3]
@@ -1287,7 +1148,6 @@ direct_declarator
1287
1148
  | direct_declarator "(" ")"
1288
1149
  {
1289
1150
  checkpoint(val[0].location)
1290
-
1291
1151
  result = AbbreviatedFunctionDeclarator.new(val[0])
1292
1152
  result.head_token = val[0].head_token
1293
1153
  result.tail_token = val[2]
@@ -1298,25 +1158,21 @@ pointer
1298
1158
  : "*"
1299
1159
  {
1300
1160
  checkpoint(val[0].location)
1301
-
1302
1161
  result = val
1303
1162
  }
1304
1163
  | "*" type_qualifier_list
1305
1164
  {
1306
1165
  checkpoint(val[0].location)
1307
-
1308
1166
  result = val[1].unshift(val[0])
1309
1167
  }
1310
1168
  | "*" pointer
1311
1169
  {
1312
1170
  checkpoint(val[0].location)
1313
-
1314
1171
  result = val[1].unshift(val[0])
1315
1172
  }
1316
1173
  | "*" type_qualifier_list pointer
1317
1174
  {
1318
1175
  checkpoint(val[0].location)
1319
-
1320
1176
  result = val[1].unshift(val[0]).concat(val[2])
1321
1177
  }
1322
1178
  ;
@@ -1325,13 +1181,11 @@ type_qualifier_list
1325
1181
  : type_qualifier
1326
1182
  {
1327
1183
  checkpoint(val[0].location)
1328
-
1329
1184
  result = val
1330
1185
  }
1331
1186
  | type_qualifier_list type_qualifier
1332
1187
  {
1333
1188
  checkpoint(val[0].first.location)
1334
-
1335
1189
  result = val[0].push(val[1])
1336
1190
  }
1337
1191
  ;
@@ -1340,7 +1194,6 @@ parameter_type_list
1340
1194
  : parameter_list
1341
1195
  {
1342
1196
  checkpoint(val[0].first.location)
1343
-
1344
1197
  result = ParameterTypeList.new(val[0], false)
1345
1198
  result.head_token = val[0].first.head_token
1346
1199
  result.tail_token = val[0].last.tail_token
@@ -1348,7 +1201,6 @@ parameter_type_list
1348
1201
  | parameter_list "," "..."
1349
1202
  {
1350
1203
  checkpoint(val[0].first.location)
1351
-
1352
1204
  result = ParameterTypeList.new(val[0], true)
1353
1205
  result.head_token = val[0].first.head_token
1354
1206
  result.tail_token = val[2]
@@ -1359,13 +1211,11 @@ parameter_list
1359
1211
  : parameter_declaration
1360
1212
  {
1361
1213
  checkpoint(val[0].location)
1362
-
1363
1214
  result = val
1364
1215
  }
1365
1216
  | parameter_list "," parameter_declaration
1366
1217
  {
1367
1218
  checkpoint(val[0].first.location)
1368
-
1369
1219
  result = val[0].push(val[2])
1370
1220
  }
1371
1221
  ;
@@ -1374,7 +1224,6 @@ parameter_declaration
1374
1224
  : declaration_specifiers declarator
1375
1225
  {
1376
1226
  checkpoint(val[0].location)
1377
-
1378
1227
  result = ParameterDeclaration.new(val[0], val[1])
1379
1228
  result.head_token = val[0].head_token
1380
1229
  result.tail_token = val[1].tail_token
@@ -1382,7 +1231,6 @@ parameter_declaration
1382
1231
  | declaration_specifiers abstract_declarator
1383
1232
  {
1384
1233
  checkpoint(val[0].location)
1385
-
1386
1234
  result = ParameterDeclaration.new(val[0], val[1])
1387
1235
  result.head_token = val[0].head_token
1388
1236
  result.tail_token = val[1].tail_token
@@ -1390,9 +1238,7 @@ parameter_declaration
1390
1238
  | declaration_specifiers
1391
1239
  {
1392
1240
  checkpoint(val[0].location)
1393
-
1394
1241
  @lexer.start_identifier_translation
1395
-
1396
1242
  result = ParameterDeclaration.new(val[0], nil)
1397
1243
  result.head_token = val[0].head_token
1398
1244
  result.tail_token = val[0].tail_token
@@ -1403,13 +1249,11 @@ identifier_list
1403
1249
  : IDENTIFIER
1404
1250
  {
1405
1251
  checkpoint(val[0].location)
1406
-
1407
1252
  result = val
1408
1253
  }
1409
1254
  | identifier_list "," IDENTIFIER
1410
1255
  {
1411
1256
  checkpoint(val[0].first.location)
1412
-
1413
1257
  result = val[0].push(val[2])
1414
1258
  }
1415
1259
  ;
@@ -1418,18 +1262,15 @@ type_name
1418
1262
  : specifier_qualifier_list
1419
1263
  {
1420
1264
  checkpoint(val[0].location)
1421
-
1422
1265
  @lexer.start_identifier_translation
1423
-
1424
- result = TypeName.new(val[0], nil, @symbol_table)
1266
+ result = TypeName.new(val[0], nil, @sym_tbl)
1425
1267
  result.head_token = val[0].head_token
1426
1268
  result.tail_token = val[0].tail_token
1427
1269
  }
1428
1270
  | specifier_qualifier_list abstract_declarator
1429
1271
  {
1430
1272
  checkpoint(val[0].location)
1431
-
1432
- result = TypeName.new(val[0], val[1], @symbol_table)
1273
+ result = TypeName.new(val[0], val[1], @sym_tbl)
1433
1274
  result.head_token = val[0].head_token
1434
1275
  result.tail_token = val[1].tail_token
1435
1276
  }
@@ -1439,9 +1280,7 @@ abstract_declarator
1439
1280
  : pointer
1440
1281
  {
1441
1282
  checkpoint(val[0].first.location)
1442
-
1443
1283
  @lexer.start_identifier_translation
1444
-
1445
1284
  result = PointerAbstractDeclarator.new(nil, val[0])
1446
1285
  result.head_token = val[0].first
1447
1286
  result.tail_token = val[0].last
@@ -1450,7 +1289,6 @@ abstract_declarator
1450
1289
  | pointer direct_abstract_declarator
1451
1290
  {
1452
1291
  checkpoint(val[0].first.location)
1453
-
1454
1292
  result = PointerAbstractDeclarator.new(val[1], val[0])
1455
1293
  result.head_token = val[0].first
1456
1294
  result.tail_token = val[1].tail_token
@@ -1459,7 +1297,6 @@ abstract_declarator
1459
1297
  | direct_abstract_declarator
1460
1298
  {
1461
1299
  checkpoint(val[0].location)
1462
-
1463
1300
  result = val[0]
1464
1301
  result.full = true
1465
1302
  }
@@ -1469,9 +1306,7 @@ direct_abstract_declarator
1469
1306
  : "(" abstract_declarator ")"
1470
1307
  {
1471
1308
  checkpoint(val[0].location)
1472
-
1473
1309
  @lexer.start_identifier_translation
1474
-
1475
1310
  result = GroupedAbstractDeclarator.new(val[1])
1476
1311
  result.head_token = val[0]
1477
1312
  result.tail_token = val[2]
@@ -1479,9 +1314,7 @@ direct_abstract_declarator
1479
1314
  | "[" "]"
1480
1315
  {
1481
1316
  checkpoint(val[0].location)
1482
-
1483
1317
  @lexer.start_identifier_translation
1484
-
1485
1318
  result = ArrayAbstractDeclarator.new(nil, nil)
1486
1319
  result.head_token = val[0]
1487
1320
  result.tail_token = val[1]
@@ -1489,9 +1322,7 @@ direct_abstract_declarator
1489
1322
  | "[" assignment_expression "]"
1490
1323
  {
1491
1324
  checkpoint(val[0].location)
1492
-
1493
1325
  @lexer.start_identifier_translation
1494
-
1495
1326
  val[1].full = true
1496
1327
  result = ArrayAbstractDeclarator.new(nil, val[1])
1497
1328
  result.head_token = val[0]
@@ -1500,7 +1331,6 @@ direct_abstract_declarator
1500
1331
  | direct_abstract_declarator "[" "]"
1501
1332
  {
1502
1333
  checkpoint(val[0].location)
1503
-
1504
1334
  result = ArrayAbstractDeclarator.new(val[0], nil)
1505
1335
  result.head_token = val[0].head_token
1506
1336
  result.tail_token = val[2]
@@ -1508,7 +1338,6 @@ direct_abstract_declarator
1508
1338
  | direct_abstract_declarator "[" assignment_expression "]"
1509
1339
  {
1510
1340
  checkpoint(val[0].location)
1511
-
1512
1341
  val[2].full = true
1513
1342
  result = ArrayAbstractDeclarator.new(val[0], val[2])
1514
1343
  result.head_token = val[0].head_token
@@ -1517,9 +1346,7 @@ direct_abstract_declarator
1517
1346
  | "[" "*" "]"
1518
1347
  {
1519
1348
  checkpoint(val[0].location)
1520
-
1521
1349
  @lexer.start_identifier_translation
1522
-
1523
1350
  result = ArrayAbstractDeclarator.new(nil, nil)
1524
1351
  result.head_token = val[0]
1525
1352
  result.tail_token = val[2]
@@ -1527,7 +1354,6 @@ direct_abstract_declarator
1527
1354
  | direct_abstract_declarator "[" "*" "]"
1528
1355
  {
1529
1356
  checkpoint(val[0].location)
1530
-
1531
1357
  result = ArrayAbstractDeclarator.new(val[0], nil)
1532
1358
  result.head_token = val[0].head_token
1533
1359
  result.tail_token = val[3]
@@ -1535,9 +1361,7 @@ direct_abstract_declarator
1535
1361
  | "(" ")"
1536
1362
  {
1537
1363
  checkpoint(val[0].location)
1538
-
1539
1364
  @lexer.start_identifier_translation
1540
-
1541
1365
  result = FunctionAbstractDeclarator.new(nil, nil)
1542
1366
  result.head_token = val[0]
1543
1367
  result.tail_token = val[1]
@@ -1545,7 +1369,6 @@ direct_abstract_declarator
1545
1369
  | "(" { @lexer.start_identifier_translation } parameter_type_list ")"
1546
1370
  {
1547
1371
  checkpoint(val[0].location)
1548
-
1549
1372
  result = FunctionAbstractDeclarator.new(nil, val[2])
1550
1373
  result.head_token = val[0]
1551
1374
  result.tail_token = val[3]
@@ -1553,9 +1376,7 @@ direct_abstract_declarator
1553
1376
  | direct_abstract_declarator "(" ")"
1554
1377
  {
1555
1378
  checkpoint(val[0].location)
1556
-
1557
1379
  @lexer.start_identifier_translation
1558
-
1559
1380
  result = FunctionAbstractDeclarator.new(val[0], nil)
1560
1381
  result.head_token = val[0].head_token
1561
1382
  result.tail_token = val[2]
@@ -1563,7 +1384,6 @@ direct_abstract_declarator
1563
1384
  | direct_abstract_declarator "(" parameter_type_list ")"
1564
1385
  {
1565
1386
  checkpoint(val[0].location)
1566
-
1567
1387
  result = FunctionAbstractDeclarator.new(val[0], val[2])
1568
1388
  result.head_token = val[0].head_token
1569
1389
  result.tail_token = val[3]
@@ -1574,7 +1394,6 @@ initializer
1574
1394
  : assignment_expression
1575
1395
  {
1576
1396
  checkpoint(val[0].location)
1577
-
1578
1397
  val[0].full = true
1579
1398
  result = Initializer.new(val[0], nil)
1580
1399
  result.head_token = val[0].head_token
@@ -1583,7 +1402,6 @@ initializer
1583
1402
  | "{" "}"
1584
1403
  {
1585
1404
  checkpoint(val[0].location)
1586
-
1587
1405
  result = Initializer.new(nil, nil)
1588
1406
  result.head_token = val[0]
1589
1407
  result.tail_token = val[1]
@@ -1591,7 +1409,6 @@ initializer
1591
1409
  | "{" initializer_list "}"
1592
1410
  {
1593
1411
  checkpoint(val[0].location)
1594
-
1595
1412
  result = Initializer.new(nil, val[1])
1596
1413
  result.head_token = val[0]
1597
1414
  result.tail_token = val[2]
@@ -1599,7 +1416,6 @@ initializer
1599
1416
  | "{" initializer_list "," "}"
1600
1417
  {
1601
1418
  checkpoint(val[0].location)
1602
-
1603
1419
  result = Initializer.new(nil, val[1])
1604
1420
  result.head_token = val[0]
1605
1421
  result.tail_token = val[3]
@@ -1610,25 +1426,21 @@ initializer_list
1610
1426
  : initializer
1611
1427
  {
1612
1428
  checkpoint(val[0].location)
1613
-
1614
1429
  result = val
1615
1430
  }
1616
1431
  | designation initializer
1617
1432
  {
1618
1433
  checkpoint(val[1].location)
1619
-
1620
1434
  result = [val[1]]
1621
1435
  }
1622
1436
  | initializer_list "," initializer
1623
1437
  {
1624
1438
  checkpoint(val[0].first.location)
1625
-
1626
1439
  result = val[0].push(val[2])
1627
1440
  }
1628
1441
  | initializer_list "," designation initializer
1629
1442
  {
1630
1443
  checkpoint(val[0].first.location)
1631
-
1632
1444
  result = val[0].push(val[3])
1633
1445
  }
1634
1446
  ;
@@ -1663,7 +1475,6 @@ labeled_statement
1663
1475
  : IDENTIFIER ":" statement
1664
1476
  {
1665
1477
  checkpoint(val[0].location)
1666
-
1667
1478
  result = GenericLabeledStatement.new(val[0], val[2])
1668
1479
  result.head_token = val[0]
1669
1480
  result.tail_token = val[2].tail_token
@@ -1671,7 +1482,6 @@ labeled_statement
1671
1482
  | CASE constant_expression ":" statement
1672
1483
  {
1673
1484
  checkpoint(val[0].location)
1674
-
1675
1485
  val[1].full = true
1676
1486
  result = CaseLabeledStatement.new(val[1], val[3])
1677
1487
  result.head_token = val[0]
@@ -1680,7 +1490,6 @@ labeled_statement
1680
1490
  | DEFAULT ":" statement
1681
1491
  {
1682
1492
  checkpoint(val[0].location)
1683
-
1684
1493
  result = DefaultLabeledStatement.new(val[2])
1685
1494
  result.head_token = val[0]
1686
1495
  result.tail_token = val[2].tail_token
@@ -1691,7 +1500,6 @@ compound_statement
1691
1500
  : "{" "}"
1692
1501
  {
1693
1502
  checkpoint(val[0].location)
1694
-
1695
1503
  result = CompoundStatement.new([])
1696
1504
  result.head_token = val[0]
1697
1505
  result.tail_token = val[1]
@@ -1699,7 +1507,6 @@ compound_statement
1699
1507
  | "{" { @lexer.enter_scope } block_item_list { @lexer.leave_scope } "}"
1700
1508
  {
1701
1509
  checkpoint(val[0].location)
1702
-
1703
1510
  result = CompoundStatement.new(val[2])
1704
1511
  result.head_token = val[0]
1705
1512
  result.tail_token = val[4]
@@ -1710,13 +1517,11 @@ block_item_list
1710
1517
  : block_item
1711
1518
  {
1712
1519
  checkpoint(val[0].location)
1713
-
1714
1520
  result = val
1715
1521
  }
1716
1522
  | block_item_list block_item
1717
1523
  {
1718
1524
  checkpoint(val[0].first.location)
1719
-
1720
1525
  result = val[0].push(val[1])
1721
1526
  }
1722
1527
  ;
@@ -1731,14 +1536,12 @@ expression_statement
1731
1536
  : ";"
1732
1537
  {
1733
1538
  checkpoint(val[0].location)
1734
-
1735
1539
  result = ExpressionStatement.new(nil)
1736
1540
  result.head_token = result.tail_token = val[0]
1737
1541
  }
1738
1542
  | expression ";"
1739
1543
  {
1740
1544
  checkpoint(val[0].location)
1741
-
1742
1545
  val[0].full = true
1743
1546
  result = ExpressionStatement.new(val[0])
1744
1547
  result.head_token = val[0].head_token
@@ -1750,7 +1553,6 @@ selection_statement
1750
1553
  : IF "(" expression ")" statement
1751
1554
  {
1752
1555
  checkpoint(val[0].location)
1753
-
1754
1556
  val[2].full = true
1755
1557
  result = IfStatement.new(val[2], val[4], val[3])
1756
1558
  result.head_token = val[0]
@@ -1759,7 +1561,6 @@ selection_statement
1759
1561
  | IF "(" expression ")" statement ELSE statement
1760
1562
  {
1761
1563
  checkpoint(val[0].location)
1762
-
1763
1564
  val[2].full = true
1764
1565
  result = IfElseStatement.new(val[2], val[4], val[6], val[3], val[5])
1765
1566
  result.head_token = val[0]
@@ -1768,7 +1569,6 @@ selection_statement
1768
1569
  | SWITCH "(" expression ")" statement
1769
1570
  {
1770
1571
  checkpoint(val[0].location)
1771
-
1772
1572
  val[2].full = true
1773
1573
  result = SwitchStatement.new(val[2], val[4])
1774
1574
  result.head_token = val[0]
@@ -1780,7 +1580,6 @@ iteration_statement
1780
1580
  : WHILE "(" expression ")" statement
1781
1581
  {
1782
1582
  checkpoint(val[0].location)
1783
-
1784
1583
  val[2].full = true
1785
1584
  result = WhileStatement.new(val[2], val[4], val[3])
1786
1585
  result.head_token = val[0]
@@ -1789,7 +1588,6 @@ iteration_statement
1789
1588
  | DO statement WHILE "(" expression ")" ";"
1790
1589
  {
1791
1590
  checkpoint(val[0].location)
1792
-
1793
1591
  val[4].full = true
1794
1592
  result = DoStatement.new(val[1], val[4], val[0], val[2])
1795
1593
  result.head_token = val[0]
@@ -1798,7 +1596,6 @@ iteration_statement
1798
1596
  | FOR "(" expression_statement expression_statement ")" statement
1799
1597
  {
1800
1598
  checkpoint(val[0].location)
1801
-
1802
1599
  result = ForStatement.new(val[2], val[3], nil, val[5], val[4])
1803
1600
  result.head_token = val[0]
1804
1601
  result.tail_token = val[5].tail_token
@@ -1807,7 +1604,6 @@ iteration_statement
1807
1604
  statement
1808
1605
  {
1809
1606
  checkpoint(val[0].location)
1810
-
1811
1607
  val[4].full = true
1812
1608
  result = ForStatement.new(val[2], val[3], val[4], val[6], val[5])
1813
1609
  result.head_token = val[0]
@@ -1816,7 +1612,6 @@ iteration_statement
1816
1612
  | FOR "(" declaration expression_statement ")" statement
1817
1613
  {
1818
1614
  checkpoint(val[0].location)
1819
-
1820
1615
  result = C99ForStatement.new(val[2], val[3], nil, val[5], val[4])
1821
1616
  result.head_token = val[0]
1822
1617
  result.tail_token = val[5].tail_token
@@ -1824,7 +1619,6 @@ iteration_statement
1824
1619
  | FOR "(" declaration expression_statement expression ")" statement
1825
1620
  {
1826
1621
  checkpoint(val[0].location)
1827
-
1828
1622
  val[4].full = true
1829
1623
  result = C99ForStatement.new(val[2], val[3], val[4], val[6], val[5])
1830
1624
  result.head_token = val[0]
@@ -1836,7 +1630,6 @@ jump_statement
1836
1630
  : GOTO IDENTIFIER ";"
1837
1631
  {
1838
1632
  checkpoint(val[0].location)
1839
-
1840
1633
  result = GotoStatement.new(val[1])
1841
1634
  result.head_token = val[0]
1842
1635
  result.tail_token = val[2]
@@ -1844,7 +1637,6 @@ jump_statement
1844
1637
  | GOTO "*" expression ";"
1845
1638
  {
1846
1639
  checkpoint(val[0].location)
1847
-
1848
1640
  E(:E0015, val[1].location, val[1].value)
1849
1641
  result = ErrorStatement.new(val[1])
1850
1642
  result.head_token = val[0]
@@ -1853,7 +1645,6 @@ jump_statement
1853
1645
  | CONTINUE ";"
1854
1646
  {
1855
1647
  checkpoint(val[0].location)
1856
-
1857
1648
  result = ContinueStatement.new
1858
1649
  result.head_token = val[0]
1859
1650
  result.tail_token = val[1]
@@ -1861,7 +1652,6 @@ jump_statement
1861
1652
  | BREAK ";"
1862
1653
  {
1863
1654
  checkpoint(val[0].location)
1864
-
1865
1655
  result = BreakStatement.new
1866
1656
  result.head_token = val[0]
1867
1657
  result.tail_token = val[1]
@@ -1869,7 +1659,6 @@ jump_statement
1869
1659
  | RETURN ";"
1870
1660
  {
1871
1661
  checkpoint(val[0].location)
1872
-
1873
1662
  result = ReturnStatement.new(nil)
1874
1663
  result.head_token = val[0]
1875
1664
  result.tail_token = val[1]
@@ -1877,7 +1666,6 @@ jump_statement
1877
1666
  | RETURN expression ";"
1878
1667
  {
1879
1668
  checkpoint(val[0].location)
1880
-
1881
1669
  val[1].full = true
1882
1670
  result = ReturnStatement.new(val[1])
1883
1671
  result.head_token = val[0]
@@ -1896,13 +1684,8 @@ translation_unit
1896
1684
  | translation_unit external_declaration
1897
1685
  {
1898
1686
  checkpoint(val[0].location)
1899
-
1900
1687
  result = val[0]
1901
- if result.external_declarations.empty?
1902
- result.head_token = val[1].head_token
1903
- end
1904
1688
  result.push(val[1])
1905
- result.tail_token = val[1].tail_token
1906
1689
  }
1907
1690
  ;
1908
1691
 
@@ -1915,56 +1698,46 @@ function_definition
1915
1698
  : declaration_specifiers declarator declaration_list compound_statement
1916
1699
  {
1917
1700
  checkpoint(val[0].location)
1918
-
1919
1701
  result = KandRFunctionDefinition.new(val[0], val[1], val[2], val[3],
1920
- @symbol_table)
1702
+ @sym_tbl)
1921
1703
  result.head_token = val[0].head_token
1922
1704
  result.tail_token = val[3].tail_token
1923
1705
  }
1924
1706
  | declaration_specifiers declarator compound_statement
1925
1707
  {
1926
1708
  checkpoint(val[0].location)
1927
-
1928
1709
  case val[1]
1929
1710
  when AnsiFunctionDeclarator
1930
- result = AnsiFunctionDefinition.new(val[0], val[1], val[2],
1931
- @symbol_table)
1711
+ result = AnsiFunctionDefinition.new(val[0], val[1], val[2], @sym_tbl)
1932
1712
  when KandRFunctionDeclarator
1933
1713
  result = KandRFunctionDefinition.new(val[0], val[1], [], val[2],
1934
- @symbol_table)
1714
+ @sym_tbl)
1935
1715
  when AbbreviatedFunctionDeclarator
1936
- result = AnsiFunctionDefinition.new(val[0], val[1], val[2],
1937
- @symbol_table)
1716
+ result = AnsiFunctionDefinition.new(val[0], val[1], val[2], @sym_tbl)
1938
1717
  end
1939
-
1940
1718
  result.head_token = val[0].head_token
1941
1719
  result.tail_token = val[2].tail_token
1942
1720
  }
1943
1721
  | declarator declaration_list compound_statement
1944
1722
  {
1945
1723
  checkpoint(val[0].location)
1946
-
1947
1724
  result = KandRFunctionDefinition.new(nil, val[0], val[1], val[2],
1948
- @symbol_table)
1725
+ @sym_tbl)
1949
1726
  result.head_token = val[0].head_token
1950
1727
  result.tail_token = val[2].tail_token
1951
1728
  }
1952
1729
  | declarator compound_statement
1953
1730
  {
1954
1731
  checkpoint(val[0].location)
1955
-
1956
1732
  case val[0]
1957
1733
  when AnsiFunctionDeclarator
1958
- result = AnsiFunctionDefinition.new(nil, val[0], val[1],
1959
- @symbol_table)
1734
+ result = AnsiFunctionDefinition.new(nil, val[0], val[1], @sym_tbl)
1960
1735
  when KandRFunctionDeclarator
1961
1736
  result = KandRFunctionDefinition.new(nil, val[0], [], val[1],
1962
- @symbol_table)
1737
+ @sym_tbl)
1963
1738
  when AbbreviatedFunctionDeclarator
1964
- result = AnsiFunctionDefinition.new(nil, val[0], val[1],
1965
- @symbol_table)
1739
+ result = AnsiFunctionDefinition.new(nil, val[0], val[1], @sym_tbl)
1966
1740
  end
1967
-
1968
1741
  result.head_token = val[0].head_token
1969
1742
  result.tail_token = val[1].tail_token
1970
1743
  }
@@ -1974,28 +1747,23 @@ local_function_definition
1974
1747
  : declaration_specifiers declarator declaration_list compound_statement
1975
1748
  {
1976
1749
  checkpoint(val[0].location)
1977
-
1978
1750
  result = KandRFunctionDefinition.new(val[0], val[1], val[2], val[3],
1979
- @symbol_table)
1751
+ @sym_tbl)
1980
1752
  result.head_token = val[0].head_token
1981
1753
  result.tail_token = val[3].tail_token
1982
1754
  }
1983
1755
  | declaration_specifiers declarator compound_statement
1984
1756
  {
1985
1757
  checkpoint(val[0].location)
1986
-
1987
1758
  case val[1]
1988
1759
  when AnsiFunctionDeclarator
1989
- result = AnsiFunctionDefinition.new(val[0], val[1], val[2],
1990
- @symbol_table)
1760
+ result = AnsiFunctionDefinition.new(val[0], val[1], val[2], @sym_tbl)
1991
1761
  when KandRFunctionDeclarator
1992
1762
  result = KandRFunctionDefinition.new(val[0], val[1], [], val[2],
1993
- @symbol_table)
1763
+ @sym_tbl)
1994
1764
  when AbbreviatedFunctionDeclarator
1995
- result = AnsiFunctionDefinition.new(val[0], val[1], val[2],
1996
- @symbol_table)
1765
+ result = AnsiFunctionDefinition.new(val[0], val[1], val[2], @sym_tbl)
1997
1766
  end
1998
-
1999
1767
  result.head_token = val[0].head_token
2000
1768
  result.tail_token = val[2].tail_token
2001
1769
  }
@@ -2005,13 +1773,11 @@ declaration_list
2005
1773
  : declaration
2006
1774
  {
2007
1775
  checkpoint(val[0].location)
2008
-
2009
1776
  result = val
2010
1777
  }
2011
1778
  | declaration_list declaration
2012
1779
  {
2013
1780
  checkpoint(val[0].first.location)
2014
-
2015
1781
  result = val[0].push(val[1])
2016
1782
  }
2017
1783
  ;
@@ -2024,20 +1790,20 @@ require "adlint/error"
2024
1790
  require "adlint/symbol"
2025
1791
  require "adlint/monitor"
2026
1792
  require "adlint/util"
2027
- require "adlint/c/lexer"
2028
- require "adlint/c/syntax"
1793
+ require "adlint/cc1/lexer"
1794
+ require "adlint/cc1/syntax"
2029
1795
 
2030
1796
  ---- inner
2031
1797
 
2032
- include MonitorUtil
2033
1798
  include ReportUtil
1799
+ include MonitorUtil
2034
1800
 
2035
- def initialize(context)
2036
- @context = context
2037
- @lexer = create_lexer(context[:c_source])
2038
- @symbol_table = context[:symbol_table]
1801
+ def initialize(phase_ctxt)
1802
+ @phase_ctxt = phase_ctxt
1803
+ @lexer = create_lexer(phase_ctxt[:cc1_source])
1804
+ @sym_tbl = phase_ctxt[:symbol_table]
2039
1805
  @token_array = []
2040
- @unnamed_tag_no = 0
1806
+ @anon_tag_no = 0
2041
1807
  end
2042
1808
 
2043
1809
  attr_reader :token_array
@@ -2051,8 +1817,8 @@ extend Pluggable
2051
1817
  def_plugin :on_string_literals_concatenated
2052
1818
 
2053
1819
  private
2054
- def create_lexer(c_source)
2055
- Lexer.new(c_source).tap { |lexer| attach_lexer_plugin(lexer) }
1820
+ def create_lexer(pp_src)
1821
+ Lexer.new(pp_src).tap { |lexer| attach_lexer_plugin(lexer) }
2056
1822
  end
2057
1823
 
2058
1824
  def attach_lexer_plugin(lexer)
@@ -2062,46 +1828,48 @@ def attach_lexer_plugin(lexer)
2062
1828
  end
2063
1829
 
2064
1830
  def next_token
2065
- if token = @lexer.next_token
2066
- @token_array.push(token)
2067
- [token.type, token]
1831
+ if tok = @lexer.next_token
1832
+ @token_array.push(tok)
1833
+ [tok.type, tok]
2068
1834
  else
2069
1835
  nil
2070
1836
  end
2071
1837
  end
2072
1838
 
2073
- def on_error(error_token_id, error_value, value_stack)
2074
- if first_token = @token_array[-2] and second_token = @token_array[-1]
2075
- E(:E0008, location_of(first_token),
2076
- "#{value_of(first_token)} #{value_of(second_token)}")
2077
- raise ParseError.new(location_of(first_token),
2078
- @context.msg_fpath, @context.log_fpath)
1839
+ def on_error(err_tok, err_val, *)
1840
+ if fst_tok = @token_array[-2] and snd_tok = @token_array[-1]
1841
+ E(:E0008, loc_of(fst_tok), "#{val_of(fst_tok)} #{val_of(snd_tok)}")
1842
+ raise ParseError.new(loc_of(fst_tok),
1843
+ @phase_ctxt.msg_fpath, @phase_ctxt.log_fpath)
2079
1844
  else
2080
- E(:E0008, location_of(error_value), value_of(error_value))
2081
- raise ParseError.new(location_of(error_value),
2082
- @context.msg_fpath, @context.log_fpath)
1845
+ E(:E0008, loc_of(err_val), val_of(err_val))
1846
+ raise ParseError.new(loc_of(err_val),
1847
+ @phase_ctxt.msg_fpath, @phase_ctxt.log_fpath)
2083
1848
  end
2084
1849
  end
2085
1850
 
2086
- def location_of(value)
2087
- if value == "$"
2088
- Location.new
2089
- else
2090
- value.location
2091
- end
1851
+ def loc_of(val)
1852
+ val == "$" ? Location.new : val.location
2092
1853
  end
2093
1854
 
2094
- def value_of(token)
2095
- token == "$" ? "EOF" : token.value
1855
+ def val_of(tok)
1856
+ tok == "$" ? "EOF" : tok.value
2096
1857
  end
2097
1858
 
2098
- def create_unnamed_tag_name(base_token)
2099
- Token.new(:IDENTIFIER, "__adlint__unnamed_#{@unnamed_tag_no += 1}",
2100
- base_token.location)
1859
+ def create_anon_tag_name(base_tok)
1860
+ Token.new(:IDENTIFIER, "__adlint__anon_#{@anon_tag_no += 1}",
1861
+ base_tok.location)
2101
1862
  end
2102
1863
 
2103
- def report
2104
- @context.report
2105
- end
1864
+ extend Forwardable
1865
+
1866
+ def_delegator :@phase_ctxt, :report
1867
+ private :report
1868
+
1869
+ def_delegator :@phase_ctxt, :message_catalog
1870
+ private :message_catalog
1871
+
1872
+ def_delegator :@phase_ctxt, :monitor
1873
+ private :monitor
2106
1874
 
2107
1875
  # vim:ft=racc:sw=2:ts=2:sts=2:et: