gherkin 2.12.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (333) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -15
  3. data/CONTRIBUTING.md +23 -0
  4. data/Gemfile +0 -3
  5. data/LICENSE +18 -17
  6. data/Makefile +65 -0
  7. data/README.md +9 -268
  8. data/Rakefile +17 -19
  9. data/bin/gherkin-generate-ast +21 -0
  10. data/bin/gherkin-generate-pickles +25 -0
  11. data/bin/gherkin-generate-tokens +12 -0
  12. data/gherkin-ruby.razor +218 -0
  13. data/gherkin.gemspec +22 -76
  14. data/lib/gherkin/ast_builder.rb +243 -0
  15. data/lib/gherkin/ast_node.rb +30 -0
  16. data/lib/gherkin/dialect.rb +58 -0
  17. data/lib/gherkin/errors.rb +45 -0
  18. data/lib/gherkin/gherkin-languages.json +2968 -0
  19. data/lib/gherkin/gherkin_line.rb +95 -0
  20. data/lib/gherkin/parser.rb +1910 -0
  21. data/lib/gherkin/pickles/compiler.rb +164 -0
  22. data/lib/gherkin/token.rb +18 -0
  23. data/lib/gherkin/token_formatter_builder.rb +39 -0
  24. data/lib/gherkin/token_matcher.rb +169 -0
  25. data/lib/gherkin/token_scanner.rb +40 -0
  26. data/spec/capture_warnings.rb +68 -0
  27. data/spec/coverage.rb +10 -0
  28. data/spec/gherkin/parser_spec.rb +146 -0
  29. metadata +60 -567
  30. data/.gitattributes +0 -2
  31. data/.mailmap +0 -2
  32. data/.rbenv-gemsets +0 -1
  33. data/.rspec +0 -1
  34. data/.ruby-gemset +0 -1
  35. data/.ruby-version +0 -1
  36. data/.yardopts +0 -5
  37. data/History.md +0 -881
  38. data/build_native_gems.sh +0 -7
  39. data/cucumber.yml +0 -5
  40. data/examples/parse_and_output_json.rb +0 -19
  41. data/ext/gherkin_lexer_ar/extconf.rb +0 -6
  42. data/ext/gherkin_lexer_ar/gherkin_lexer_ar.c +0 -1432
  43. data/ext/gherkin_lexer_bg/extconf.rb +0 -6
  44. data/ext/gherkin_lexer_bg/gherkin_lexer_bg.c +0 -1655
  45. data/ext/gherkin_lexer_bm/extconf.rb +0 -6
  46. data/ext/gherkin_lexer_bm/gherkin_lexer_bm.c +0 -1516
  47. data/ext/gherkin_lexer_ca/extconf.rb +0 -6
  48. data/ext/gherkin_lexer_ca/gherkin_lexer_ca.c +0 -1581
  49. data/ext/gherkin_lexer_cs/extconf.rb +0 -6
  50. data/ext/gherkin_lexer_cs/gherkin_lexer_cs.c +0 -1515
  51. data/ext/gherkin_lexer_cy_gb/extconf.rb +0 -6
  52. data/ext/gherkin_lexer_cy_gb/gherkin_lexer_cy_gb.c +0 -1282
  53. data/ext/gherkin_lexer_da/extconf.rb +0 -6
  54. data/ext/gherkin_lexer_da/gherkin_lexer_da.c +0 -1298
  55. data/ext/gherkin_lexer_de/extconf.rb +0 -6
  56. data/ext/gherkin_lexer_de/gherkin_lexer_de.c +0 -1425
  57. data/ext/gherkin_lexer_el/extconf.rb +0 -6
  58. data/ext/gherkin_lexer_el/gherkin_lexer_el.c +0 -1919
  59. data/ext/gherkin_lexer_en/extconf.rb +0 -6
  60. data/ext/gherkin_lexer_en/gherkin_lexer_en.c +0 -1418
  61. data/ext/gherkin_lexer_en_au/extconf.rb +0 -6
  62. data/ext/gherkin_lexer_en_au/gherkin_lexer_en_au.c +0 -1765
  63. data/ext/gherkin_lexer_en_lol/extconf.rb +0 -6
  64. data/ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c +0 -1177
  65. data/ext/gherkin_lexer_en_old/extconf.rb +0 -6
  66. data/ext/gherkin_lexer_en_old/gherkin_lexer_en_old.c +0 -1309
  67. data/ext/gherkin_lexer_en_pirate/extconf.rb +0 -6
  68. data/ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c +0 -1471
  69. data/ext/gherkin_lexer_en_scouse/extconf.rb +0 -6
  70. data/ext/gherkin_lexer_en_scouse/gherkin_lexer_en_scouse.c +0 -1634
  71. data/ext/gherkin_lexer_en_tx/extconf.rb +0 -6
  72. data/ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c +0 -1265
  73. data/ext/gherkin_lexer_eo/extconf.rb +0 -6
  74. data/ext/gherkin_lexer_eo/gherkin_lexer_eo.c +0 -1241
  75. data/ext/gherkin_lexer_es/extconf.rb +0 -6
  76. data/ext/gherkin_lexer_es/gherkin_lexer_es.c +0 -1399
  77. data/ext/gherkin_lexer_et/extconf.rb +0 -6
  78. data/ext/gherkin_lexer_et/gherkin_lexer_et.c +0 -1236
  79. data/ext/gherkin_lexer_fa/extconf.rb +0 -6
  80. data/ext/gherkin_lexer_fa/gherkin_lexer_fa.c +0 -1475
  81. data/ext/gherkin_lexer_fi/extconf.rb +0 -6
  82. data/ext/gherkin_lexer_fi/gherkin_lexer_fi.c +0 -1215
  83. data/ext/gherkin_lexer_fr/extconf.rb +0 -6
  84. data/ext/gherkin_lexer_fr/gherkin_lexer_fr.c +0 -1493
  85. data/ext/gherkin_lexer_gl/extconf.rb +0 -6
  86. data/ext/gherkin_lexer_gl/gherkin_lexer_gl.c +0 -1374
  87. data/ext/gherkin_lexer_he/extconf.rb +0 -6
  88. data/ext/gherkin_lexer_he/gherkin_lexer_he.c +0 -1374
  89. data/ext/gherkin_lexer_hi/extconf.rb +0 -6
  90. data/ext/gherkin_lexer_hi/gherkin_lexer_hi.c +0 -1848
  91. data/ext/gherkin_lexer_hr/extconf.rb +0 -6
  92. data/ext/gherkin_lexer_hr/gherkin_lexer_hr.c +0 -1323
  93. data/ext/gherkin_lexer_hu/extconf.rb +0 -6
  94. data/ext/gherkin_lexer_hu/gherkin_lexer_hu.c +0 -1376
  95. data/ext/gherkin_lexer_id/extconf.rb +0 -6
  96. data/ext/gherkin_lexer_id/gherkin_lexer_id.c +0 -1208
  97. data/ext/gherkin_lexer_is/extconf.rb +0 -6
  98. data/ext/gherkin_lexer_is/gherkin_lexer_is.c +0 -1376
  99. data/ext/gherkin_lexer_it/extconf.rb +0 -6
  100. data/ext/gherkin_lexer_it/gherkin_lexer_it.c +0 -1340
  101. data/ext/gherkin_lexer_ja/extconf.rb +0 -6
  102. data/ext/gherkin_lexer_ja/gherkin_lexer_ja.c +0 -1699
  103. data/ext/gherkin_lexer_kn/extconf.rb +0 -6
  104. data/ext/gherkin_lexer_kn/gherkin_lexer_kn.c +0 -1965
  105. data/ext/gherkin_lexer_ko/extconf.rb +0 -6
  106. data/ext/gherkin_lexer_ko/gherkin_lexer_ko.c +0 -1360
  107. data/ext/gherkin_lexer_lt/extconf.rb +0 -6
  108. data/ext/gherkin_lexer_lt/gherkin_lexer_lt.c +0 -1296
  109. data/ext/gherkin_lexer_lu/extconf.rb +0 -6
  110. data/ext/gherkin_lexer_lu/gherkin_lexer_lu.c +0 -1389
  111. data/ext/gherkin_lexer_lv/extconf.rb +0 -6
  112. data/ext/gherkin_lexer_lv/gherkin_lexer_lv.c +0 -1425
  113. data/ext/gherkin_lexer_nl/extconf.rb +0 -6
  114. data/ext/gherkin_lexer_nl/gherkin_lexer_nl.c +0 -1368
  115. data/ext/gherkin_lexer_no/extconf.rb +0 -6
  116. data/ext/gherkin_lexer_no/gherkin_lexer_no.c +0 -1311
  117. data/ext/gherkin_lexer_pa/extconf.rb +0 -6
  118. data/ext/gherkin_lexer_pa/gherkin_lexer_pa.c +0 -2160
  119. data/ext/gherkin_lexer_pl/extconf.rb +0 -6
  120. data/ext/gherkin_lexer_pl/gherkin_lexer_pl.c +0 -1738
  121. data/ext/gherkin_lexer_pt/extconf.rb +0 -6
  122. data/ext/gherkin_lexer_pt/gherkin_lexer_pt.c +0 -1711
  123. data/ext/gherkin_lexer_ro/extconf.rb +0 -6
  124. data/ext/gherkin_lexer_ro/gherkin_lexer_ro.c +0 -1427
  125. data/ext/gherkin_lexer_ru/extconf.rb +0 -6
  126. data/ext/gherkin_lexer_ru/gherkin_lexer_ru.c +0 -2071
  127. data/ext/gherkin_lexer_sk/extconf.rb +0 -6
  128. data/ext/gherkin_lexer_sk/gherkin_lexer_sk.c +0 -1739
  129. data/ext/gherkin_lexer_sr_cyrl/extconf.rb +0 -6
  130. data/ext/gherkin_lexer_sr_cyrl/gherkin_lexer_sr_cyrl.c +0 -2112
  131. data/ext/gherkin_lexer_sr_latn/extconf.rb +0 -6
  132. data/ext/gherkin_lexer_sr_latn/gherkin_lexer_sr_latn.c +0 -1567
  133. data/ext/gherkin_lexer_sv/extconf.rb +0 -6
  134. data/ext/gherkin_lexer_sv/gherkin_lexer_sv.c +0 -1324
  135. data/ext/gherkin_lexer_th/extconf.rb +0 -6
  136. data/ext/gherkin_lexer_th/gherkin_lexer_th.c +0 -2840
  137. data/ext/gherkin_lexer_tl/extconf.rb +0 -6
  138. data/ext/gherkin_lexer_tl/gherkin_lexer_tl.c +0 -2021
  139. data/ext/gherkin_lexer_tr/extconf.rb +0 -6
  140. data/ext/gherkin_lexer_tr/gherkin_lexer_tr.c +0 -1347
  141. data/ext/gherkin_lexer_tt/extconf.rb +0 -6
  142. data/ext/gherkin_lexer_tt/gherkin_lexer_tt.c +0 -1936
  143. data/ext/gherkin_lexer_uk/extconf.rb +0 -6
  144. data/ext/gherkin_lexer_uk/gherkin_lexer_uk.c +0 -1941
  145. data/ext/gherkin_lexer_uz/extconf.rb +0 -6
  146. data/ext/gherkin_lexer_uz/gherkin_lexer_uz.c +0 -1651
  147. data/ext/gherkin_lexer_vi/extconf.rb +0 -6
  148. data/ext/gherkin_lexer_vi/gherkin_lexer_vi.c +0 -1458
  149. data/ext/gherkin_lexer_zh_cn/extconf.rb +0 -6
  150. data/ext/gherkin_lexer_zh_cn/gherkin_lexer_zh_cn.c +0 -1314
  151. data/ext/gherkin_lexer_zh_tw/extconf.rb +0 -6
  152. data/ext/gherkin_lexer_zh_tw/gherkin_lexer_zh_tw.c +0 -1307
  153. data/features/.cucumber/stepdefs.json +0 -244
  154. data/features/escaped_pipes.feature +0 -8
  155. data/features/feature_parser.feature +0 -237
  156. data/features/json_formatter.feature +0 -498
  157. data/features/json_parser.feature +0 -331
  158. data/features/native_lexer.feature +0 -19
  159. data/features/parser_with_native_lexer.feature +0 -205
  160. data/features/pretty_formatter.feature +0 -17
  161. data/features/step_definitions/eyeball_steps.rb +0 -3
  162. data/features/step_definitions/gherkin_steps.rb +0 -29
  163. data/features/step_definitions/json_formatter_steps.rb +0 -30
  164. data/features/step_definitions/json_parser_steps.rb +0 -21
  165. data/features/step_definitions/pretty_formatter_steps.rb +0 -85
  166. data/features/steps_parser.feature +0 -46
  167. data/features/support/env.rb +0 -41
  168. data/install_mingw_os_x.sh +0 -5
  169. data/js/.npmignore +0 -1
  170. data/js/lib/gherkin/lexer/.npmignore +0 -0
  171. data/lib/gherkin.rb +0 -2
  172. data/lib/gherkin/README.md +0 -7
  173. data/lib/gherkin/c_lexer.rb +0 -17
  174. data/lib/gherkin/formatter/ansi_escapes.rb +0 -97
  175. data/lib/gherkin/formatter/argument.rb +0 -16
  176. data/lib/gherkin/formatter/escaping.rb +0 -15
  177. data/lib/gherkin/formatter/filter_formatter.rb +0 -150
  178. data/lib/gherkin/formatter/hashable.rb +0 -25
  179. data/lib/gherkin/formatter/json_formatter.rb +0 -133
  180. data/lib/gherkin/formatter/line_filter.rb +0 -26
  181. data/lib/gherkin/formatter/model.rb +0 -281
  182. data/lib/gherkin/formatter/pretty_formatter.rb +0 -245
  183. data/lib/gherkin/formatter/regexp_filter.rb +0 -21
  184. data/lib/gherkin/formatter/step_printer.rb +0 -21
  185. data/lib/gherkin/formatter/tag_count_formatter.rb +0 -47
  186. data/lib/gherkin/formatter/tag_filter.rb +0 -19
  187. data/lib/gherkin/i18n.json +0 -786
  188. data/lib/gherkin/i18n.rb +0 -176
  189. data/lib/gherkin/json_parser.rb +0 -177
  190. data/lib/gherkin/lexer/ar.rb +0 -1170
  191. data/lib/gherkin/lexer/bg.rb +0 -1382
  192. data/lib/gherkin/lexer/bm.rb +0 -1250
  193. data/lib/gherkin/lexer/ca.rb +0 -1310
  194. data/lib/gherkin/lexer/cs.rb +0 -1246
  195. data/lib/gherkin/lexer/cy_gb.rb +0 -1032
  196. data/lib/gherkin/lexer/da.rb +0 -1048
  197. data/lib/gherkin/lexer/de.rb +0 -1166
  198. data/lib/gherkin/lexer/el.rb +0 -1628
  199. data/lib/gherkin/lexer/en.rb +0 -1156
  200. data/lib/gherkin/lexer/en_au.rb +0 -1486
  201. data/lib/gherkin/lexer/en_lol.rb +0 -934
  202. data/lib/gherkin/lexer/en_old.rb +0 -1037
  203. data/lib/gherkin/lexer/en_pirate.rb +0 -1210
  204. data/lib/gherkin/lexer/en_scouse.rb +0 -1362
  205. data/lib/gherkin/lexer/en_tx.rb +0 -1016
  206. data/lib/gherkin/lexer/encoding.rb +0 -41
  207. data/lib/gherkin/lexer/eo.rb +0 -995
  208. data/lib/gherkin/lexer/es.rb +0 -1140
  209. data/lib/gherkin/lexer/et.rb +0 -990
  210. data/lib/gherkin/lexer/fa.rb +0 -1214
  211. data/lib/gherkin/lexer/fi.rb +0 -969
  212. data/lib/gherkin/lexer/fr.rb +0 -1228
  213. data/lib/gherkin/lexer/gl.rb +0 -1117
  214. data/lib/gherkin/lexer/he.rb +0 -1118
  215. data/lib/gherkin/lexer/hi.rb +0 -1559
  216. data/lib/gherkin/lexer/hr.rb +0 -1066
  217. data/lib/gherkin/lexer/hu.rb +0 -1118
  218. data/lib/gherkin/lexer/i18n_lexer.rb +0 -48
  219. data/lib/gherkin/lexer/id.rb +0 -963
  220. data/lib/gherkin/lexer/is.rb +0 -1120
  221. data/lib/gherkin/lexer/it.rb +0 -1086
  222. data/lib/gherkin/lexer/ja.rb +0 -1418
  223. data/lib/gherkin/lexer/kn.rb +0 -1672
  224. data/lib/gherkin/lexer/ko.rb +0 -1102
  225. data/lib/gherkin/lexer/lt.rb +0 -1045
  226. data/lib/gherkin/lexer/lu.rb +0 -1132
  227. data/lib/gherkin/lexer/lv.rb +0 -1166
  228. data/lib/gherkin/lexer/nl.rb +0 -1115
  229. data/lib/gherkin/lexer/no.rb +0 -1060
  230. data/lib/gherkin/lexer/pa.rb +0 -1852
  231. data/lib/gherkin/lexer/pl.rb +0 -1457
  232. data/lib/gherkin/lexer/pt.rb +0 -1430
  233. data/lib/gherkin/lexer/ro.rb +0 -1164
  234. data/lib/gherkin/lexer/ru.rb +0 -1766
  235. data/lib/gherkin/lexer/sk.rb +0 -1452
  236. data/lib/gherkin/lexer/sr_cyrl.rb +0 -1803
  237. data/lib/gherkin/lexer/sr_latn.rb +0 -1294
  238. data/lib/gherkin/lexer/sv.rb +0 -1070
  239. data/lib/gherkin/lexer/th.rb +0 -2492
  240. data/lib/gherkin/lexer/tl.rb +0 -1726
  241. data/lib/gherkin/lexer/tr.rb +0 -1092
  242. data/lib/gherkin/lexer/tt.rb +0 -1643
  243. data/lib/gherkin/lexer/uk.rb +0 -1646
  244. data/lib/gherkin/lexer/uz.rb +0 -1376
  245. data/lib/gherkin/lexer/vi.rb +0 -1198
  246. data/lib/gherkin/lexer/zh_cn.rb +0 -1058
  247. data/lib/gherkin/lexer/zh_tw.rb +0 -1052
  248. data/lib/gherkin/listener/event.rb +0 -45
  249. data/lib/gherkin/listener/formatter_listener.rb +0 -150
  250. data/lib/gherkin/native.rb +0 -7
  251. data/lib/gherkin/native/java.rb +0 -72
  252. data/lib/gherkin/native/null.rb +0 -5
  253. data/lib/gherkin/native/therubyracer.rb +0 -41
  254. data/lib/gherkin/parser/meta.txt +0 -5
  255. data/lib/gherkin/parser/parser.rb +0 -166
  256. data/lib/gherkin/parser/root.txt +0 -11
  257. data/lib/gherkin/parser/steps.txt +0 -4
  258. data/lib/gherkin/platform.rb +0 -13
  259. data/lib/gherkin/rubify.rb +0 -31
  260. data/lib/gherkin/tag_expression.rb +0 -63
  261. data/ragel/lexer.c.rl.erb +0 -454
  262. data/ragel/lexer.java.rl.erb +0 -219
  263. data/ragel/lexer.js.rl.erb +0 -322
  264. data/ragel/lexer.rb.rl.erb +0 -179
  265. data/ragel/lexer_common.rl.erb +0 -50
  266. data/spec/gherkin/c_lexer_spec.rb +0 -22
  267. data/spec/gherkin/fixtures/1.feature +0 -8
  268. data/spec/gherkin/fixtures/comments_in_table.feature +0 -9
  269. data/spec/gherkin/fixtures/complex.feature +0 -45
  270. data/spec/gherkin/fixtures/complex.json +0 -139
  271. data/spec/gherkin/fixtures/complex_for_filtering.feature +0 -60
  272. data/spec/gherkin/fixtures/complex_with_tags.feature +0 -61
  273. data/spec/gherkin/fixtures/dos_line_endings.feature +0 -45
  274. data/spec/gherkin/fixtures/examples_with_only_header.feature +0 -14
  275. data/spec/gherkin/fixtures/hantu_pisang.feature +0 -35
  276. data/spec/gherkin/fixtures/i18n_fr.feature +0 -14
  277. data/spec/gherkin/fixtures/i18n_fr2.feature +0 -8
  278. data/spec/gherkin/fixtures/i18n_no.feature +0 -7
  279. data/spec/gherkin/fixtures/i18n_pt1.feature +0 -44
  280. data/spec/gherkin/fixtures/i18n_pt2.feature +0 -4
  281. data/spec/gherkin/fixtures/i18n_pt3.feature +0 -4
  282. data/spec/gherkin/fixtures/i18n_pt4.feature +0 -4
  283. data/spec/gherkin/fixtures/i18n_zh-CN.feature +0 -9
  284. data/spec/gherkin/fixtures/iso-8859-1.feature +0 -6
  285. data/spec/gherkin/fixtures/issue_145.feature +0 -22
  286. data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +0 -13
  287. data/spec/gherkin/fixtures/scenario_without_steps.feature +0 -5
  288. data/spec/gherkin/fixtures/simple_with_comments.feature +0 -7
  289. data/spec/gherkin/fixtures/simple_with_tags.feature +0 -11
  290. data/spec/gherkin/fixtures/with_bom.feature +0 -3
  291. data/spec/gherkin/fixtures/with_bom_and_language_spec.feature +0 -4
  292. data/spec/gherkin/formatter/ansi_escapes_spec.rb +0 -32
  293. data/spec/gherkin/formatter/filter_formatter_spec.rb +0 -204
  294. data/spec/gherkin/formatter/json_formatter_spec.rb +0 -179
  295. data/spec/gherkin/formatter/model_spec.rb +0 -28
  296. data/spec/gherkin/formatter/pretty_formatter_spec.rb +0 -184
  297. data/spec/gherkin/formatter/spaces.feature +0 -9
  298. data/spec/gherkin/formatter/step_printer_spec.rb +0 -55
  299. data/spec/gherkin/formatter/tabs.feature +0 -9
  300. data/spec/gherkin/formatter/tag_count_formatter_spec.rb +0 -30
  301. data/spec/gherkin/i18n_spec.rb +0 -256
  302. data/spec/gherkin/java_lexer_spec.rb +0 -20
  303. data/spec/gherkin/json_parser_spec.rb +0 -165
  304. data/spec/gherkin/lexer/i18n_lexer_spec.rb +0 -65
  305. data/spec/gherkin/native_lexer_spec.rb +0 -29
  306. data/spec/gherkin/parser/parser_spec.rb +0 -16
  307. data/spec/gherkin/rubify_spec.rb +0 -23
  308. data/spec/gherkin/sexp_recorder.rb +0 -59
  309. data/spec/gherkin/shared/doc_string_group.rb +0 -161
  310. data/spec/gherkin/shared/encoding_group.rb +0 -48
  311. data/spec/gherkin/shared/lexer_group.rb +0 -589
  312. data/spec/gherkin/shared/row_group.rb +0 -123
  313. data/spec/gherkin/shared/tags_group.rb +0 -52
  314. data/spec/gherkin/tag_expression_spec.rb +0 -146
  315. data/spec/spec_helper.rb +0 -94
  316. data/tasks/apidoc.rake +0 -32
  317. data/tasks/bench.rake +0 -184
  318. data/tasks/bench/feature_builder.rb +0 -49
  319. data/tasks/bench/null_listener.rb +0 -4
  320. data/tasks/compile.rake +0 -83
  321. data/tasks/cucumber.rake +0 -23
  322. data/tasks/gems.rake +0 -46
  323. data/tasks/ikvm.rake +0 -126
  324. data/tasks/ragel_task.rb +0 -124
  325. data/tasks/release.rake +0 -34
  326. data/tasks/rspec.rake +0 -6
  327. data/tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  328. data/tasks/yard/default/layout/html/bubble_48x48.png +0 -0
  329. data/tasks/yard/default/layout/html/footer.erb +0 -5
  330. data/tasks/yard/default/layout/html/index.erb +0 -1
  331. data/tasks/yard/default/layout/html/layout.erb +0 -25
  332. data/tasks/yard/default/layout/html/logo.erb +0 -1
  333. data/tasks/yard/default/layout/html/setup.rb +0 -4
@@ -1,6 +0,0 @@
1
- require 'mkmf'
2
- CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
3
- $CFLAGS << ' -O0 -Wall' if CONFIG['CC'] =~ /gcc|clang/
4
- dir_config("gherkin_lexer_it")
5
- have_library("c", "main")
6
- create_makefile("gherkin_lexer_it")
@@ -1,1340 +0,0 @@
1
-
2
- #line 1 "ragel/i18n/it.c.rl"
3
- #include <assert.h>
4
- #include <ruby.h>
5
-
6
- #if defined(_WIN32)
7
- #include <stddef.h>
8
- #endif
9
-
10
- #ifdef HAVE_RUBY_RE_H
11
- #include <ruby/re.h>
12
- #else
13
- #include <re.h>
14
- #endif
15
-
16
- #ifdef HAVE_RUBY_ENCODING_H
17
- #include <ruby/encoding.h>
18
- #define ENCODED_STR_NEW(ptr, len) \
19
- rb_enc_str_new(ptr, len, rb_utf8_encoding())
20
- #else
21
- #define ENCODED_STR_NEW(ptr, len) \
22
- rb_str_new(ptr, len)
23
- #endif
24
-
25
- #ifndef RSTRING_PTR
26
- #define RSTRING_PTR(s) (RSTRING(s)->ptr)
27
- #endif
28
-
29
- #ifndef RSTRING_LEN
30
- #define RSTRING_LEN(s) (RSTRING(s)->len)
31
- #endif
32
-
33
- #define DATA_GET(FROM, TYPE, NAME) \
34
- Data_Get_Struct(FROM, TYPE, NAME); \
35
- if (NAME == NULL) { \
36
- rb_raise(rb_eArgError, "NULL found for " # NAME " when it shouldn't be."); \
37
- }
38
-
39
- typedef struct lexer_state {
40
- int content_len;
41
- int line_number;
42
- int current_line;
43
- int start_col;
44
- size_t mark;
45
- size_t keyword_start;
46
- size_t keyword_end;
47
- size_t next_keyword_start;
48
- size_t content_start;
49
- size_t content_end;
50
- size_t docstring_content_type_start;
51
- size_t docstring_content_type_end;
52
- size_t query_start;
53
- size_t last_newline;
54
- size_t final_newline;
55
- } lexer_state;
56
-
57
- static VALUE mGherkin;
58
- static VALUE mGherkinLexer;
59
- static VALUE mCLexer;
60
- static VALUE cI18nLexer;
61
- static VALUE rb_eGherkinLexingError;
62
-
63
- #define LEN(AT, P) (P - data - lexer->AT)
64
- #define MARK(M, P) (lexer->M = (P) - data)
65
- #define PTR_TO(P) (data + lexer->P)
66
-
67
- #define STORE_KW_END_CON(EVENT) \
68
- store_multiline_kw_con(listener, # EVENT, \
69
- PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end - 1)), \
70
- PTR_TO(content_start), LEN(content_start, PTR_TO(content_end)), \
71
- lexer->current_line, lexer->start_col); \
72
- if (lexer->content_end != 0) { \
73
- p = PTR_TO(content_end - 1); \
74
- } \
75
- lexer->content_end = 0
76
-
77
- #define STORE_ATTR(ATTR) \
78
- store_attr(listener, # ATTR, \
79
- PTR_TO(content_start), LEN(content_start, p), \
80
- lexer->line_number)
81
-
82
-
83
- #line 254 "ragel/i18n/it.c.rl"
84
-
85
-
86
- /** Data **/
87
-
88
- #line 89 "ext/gherkin_lexer_it/gherkin_lexer_it.c"
89
- static const char _lexer_actions[] = {
90
- 0, 1, 0, 1, 1, 1, 2, 1,
91
- 3, 1, 4, 1, 5, 1, 6, 1,
92
- 7, 1, 8, 1, 9, 1, 10, 1,
93
- 11, 1, 12, 1, 13, 1, 16, 1,
94
- 17, 1, 18, 1, 19, 1, 20, 1,
95
- 21, 1, 22, 1, 23, 2, 1, 18,
96
- 2, 4, 5, 2, 13, 0, 2, 14,
97
- 15, 2, 17, 0, 2, 17, 2, 2,
98
- 17, 16, 2, 17, 19, 2, 18, 6,
99
- 2, 18, 7, 2, 18, 8, 2, 18,
100
- 9, 2, 18, 10, 2, 18, 16, 2,
101
- 20, 21, 2, 22, 0, 2, 22, 2,
102
- 2, 22, 16, 2, 22, 19, 3, 3,
103
- 14, 15, 3, 5, 14, 15, 3, 11,
104
- 14, 15, 3, 12, 14, 15, 3, 13,
105
- 14, 15, 3, 14, 15, 18, 3, 17,
106
- 0, 11, 3, 17, 14, 15, 4, 1,
107
- 14, 15, 18, 4, 4, 5, 14, 15,
108
- 4, 17, 0, 14, 15, 5, 17, 0,
109
- 11, 14, 15
110
- };
111
-
112
- static const short _lexer_key_offsets[] = {
113
- 0, 0, 19, 20, 21, 39, 40, 41,
114
- 43, 45, 50, 55, 60, 65, 69, 73,
115
- 75, 76, 77, 78, 79, 80, 81, 82,
116
- 83, 84, 85, 86, 87, 88, 89, 90,
117
- 91, 93, 95, 100, 107, 112, 113, 114,
118
- 115, 116, 117, 118, 119, 120, 121, 122,
119
- 123, 124, 125, 126, 127, 142, 144, 146,
120
- 148, 150, 152, 154, 156, 158, 160, 162,
121
- 164, 166, 168, 170, 172, 190, 191, 192,
122
- 196, 198, 199, 200, 201, 202, 203, 204,
123
- 205, 212, 214, 216, 218, 220, 222, 224,
124
- 226, 228, 230, 232, 234, 236, 238, 239,
125
- 240, 241, 242, 243, 244, 245, 246, 247,
126
- 248, 249, 250, 251, 252, 253, 264, 266,
127
- 268, 270, 272, 274, 276, 278, 280, 282,
128
- 284, 286, 288, 290, 292, 294, 296, 298,
129
- 300, 302, 304, 306, 308, 310, 312, 314,
130
- 316, 318, 320, 322, 324, 326, 328, 330,
131
- 332, 334, 336, 338, 340, 342, 344, 347,
132
- 349, 351, 353, 355, 357, 359, 361, 363,
133
- 365, 367, 369, 371, 373, 375, 377, 379,
134
- 381, 382, 383, 384, 385, 386, 387, 389,
135
- 390, 391, 392, 393, 394, 395, 396, 397,
136
- 413, 415, 417, 419, 421, 423, 425, 427,
137
- 429, 431, 433, 435, 437, 439, 441, 443,
138
- 445, 447, 449, 451, 453, 455, 457, 459,
139
- 461, 463, 465, 467, 469, 471, 473, 478,
140
- 480, 482, 484, 486, 488, 490, 492, 494,
141
- 496, 498, 500, 502, 504, 506, 508, 510,
142
- 512, 514, 517, 519, 521, 523, 525, 527,
143
- 529, 531, 533, 535, 537, 539, 541, 543,
144
- 545, 547, 549, 551, 552, 553, 554, 555,
145
- 556, 557, 558, 559, 560, 561, 562, 563,
146
- 564, 565, 566, 567, 568, 569, 570, 571,
147
- 572, 587, 589, 591, 593, 595, 597, 599,
148
- 601, 603, 605, 607, 609, 611, 613, 615,
149
- 617, 619, 621, 623, 625, 627, 629, 631,
150
- 636, 638, 640, 642, 644, 646, 648, 650,
151
- 652, 654, 656, 658, 660, 662, 664, 666,
152
- 668, 670, 672, 674, 676, 678, 680, 682,
153
- 684, 686, 690, 696, 699, 701, 707, 725,
154
- 727, 729, 731, 733, 735, 737, 739, 744,
155
- 746, 748, 750, 752, 754, 756, 758, 760,
156
- 762, 764, 766, 768, 770, 772, 774, 776,
157
- 778, 780, 782, 785, 787, 789, 791, 793,
158
- 795, 797, 799, 801, 803, 805, 807, 809,
159
- 811, 813, 815, 817, 819, 821
160
- };
161
-
162
- static const char _lexer_trans_keys[] = {
163
- -17, 10, 32, 34, 35, 37, 42, 64,
164
- 65, 67, 68, 69, 70, 77, 81, 83,
165
- 124, 9, 13, -69, -65, 10, 32, 34,
166
- 35, 37, 42, 64, 65, 67, 68, 69,
167
- 70, 77, 81, 83, 124, 9, 13, 34,
168
- 34, 10, 13, 10, 13, 10, 32, 34,
169
- 9, 13, 10, 32, 34, 9, 13, 10,
170
- 32, 34, 9, 13, 10, 32, 34, 9,
171
- 13, 10, 32, 9, 13, 10, 32, 9,
172
- 13, 10, 13, 10, 95, 70, 69, 65,
173
- 84, 85, 82, 69, 95, 69, 78, 68,
174
- 95, 37, 32, 10, 13, 10, 13, 13,
175
- 32, 64, 9, 10, 9, 10, 13, 32,
176
- 64, 11, 12, 10, 32, 64, 9, 13,
177
- 108, 108, 111, 114, 97, 111, 110, 116,
178
- 101, 115, 116, 111, 58, 10, 10, 10,
179
- 32, 35, 37, 42, 64, 65, 68, 69,
180
- 70, 77, 81, 83, 9, 13, 10, 95,
181
- 10, 70, 10, 69, 10, 65, 10, 84,
182
- 10, 85, 10, 82, 10, 69, 10, 95,
183
- 10, 69, 10, 78, 10, 68, 10, 95,
184
- 10, 37, 10, 32, 10, 32, 34, 35,
185
- 37, 42, 64, 65, 67, 68, 69, 70,
186
- 77, 81, 83, 124, 9, 13, 97, 116,
187
- 97, 101, 105, 111, 32, 115, 101, 109,
188
- 112, 105, 58, 10, 10, 10, 32, 35,
189
- 70, 124, 9, 13, 10, 117, 10, 110,
190
- 10, 122, 10, 105, 10, 111, 10, 110,
191
- 10, 97, 10, 108, 10, 105, 10, 116,
192
- -61, 10, -96, 10, 10, 58, 117, 110,
193
- 122, 105, 111, 110, 97, 108, 105, 116,
194
- -61, -96, 58, 10, 10, 10, 32, 35,
195
- 37, 64, 67, 69, 70, 83, 9, 13,
196
- 10, 95, 10, 70, 10, 69, 10, 65,
197
- 10, 84, 10, 85, 10, 82, 10, 69,
198
- 10, 95, 10, 69, 10, 78, 10, 68,
199
- 10, 95, 10, 37, 10, 111, 10, 110,
200
- 10, 116, 10, 101, 10, 115, 10, 116,
201
- 10, 111, 10, 58, 10, 115, 10, 101,
202
- 10, 109, 10, 112, 10, 105, 10, 117,
203
- 10, 110, 10, 122, 10, 105, 10, 111,
204
- 10, 110, 10, 97, 10, 108, 10, 105,
205
- 10, 116, -61, 10, -96, 10, 10, 99,
206
- 10, 101, 104, 10, 110, 10, 97, 10,
207
- 114, 10, 105, 10, 101, 10, 109, 10,
208
- 97, 10, 32, 10, 100, 10, 101, 10,
209
- 108, 10, 108, 10, 111, 10, 32, 10,
210
- 115, 10, 99, 10, 101, 117, 97, 110,
211
- 100, 111, 99, 101, 104, 110, 97, 114,
212
- 105, 111, 58, 10, 10, 10, 32, 35,
213
- 37, 42, 64, 65, 67, 68, 69, 70,
214
- 77, 81, 83, 9, 13, 10, 95, 10,
215
- 70, 10, 69, 10, 65, 10, 84, 10,
216
- 85, 10, 82, 10, 69, 10, 95, 10,
217
- 69, 10, 78, 10, 68, 10, 95, 10,
218
- 37, 10, 32, 10, 108, 10, 108, 10,
219
- 111, 10, 114, 10, 97, 10, 111, 10,
220
- 110, 10, 116, 10, 101, 10, 115, 10,
221
- 116, 10, 111, 10, 58, 10, 97, 10,
222
- 116, 10, 97, 101, 105, 111, 10, 117,
223
- 10, 110, 10, 122, 10, 105, 10, 111,
224
- 10, 110, 10, 97, 10, 108, 10, 105,
225
- 10, 116, -61, 10, -96, 10, 10, 117,
226
- 10, 97, 10, 110, 10, 100, 10, 111,
227
- 10, 99, 10, 101, 104, 10, 110, 10,
228
- 97, 10, 114, 10, 105, 10, 101, 10,
229
- 109, 10, 97, 10, 32, 10, 100, 10,
230
- 101, 10, 108, 10, 108, 10, 111, 10,
231
- 32, 10, 115, 10, 99, 10, 101, 101,
232
- 109, 97, 32, 100, 101, 108, 108, 111,
233
- 32, 115, 99, 101, 110, 97, 114, 105,
234
- 111, 58, 10, 10, 10, 32, 35, 37,
235
- 42, 64, 65, 68, 69, 70, 77, 81,
236
- 83, 9, 13, 10, 95, 10, 70, 10,
237
- 69, 10, 65, 10, 84, 10, 85, 10,
238
- 82, 10, 69, 10, 95, 10, 69, 10,
239
- 78, 10, 68, 10, 95, 10, 37, 10,
240
- 32, 10, 108, 10, 108, 10, 111, 10,
241
- 114, 10, 97, 10, 97, 10, 116, 10,
242
- 97, 101, 105, 111, 10, 117, 10, 110,
243
- 10, 122, 10, 105, 10, 111, 10, 110,
244
- 10, 97, 10, 108, 10, 105, 10, 116,
245
- -61, 10, -96, 10, 10, 58, 10, 117,
246
- 10, 97, 10, 110, 10, 100, 10, 111,
247
- 10, 99, 10, 101, 10, 110, 10, 97,
248
- 10, 114, 10, 105, 10, 111, 32, 124,
249
- 9, 13, 10, 32, 92, 124, 9, 13,
250
- 10, 92, 124, 10, 92, 10, 32, 92,
251
- 124, 9, 13, 10, 32, 34, 35, 37,
252
- 42, 64, 65, 67, 68, 69, 70, 77,
253
- 81, 83, 124, 9, 13, 10, 108, 10,
254
- 108, 10, 111, 10, 114, 10, 97, 10,
255
- 97, 10, 116, 10, 97, 101, 105, 111,
256
- 10, 117, 10, 110, 10, 122, 10, 105,
257
- 10, 111, 10, 110, 10, 97, 10, 108,
258
- 10, 105, 10, 116, -61, 10, -96, 10,
259
- 10, 58, 10, 117, 10, 97, 10, 110,
260
- 10, 100, 10, 111, 10, 99, 10, 101,
261
- 104, 10, 110, 10, 97, 10, 114, 10,
262
- 105, 10, 111, 10, 101, 10, 109, 10,
263
- 97, 10, 32, 10, 100, 10, 101, 10,
264
- 108, 10, 108, 10, 111, 10, 32, 10,
265
- 115, 10, 99, 10, 101, 0
266
- };
267
-
268
- static const char _lexer_single_lengths[] = {
269
- 0, 17, 1, 1, 16, 1, 1, 2,
270
- 2, 3, 3, 3, 3, 2, 2, 2,
271
- 1, 1, 1, 1, 1, 1, 1, 1,
272
- 1, 1, 1, 1, 1, 1, 1, 1,
273
- 2, 2, 3, 5, 3, 1, 1, 1,
274
- 1, 1, 1, 1, 1, 1, 1, 1,
275
- 1, 1, 1, 1, 13, 2, 2, 2,
276
- 2, 2, 2, 2, 2, 2, 2, 2,
277
- 2, 2, 2, 2, 16, 1, 1, 4,
278
- 2, 1, 1, 1, 1, 1, 1, 1,
279
- 5, 2, 2, 2, 2, 2, 2, 2,
280
- 2, 2, 2, 2, 2, 2, 1, 1,
281
- 1, 1, 1, 1, 1, 1, 1, 1,
282
- 1, 1, 1, 1, 1, 9, 2, 2,
283
- 2, 2, 2, 2, 2, 2, 2, 2,
284
- 2, 2, 2, 2, 2, 2, 2, 2,
285
- 2, 2, 2, 2, 2, 2, 2, 2,
286
- 2, 2, 2, 2, 2, 2, 2, 2,
287
- 2, 2, 2, 2, 2, 2, 3, 2,
288
- 2, 2, 2, 2, 2, 2, 2, 2,
289
- 2, 2, 2, 2, 2, 2, 2, 2,
290
- 1, 1, 1, 1, 1, 1, 2, 1,
291
- 1, 1, 1, 1, 1, 1, 1, 14,
292
- 2, 2, 2, 2, 2, 2, 2, 2,
293
- 2, 2, 2, 2, 2, 2, 2, 2,
294
- 2, 2, 2, 2, 2, 2, 2, 2,
295
- 2, 2, 2, 2, 2, 2, 5, 2,
296
- 2, 2, 2, 2, 2, 2, 2, 2,
297
- 2, 2, 2, 2, 2, 2, 2, 2,
298
- 2, 3, 2, 2, 2, 2, 2, 2,
299
- 2, 2, 2, 2, 2, 2, 2, 2,
300
- 2, 2, 2, 1, 1, 1, 1, 1,
301
- 1, 1, 1, 1, 1, 1, 1, 1,
302
- 1, 1, 1, 1, 1, 1, 1, 1,
303
- 13, 2, 2, 2, 2, 2, 2, 2,
304
- 2, 2, 2, 2, 2, 2, 2, 2,
305
- 2, 2, 2, 2, 2, 2, 2, 5,
306
- 2, 2, 2, 2, 2, 2, 2, 2,
307
- 2, 2, 2, 2, 2, 2, 2, 2,
308
- 2, 2, 2, 2, 2, 2, 2, 2,
309
- 2, 2, 4, 3, 2, 4, 16, 2,
310
- 2, 2, 2, 2, 2, 2, 5, 2,
311
- 2, 2, 2, 2, 2, 2, 2, 2,
312
- 2, 2, 2, 2, 2, 2, 2, 2,
313
- 2, 2, 3, 2, 2, 2, 2, 2,
314
- 2, 2, 2, 2, 2, 2, 2, 2,
315
- 2, 2, 2, 2, 2, 0
316
- };
317
-
318
- static const char _lexer_range_lengths[] = {
319
- 0, 1, 0, 0, 1, 0, 0, 0,
320
- 0, 1, 1, 1, 1, 1, 1, 0,
321
- 0, 0, 0, 0, 0, 0, 0, 0,
322
- 0, 0, 0, 0, 0, 0, 0, 0,
323
- 0, 0, 1, 1, 1, 0, 0, 0,
324
- 0, 0, 0, 0, 0, 0, 0, 0,
325
- 0, 0, 0, 0, 1, 0, 0, 0,
326
- 0, 0, 0, 0, 0, 0, 0, 0,
327
- 0, 0, 0, 0, 1, 0, 0, 0,
328
- 0, 0, 0, 0, 0, 0, 0, 0,
329
- 1, 0, 0, 0, 0, 0, 0, 0,
330
- 0, 0, 0, 0, 0, 0, 0, 0,
331
- 0, 0, 0, 0, 0, 0, 0, 0,
332
- 0, 0, 0, 0, 0, 1, 0, 0,
333
- 0, 0, 0, 0, 0, 0, 0, 0,
334
- 0, 0, 0, 0, 0, 0, 0, 0,
335
- 0, 0, 0, 0, 0, 0, 0, 0,
336
- 0, 0, 0, 0, 0, 0, 0, 0,
337
- 0, 0, 0, 0, 0, 0, 0, 0,
338
- 0, 0, 0, 0, 0, 0, 0, 0,
339
- 0, 0, 0, 0, 0, 0, 0, 0,
340
- 0, 0, 0, 0, 0, 0, 0, 0,
341
- 0, 0, 0, 0, 0, 0, 0, 1,
342
- 0, 0, 0, 0, 0, 0, 0, 0,
343
- 0, 0, 0, 0, 0, 0, 0, 0,
344
- 0, 0, 0, 0, 0, 0, 0, 0,
345
- 0, 0, 0, 0, 0, 0, 0, 0,
346
- 0, 0, 0, 0, 0, 0, 0, 0,
347
- 0, 0, 0, 0, 0, 0, 0, 0,
348
- 0, 0, 0, 0, 0, 0, 0, 0,
349
- 0, 0, 0, 0, 0, 0, 0, 0,
350
- 0, 0, 0, 0, 0, 0, 0, 0,
351
- 0, 0, 0, 0, 0, 0, 0, 0,
352
- 0, 0, 0, 0, 0, 0, 0, 0,
353
- 1, 0, 0, 0, 0, 0, 0, 0,
354
- 0, 0, 0, 0, 0, 0, 0, 0,
355
- 0, 0, 0, 0, 0, 0, 0, 0,
356
- 0, 0, 0, 0, 0, 0, 0, 0,
357
- 0, 0, 0, 0, 0, 0, 0, 0,
358
- 0, 0, 0, 0, 0, 0, 0, 0,
359
- 0, 1, 1, 0, 0, 1, 1, 0,
360
- 0, 0, 0, 0, 0, 0, 0, 0,
361
- 0, 0, 0, 0, 0, 0, 0, 0,
362
- 0, 0, 0, 0, 0, 0, 0, 0,
363
- 0, 0, 0, 0, 0, 0, 0, 0,
364
- 0, 0, 0, 0, 0, 0, 0, 0,
365
- 0, 0, 0, 0, 0, 0
366
- };
367
-
368
- static const short _lexer_index_offsets[] = {
369
- 0, 0, 19, 21, 23, 41, 43, 45,
370
- 48, 51, 56, 61, 66, 71, 75, 79,
371
- 82, 84, 86, 88, 90, 92, 94, 96,
372
- 98, 100, 102, 104, 106, 108, 110, 112,
373
- 114, 117, 120, 125, 132, 137, 139, 141,
374
- 143, 145, 147, 149, 151, 153, 155, 157,
375
- 159, 161, 163, 165, 167, 182, 185, 188,
376
- 191, 194, 197, 200, 203, 206, 209, 212,
377
- 215, 218, 221, 224, 227, 245, 247, 249,
378
- 254, 257, 259, 261, 263, 265, 267, 269,
379
- 271, 278, 281, 284, 287, 290, 293, 296,
380
- 299, 302, 305, 308, 311, 314, 317, 319,
381
- 321, 323, 325, 327, 329, 331, 333, 335,
382
- 337, 339, 341, 343, 345, 347, 358, 361,
383
- 364, 367, 370, 373, 376, 379, 382, 385,
384
- 388, 391, 394, 397, 400, 403, 406, 409,
385
- 412, 415, 418, 421, 424, 427, 430, 433,
386
- 436, 439, 442, 445, 448, 451, 454, 457,
387
- 460, 463, 466, 469, 472, 475, 478, 482,
388
- 485, 488, 491, 494, 497, 500, 503, 506,
389
- 509, 512, 515, 518, 521, 524, 527, 530,
390
- 533, 535, 537, 539, 541, 543, 545, 548,
391
- 550, 552, 554, 556, 558, 560, 562, 564,
392
- 580, 583, 586, 589, 592, 595, 598, 601,
393
- 604, 607, 610, 613, 616, 619, 622, 625,
394
- 628, 631, 634, 637, 640, 643, 646, 649,
395
- 652, 655, 658, 661, 664, 667, 670, 676,
396
- 679, 682, 685, 688, 691, 694, 697, 700,
397
- 703, 706, 709, 712, 715, 718, 721, 724,
398
- 727, 730, 734, 737, 740, 743, 746, 749,
399
- 752, 755, 758, 761, 764, 767, 770, 773,
400
- 776, 779, 782, 785, 787, 789, 791, 793,
401
- 795, 797, 799, 801, 803, 805, 807, 809,
402
- 811, 813, 815, 817, 819, 821, 823, 825,
403
- 827, 842, 845, 848, 851, 854, 857, 860,
404
- 863, 866, 869, 872, 875, 878, 881, 884,
405
- 887, 890, 893, 896, 899, 902, 905, 908,
406
- 914, 917, 920, 923, 926, 929, 932, 935,
407
- 938, 941, 944, 947, 950, 953, 956, 959,
408
- 962, 965, 968, 971, 974, 977, 980, 983,
409
- 986, 989, 993, 999, 1003, 1006, 1012, 1030,
410
- 1033, 1036, 1039, 1042, 1045, 1048, 1051, 1057,
411
- 1060, 1063, 1066, 1069, 1072, 1075, 1078, 1081,
412
- 1084, 1087, 1090, 1093, 1096, 1099, 1102, 1105,
413
- 1108, 1111, 1114, 1118, 1121, 1124, 1127, 1130,
414
- 1133, 1136, 1139, 1142, 1145, 1148, 1151, 1154,
415
- 1157, 1160, 1163, 1166, 1169, 1172
416
- };
417
-
418
- static const short _lexer_trans_targs[] = {
419
- 2, 4, 4, 5, 15, 17, 31, 34,
420
- 37, 42, 69, 72, 94, 41, 168, 173,
421
- 321, 4, 0, 3, 0, 4, 0, 4,
422
- 4, 5, 15, 17, 31, 34, 37, 42,
423
- 69, 72, 94, 41, 168, 173, 321, 4,
424
- 0, 6, 0, 7, 0, 9, 8, 8,
425
- 9, 8, 8, 10, 10, 11, 10, 10,
426
- 10, 10, 11, 10, 10, 10, 10, 12,
427
- 10, 10, 10, 10, 13, 10, 10, 4,
428
- 14, 14, 0, 4, 14, 14, 0, 4,
429
- 16, 15, 4, 0, 18, 0, 19, 0,
430
- 20, 0, 21, 0, 22, 0, 23, 0,
431
- 24, 0, 25, 0, 26, 0, 27, 0,
432
- 28, 0, 29, 0, 30, 0, 373, 0,
433
- 32, 0, 4, 16, 33, 4, 16, 33,
434
- 0, 0, 0, 0, 35, 36, 4, 36,
435
- 36, 34, 35, 35, 4, 36, 34, 36,
436
- 0, 38, 0, 39, 0, 40, 0, 41,
437
- 0, 31, 0, 43, 0, 44, 0, 45,
438
- 0, 46, 0, 47, 0, 48, 0, 49,
439
- 0, 50, 0, 52, 51, 52, 51, 52,
440
- 52, 4, 53, 67, 4, 327, 332, 67,
441
- 335, 331, 348, 353, 52, 51, 52, 54,
442
- 51, 52, 55, 51, 52, 56, 51, 52,
443
- 57, 51, 52, 58, 51, 52, 59, 51,
444
- 52, 60, 51, 52, 61, 51, 52, 62,
445
- 51, 52, 63, 51, 52, 64, 51, 52,
446
- 65, 51, 52, 66, 51, 52, 4, 51,
447
- 52, 68, 51, 4, 4, 5, 15, 17,
448
- 31, 34, 37, 42, 69, 72, 94, 41,
449
- 168, 173, 321, 4, 0, 70, 0, 71,
450
- 0, 31, 31, 31, 31, 0, 32, 73,
451
- 0, 74, 0, 75, 0, 76, 0, 77,
452
- 0, 78, 0, 80, 79, 80, 79, 80,
453
- 80, 4, 81, 4, 80, 79, 80, 82,
454
- 79, 80, 83, 79, 80, 84, 79, 80,
455
- 85, 79, 80, 86, 79, 80, 87, 79,
456
- 80, 88, 79, 80, 89, 79, 80, 90,
457
- 79, 80, 91, 79, 92, 80, 79, 93,
458
- 80, 79, 80, 68, 79, 95, 0, 96,
459
- 0, 97, 0, 98, 0, 99, 0, 100,
460
- 0, 101, 0, 102, 0, 103, 0, 104,
461
- 0, 105, 0, 106, 0, 107, 0, 109,
462
- 108, 109, 108, 109, 109, 4, 110, 4,
463
- 124, 132, 137, 149, 109, 108, 109, 111,
464
- 108, 109, 112, 108, 109, 113, 108, 109,
465
- 114, 108, 109, 115, 108, 109, 116, 108,
466
- 109, 117, 108, 109, 118, 108, 109, 119,
467
- 108, 109, 120, 108, 109, 121, 108, 109,
468
- 122, 108, 109, 123, 108, 109, 4, 108,
469
- 109, 125, 108, 109, 126, 108, 109, 127,
470
- 108, 109, 128, 108, 109, 129, 108, 109,
471
- 130, 108, 109, 131, 108, 109, 68, 108,
472
- 109, 133, 108, 109, 134, 108, 109, 135,
473
- 108, 109, 136, 108, 109, 131, 108, 109,
474
- 138, 108, 109, 139, 108, 109, 140, 108,
475
- 109, 141, 108, 109, 142, 108, 109, 143,
476
- 108, 109, 144, 108, 109, 145, 108, 109,
477
- 146, 108, 109, 147, 108, 148, 109, 108,
478
- 131, 109, 108, 109, 150, 108, 109, 151,
479
- 155, 108, 109, 152, 108, 109, 153, 108,
480
- 109, 154, 108, 109, 130, 108, 109, 156,
481
- 108, 109, 157, 108, 109, 158, 108, 109,
482
- 159, 108, 109, 160, 108, 109, 161, 108,
483
- 109, 162, 108, 109, 163, 108, 109, 164,
484
- 108, 109, 165, 108, 109, 166, 108, 109,
485
- 167, 108, 109, 151, 108, 169, 0, 170,
486
- 0, 171, 0, 172, 0, 31, 0, 174,
487
- 0, 175, 251, 0, 176, 0, 177, 0,
488
- 178, 0, 179, 0, 180, 0, 181, 0,
489
- 183, 182, 183, 182, 183, 183, 4, 184,
490
- 198, 4, 199, 204, 212, 198, 215, 203,
491
- 227, 232, 183, 182, 183, 185, 182, 183,
492
- 186, 182, 183, 187, 182, 183, 188, 182,
493
- 183, 189, 182, 183, 190, 182, 183, 191,
494
- 182, 183, 192, 182, 183, 193, 182, 183,
495
- 194, 182, 183, 195, 182, 183, 196, 182,
496
- 183, 197, 182, 183, 4, 182, 183, 68,
497
- 182, 183, 200, 182, 183, 201, 182, 183,
498
- 202, 182, 183, 203, 182, 183, 198, 182,
499
- 183, 205, 182, 183, 206, 182, 183, 207,
500
- 182, 183, 208, 182, 183, 209, 182, 183,
501
- 210, 182, 183, 211, 182, 183, 68, 182,
502
- 183, 213, 182, 183, 214, 182, 183, 198,
503
- 198, 198, 198, 182, 183, 216, 182, 183,
504
- 217, 182, 183, 218, 182, 183, 219, 182,
505
- 183, 220, 182, 183, 221, 182, 183, 222,
506
- 182, 183, 223, 182, 183, 224, 182, 183,
507
- 225, 182, 226, 183, 182, 211, 183, 182,
508
- 183, 228, 182, 183, 229, 182, 183, 230,
509
- 182, 183, 231, 182, 183, 198, 182, 183,
510
- 233, 182, 183, 234, 238, 182, 183, 235,
511
- 182, 183, 236, 182, 183, 237, 182, 183,
512
- 210, 182, 183, 239, 182, 183, 240, 182,
513
- 183, 241, 182, 183, 242, 182, 183, 243,
514
- 182, 183, 244, 182, 183, 245, 182, 183,
515
- 246, 182, 183, 247, 182, 183, 248, 182,
516
- 183, 249, 182, 183, 250, 182, 183, 234,
517
- 182, 252, 0, 253, 0, 254, 0, 255,
518
- 0, 256, 0, 257, 0, 258, 0, 259,
519
- 0, 260, 0, 261, 0, 262, 0, 263,
520
- 0, 264, 0, 265, 0, 266, 0, 267,
521
- 0, 268, 0, 269, 0, 270, 0, 272,
522
- 271, 272, 271, 272, 272, 4, 273, 287,
523
- 4, 288, 293, 287, 296, 292, 309, 314,
524
- 272, 271, 272, 274, 271, 272, 275, 271,
525
- 272, 276, 271, 272, 277, 271, 272, 278,
526
- 271, 272, 279, 271, 272, 280, 271, 272,
527
- 281, 271, 272, 282, 271, 272, 283, 271,
528
- 272, 284, 271, 272, 285, 271, 272, 286,
529
- 271, 272, 4, 271, 272, 68, 271, 272,
530
- 289, 271, 272, 290, 271, 272, 291, 271,
531
- 272, 292, 271, 272, 287, 271, 272, 294,
532
- 271, 272, 295, 271, 272, 287, 287, 287,
533
- 287, 271, 272, 297, 271, 272, 298, 271,
534
- 272, 299, 271, 272, 300, 271, 272, 301,
535
- 271, 272, 302, 271, 272, 303, 271, 272,
536
- 304, 271, 272, 305, 271, 272, 306, 271,
537
- 307, 272, 271, 308, 272, 271, 272, 68,
538
- 271, 272, 310, 271, 272, 311, 271, 272,
539
- 312, 271, 272, 313, 271, 272, 287, 271,
540
- 272, 315, 271, 272, 316, 271, 272, 317,
541
- 271, 272, 318, 271, 272, 319, 271, 272,
542
- 320, 271, 272, 308, 271, 321, 322, 321,
543
- 0, 326, 325, 324, 322, 325, 323, 0,
544
- 324, 322, 323, 0, 324, 323, 326, 325,
545
- 324, 322, 325, 323, 326, 326, 5, 15,
546
- 17, 31, 34, 37, 42, 69, 72, 94,
547
- 41, 168, 173, 321, 326, 0, 52, 328,
548
- 51, 52, 329, 51, 52, 330, 51, 52,
549
- 331, 51, 52, 67, 51, 52, 333, 51,
550
- 52, 334, 51, 52, 67, 67, 67, 67,
551
- 51, 52, 336, 51, 52, 337, 51, 52,
552
- 338, 51, 52, 339, 51, 52, 340, 51,
553
- 52, 341, 51, 52, 342, 51, 52, 343,
554
- 51, 52, 344, 51, 52, 345, 51, 346,
555
- 52, 51, 347, 52, 51, 52, 68, 51,
556
- 52, 349, 51, 52, 350, 51, 52, 351,
557
- 51, 52, 352, 51, 52, 67, 51, 52,
558
- 354, 51, 52, 355, 360, 51, 52, 356,
559
- 51, 52, 357, 51, 52, 358, 51, 52,
560
- 359, 51, 52, 347, 51, 52, 361, 51,
561
- 52, 362, 51, 52, 363, 51, 52, 364,
562
- 51, 52, 365, 51, 52, 366, 51, 52,
563
- 367, 51, 52, 368, 51, 52, 369, 51,
564
- 52, 370, 51, 52, 371, 51, 52, 372,
565
- 51, 52, 355, 51, 0, 0
566
- };
567
-
568
- static const unsigned char _lexer_trans_actions[] = {
569
- 0, 54, 0, 5, 1, 0, 29, 1,
570
- 29, 29, 29, 29, 29, 29, 29, 29,
571
- 35, 0, 43, 0, 43, 0, 43, 54,
572
- 0, 5, 1, 0, 29, 1, 29, 29,
573
- 29, 29, 29, 29, 29, 29, 35, 0,
574
- 43, 0, 43, 0, 43, 139, 48, 9,
575
- 106, 11, 0, 134, 45, 45, 45, 3,
576
- 122, 33, 33, 33, 0, 122, 33, 33,
577
- 33, 0, 122, 33, 0, 33, 0, 102,
578
- 7, 7, 43, 54, 0, 0, 43, 114,
579
- 25, 0, 54, 43, 0, 43, 0, 43,
580
- 0, 43, 0, 43, 0, 43, 0, 43,
581
- 0, 43, 0, 43, 0, 43, 0, 43,
582
- 0, 43, 0, 43, 0, 43, 0, 43,
583
- 0, 43, 149, 126, 57, 110, 23, 0,
584
- 43, 43, 43, 43, 0, 27, 118, 27,
585
- 27, 51, 27, 0, 54, 0, 1, 0,
586
- 43, 0, 43, 0, 43, 0, 43, 0,
587
- 43, 0, 43, 0, 43, 0, 43, 0,
588
- 43, 0, 43, 0, 43, 0, 43, 0,
589
- 43, 0, 43, 144, 57, 54, 0, 54,
590
- 0, 72, 33, 84, 72, 84, 84, 84,
591
- 84, 84, 84, 84, 0, 0, 54, 0,
592
- 0, 54, 0, 0, 54, 0, 0, 54,
593
- 0, 0, 54, 0, 0, 54, 0, 0,
594
- 54, 0, 0, 54, 0, 0, 54, 0,
595
- 0, 54, 0, 0, 54, 0, 0, 54,
596
- 0, 0, 54, 0, 0, 54, 15, 0,
597
- 54, 15, 0, 130, 31, 60, 57, 31,
598
- 63, 57, 63, 63, 63, 63, 63, 63,
599
- 63, 63, 66, 31, 43, 0, 43, 0,
600
- 43, 0, 0, 0, 0, 43, 0, 0,
601
- 43, 0, 43, 0, 43, 0, 43, 0,
602
- 43, 0, 43, 144, 57, 54, 0, 54,
603
- 0, 81, 84, 81, 0, 0, 54, 0,
604
- 0, 54, 0, 0, 54, 0, 0, 54,
605
- 0, 0, 54, 0, 0, 54, 0, 0,
606
- 54, 0, 0, 54, 0, 0, 54, 0,
607
- 0, 54, 0, 0, 0, 54, 0, 0,
608
- 54, 0, 54, 21, 0, 0, 43, 0,
609
- 43, 0, 43, 0, 43, 0, 43, 0,
610
- 43, 0, 43, 0, 43, 0, 43, 0,
611
- 43, 0, 43, 0, 43, 0, 43, 144,
612
- 57, 54, 0, 54, 0, 69, 33, 69,
613
- 84, 84, 84, 84, 0, 0, 54, 0,
614
- 0, 54, 0, 0, 54, 0, 0, 54,
615
- 0, 0, 54, 0, 0, 54, 0, 0,
616
- 54, 0, 0, 54, 0, 0, 54, 0,
617
- 0, 54, 0, 0, 54, 0, 0, 54,
618
- 0, 0, 54, 0, 0, 54, 13, 0,
619
- 54, 0, 0, 54, 0, 0, 54, 0,
620
- 0, 54, 0, 0, 54, 0, 0, 54,
621
- 0, 0, 54, 0, 0, 54, 13, 0,
622
- 54, 0, 0, 54, 0, 0, 54, 0,
623
- 0, 54, 0, 0, 54, 0, 0, 54,
624
- 0, 0, 54, 0, 0, 54, 0, 0,
625
- 54, 0, 0, 54, 0, 0, 54, 0,
626
- 0, 54, 0, 0, 54, 0, 0, 54,
627
- 0, 0, 54, 0, 0, 0, 54, 0,
628
- 0, 54, 0, 54, 0, 0, 54, 0,
629
- 0, 0, 54, 0, 0, 54, 0, 0,
630
- 54, 0, 0, 54, 0, 0, 54, 0,
631
- 0, 54, 0, 0, 54, 0, 0, 54,
632
- 0, 0, 54, 0, 0, 54, 0, 0,
633
- 54, 0, 0, 54, 0, 0, 54, 0,
634
- 0, 54, 0, 0, 54, 0, 0, 54,
635
- 0, 0, 54, 0, 0, 0, 43, 0,
636
- 43, 0, 43, 0, 43, 0, 43, 0,
637
- 43, 0, 0, 43, 0, 43, 0, 43,
638
- 0, 43, 0, 43, 0, 43, 0, 43,
639
- 144, 57, 54, 0, 54, 0, 75, 33,
640
- 84, 75, 84, 84, 84, 84, 84, 84,
641
- 84, 84, 0, 0, 54, 0, 0, 54,
642
- 0, 0, 54, 0, 0, 54, 0, 0,
643
- 54, 0, 0, 54, 0, 0, 54, 0,
644
- 0, 54, 0, 0, 54, 0, 0, 54,
645
- 0, 0, 54, 0, 0, 54, 0, 0,
646
- 54, 0, 0, 54, 17, 0, 54, 17,
647
- 0, 54, 0, 0, 54, 0, 0, 54,
648
- 0, 0, 54, 0, 0, 54, 0, 0,
649
- 54, 0, 0, 54, 0, 0, 54, 0,
650
- 0, 54, 0, 0, 54, 0, 0, 54,
651
- 0, 0, 54, 0, 0, 54, 17, 0,
652
- 54, 0, 0, 54, 0, 0, 54, 0,
653
- 0, 0, 0, 0, 54, 0, 0, 54,
654
- 0, 0, 54, 0, 0, 54, 0, 0,
655
- 54, 0, 0, 54, 0, 0, 54, 0,
656
- 0, 54, 0, 0, 54, 0, 0, 54,
657
- 0, 0, 0, 54, 0, 0, 54, 0,
658
- 54, 0, 0, 54, 0, 0, 54, 0,
659
- 0, 54, 0, 0, 54, 0, 0, 54,
660
- 0, 0, 54, 0, 0, 0, 54, 0,
661
- 0, 54, 0, 0, 54, 0, 0, 54,
662
- 0, 0, 54, 0, 0, 54, 0, 0,
663
- 54, 0, 0, 54, 0, 0, 54, 0,
664
- 0, 54, 0, 0, 54, 0, 0, 54,
665
- 0, 0, 54, 0, 0, 54, 0, 0,
666
- 54, 0, 0, 54, 0, 0, 54, 0,
667
- 0, 0, 43, 0, 43, 0, 43, 0,
668
- 43, 0, 43, 0, 43, 0, 43, 0,
669
- 43, 0, 43, 0, 43, 0, 43, 0,
670
- 43, 0, 43, 0, 43, 0, 43, 0,
671
- 43, 0, 43, 0, 43, 0, 43, 144,
672
- 57, 54, 0, 54, 0, 78, 33, 84,
673
- 78, 84, 84, 84, 84, 84, 84, 84,
674
- 0, 0, 54, 0, 0, 54, 0, 0,
675
- 54, 0, 0, 54, 0, 0, 54, 0,
676
- 0, 54, 0, 0, 54, 0, 0, 54,
677
- 0, 0, 54, 0, 0, 54, 0, 0,
678
- 54, 0, 0, 54, 0, 0, 54, 0,
679
- 0, 54, 19, 0, 54, 19, 0, 54,
680
- 0, 0, 54, 0, 0, 54, 0, 0,
681
- 54, 0, 0, 54, 0, 0, 54, 0,
682
- 0, 54, 0, 0, 54, 0, 0, 0,
683
- 0, 0, 54, 0, 0, 54, 0, 0,
684
- 54, 0, 0, 54, 0, 0, 54, 0,
685
- 0, 54, 0, 0, 54, 0, 0, 54,
686
- 0, 0, 54, 0, 0, 54, 0, 0,
687
- 0, 54, 0, 0, 54, 0, 54, 19,
688
- 0, 54, 0, 0, 54, 0, 0, 54,
689
- 0, 0, 54, 0, 0, 54, 0, 0,
690
- 54, 0, 0, 54, 0, 0, 54, 0,
691
- 0, 54, 0, 0, 54, 0, 0, 54,
692
- 0, 0, 54, 0, 0, 0, 0, 0,
693
- 43, 54, 37, 37, 87, 37, 37, 43,
694
- 0, 39, 0, 43, 0, 0, 54, 0,
695
- 0, 39, 0, 0, 54, 0, 93, 90,
696
- 41, 96, 90, 96, 96, 96, 96, 96,
697
- 96, 96, 96, 99, 0, 43, 54, 0,
698
- 0, 54, 0, 0, 54, 0, 0, 54,
699
- 0, 0, 54, 0, 0, 54, 0, 0,
700
- 54, 0, 0, 54, 0, 0, 0, 0,
701
- 0, 54, 0, 0, 54, 0, 0, 54,
702
- 0, 0, 54, 0, 0, 54, 0, 0,
703
- 54, 0, 0, 54, 0, 0, 54, 0,
704
- 0, 54, 0, 0, 54, 0, 0, 0,
705
- 54, 0, 0, 54, 0, 54, 15, 0,
706
- 54, 0, 0, 54, 0, 0, 54, 0,
707
- 0, 54, 0, 0, 54, 0, 0, 54,
708
- 0, 0, 54, 0, 0, 0, 54, 0,
709
- 0, 54, 0, 0, 54, 0, 0, 54,
710
- 0, 0, 54, 0, 0, 54, 0, 0,
711
- 54, 0, 0, 54, 0, 0, 54, 0,
712
- 0, 54, 0, 0, 54, 0, 0, 54,
713
- 0, 0, 54, 0, 0, 54, 0, 0,
714
- 54, 0, 0, 54, 0, 0, 54, 0,
715
- 0, 54, 0, 0, 0, 0
716
- };
717
-
718
- static const unsigned char _lexer_eof_actions[] = {
719
- 0, 43, 43, 43, 43, 43, 43, 43,
720
- 43, 43, 43, 43, 43, 43, 43, 43,
721
- 43, 43, 43, 43, 43, 43, 43, 43,
722
- 43, 43, 43, 43, 43, 43, 43, 43,
723
- 43, 43, 43, 43, 43, 43, 43, 43,
724
- 43, 43, 43, 43, 43, 43, 43, 43,
725
- 43, 43, 43, 43, 43, 43, 43, 43,
726
- 43, 43, 43, 43, 43, 43, 43, 43,
727
- 43, 43, 43, 43, 43, 43, 43, 43,
728
- 43, 43, 43, 43, 43, 43, 43, 43,
729
- 43, 43, 43, 43, 43, 43, 43, 43,
730
- 43, 43, 43, 43, 43, 43, 43, 43,
731
- 43, 43, 43, 43, 43, 43, 43, 43,
732
- 43, 43, 43, 43, 43, 43, 43, 43,
733
- 43, 43, 43, 43, 43, 43, 43, 43,
734
- 43, 43, 43, 43, 43, 43, 43, 43,
735
- 43, 43, 43, 43, 43, 43, 43, 43,
736
- 43, 43, 43, 43, 43, 43, 43, 43,
737
- 43, 43, 43, 43, 43, 43, 43, 43,
738
- 43, 43, 43, 43, 43, 43, 43, 43,
739
- 43, 43, 43, 43, 43, 43, 43, 43,
740
- 43, 43, 43, 43, 43, 43, 43, 43,
741
- 43, 43, 43, 43, 43, 43, 43, 43,
742
- 43, 43, 43, 43, 43, 43, 43, 43,
743
- 43, 43, 43, 43, 43, 43, 43, 43,
744
- 43, 43, 43, 43, 43, 43, 43, 43,
745
- 43, 43, 43, 43, 43, 43, 43, 43,
746
- 43, 43, 43, 43, 43, 43, 43, 43,
747
- 43, 43, 43, 43, 43, 43, 43, 43,
748
- 43, 43, 43, 43, 43, 43, 43, 43,
749
- 43, 43, 43, 43, 43, 43, 43, 43,
750
- 43, 43, 43, 43, 43, 43, 43, 43,
751
- 43, 43, 43, 43, 43, 43, 43, 43,
752
- 43, 43, 43, 43, 43, 43, 43, 43,
753
- 43, 43, 43, 43, 43, 43, 43, 43,
754
- 43, 43, 43, 43, 43, 43, 43, 43,
755
- 43, 43, 43, 43, 43, 43, 43, 43,
756
- 43, 43, 43, 43, 43, 43, 43, 43,
757
- 43, 43, 43, 43, 43, 43, 43, 43,
758
- 43, 43, 43, 43, 43, 43, 43, 43,
759
- 43, 43, 43, 43, 43, 43, 43, 43,
760
- 43, 43, 43, 43, 43, 43, 43, 43,
761
- 43, 43, 43, 43, 43, 43, 43, 43,
762
- 43, 43, 43, 43, 43, 43, 43, 43,
763
- 43, 43, 43, 43, 43, 43, 43, 43,
764
- 43, 43, 43, 43, 43, 43, 43, 43,
765
- 43, 43, 43, 43, 43, 43
766
- };
767
-
768
- static const int lexer_start = 1;
769
- static const int lexer_first_final = 373;
770
- static const int lexer_error = 0;
771
-
772
- static const int lexer_en_main = 1;
773
-
774
-
775
- #line 258 "ragel/i18n/it.c.rl"
776
-
777
- static VALUE
778
- unindent(VALUE con, int start_col)
779
- {
780
- VALUE re;
781
- /* Gherkin will crash gracefully if the string representation of start_col pushes the pattern past 32 characters */
782
- char pat[32];
783
- snprintf(pat, 32, "^[\t ]{0,%d}", start_col);
784
- re = rb_reg_regcomp(rb_str_new2(pat));
785
- rb_funcall(con, rb_intern("gsub!"), 2, re, rb_str_new2(""));
786
-
787
- return Qnil;
788
-
789
- }
790
-
791
- static void
792
- store_kw_con(VALUE listener, const char * event_name,
793
- const char * keyword_at, size_t keyword_length,
794
- const char * at, size_t length,
795
- int current_line)
796
- {
797
- VALUE con = Qnil, kw = Qnil;
798
- kw = ENCODED_STR_NEW(keyword_at, keyword_length);
799
- con = ENCODED_STR_NEW(at, length);
800
- rb_funcall(con, rb_intern("strip!"), 0);
801
- rb_funcall(listener, rb_intern(event_name), 3, kw, con, INT2FIX(current_line));
802
- }
803
-
804
- static void
805
- store_multiline_kw_con(VALUE listener, const char * event_name,
806
- const char * keyword_at, size_t keyword_length,
807
- const char * at, size_t length,
808
- int current_line, int start_col)
809
- {
810
- VALUE split;
811
- VALUE con = Qnil, kw = Qnil, name = Qnil, desc = Qnil;
812
-
813
- kw = ENCODED_STR_NEW(keyword_at, keyword_length);
814
- con = ENCODED_STR_NEW(at, length);
815
-
816
- unindent(con, start_col);
817
-
818
- split = rb_str_split(con, "\n");
819
-
820
- name = rb_funcall(split, rb_intern("shift"), 0);
821
- desc = rb_ary_join(split, rb_str_new2( "\n" ));
822
-
823
- if( name == Qnil )
824
- {
825
- name = rb_str_new2("");
826
- }
827
- if( rb_funcall(desc, rb_intern("size"), 0) == 0)
828
- {
829
- desc = rb_str_new2("");
830
- }
831
- rb_funcall(name, rb_intern("strip!"), 0);
832
- rb_funcall(desc, rb_intern("rstrip!"), 0);
833
- rb_funcall(listener, rb_intern(event_name), 4, kw, name, desc, INT2FIX(current_line));
834
- }
835
-
836
- static void
837
- store_attr(VALUE listener, const char * attr_type,
838
- const char * at, size_t length,
839
- int line)
840
- {
841
- VALUE val = ENCODED_STR_NEW(at, length);
842
- rb_funcall(listener, rb_intern(attr_type), 2, val, INT2FIX(line));
843
- }
844
- static void
845
- store_docstring_content(VALUE listener,
846
- int start_col,
847
- const char *type_at, size_t type_length,
848
- const char *at, size_t length,
849
- int current_line)
850
- {
851
- VALUE re2;
852
- VALUE unescape_escaped_quotes;
853
- VALUE con = ENCODED_STR_NEW(at, length);
854
- VALUE con_type = ENCODED_STR_NEW(type_at, type_length);
855
-
856
- unindent(con, start_col);
857
-
858
- re2 = rb_reg_regcomp(rb_str_new2("\r\\Z"));
859
- unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\""));
860
- rb_funcall(con, rb_intern("sub!"), 2, re2, rb_str_new2(""));
861
- rb_funcall(con_type, rb_intern("strip!"), 0);
862
- rb_funcall(con, rb_intern("gsub!"), 2, unescape_escaped_quotes, rb_str_new2("\"\"\""));
863
- rb_funcall(listener, rb_intern("doc_string"), 3, con_type, con, INT2FIX(current_line));
864
- }
865
- static void
866
- raise_lexer_error(const char * at, int line)
867
- {
868
- rb_raise(rb_eGherkinLexingError, "Lexing error on line %d: '%s'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.", line, at);
869
- }
870
-
871
- static void lexer_init(lexer_state *lexer) {
872
- lexer->content_start = 0;
873
- lexer->content_end = 0;
874
- lexer->content_len = 0;
875
- lexer->docstring_content_type_start = 0;
876
- lexer->docstring_content_type_end = 0;
877
- lexer->mark = 0;
878
- lexer->keyword_start = 0;
879
- lexer->keyword_end = 0;
880
- lexer->next_keyword_start = 0;
881
- lexer->line_number = 1;
882
- lexer->last_newline = 0;
883
- lexer->final_newline = 0;
884
- lexer->start_col = 0;
885
- }
886
-
887
- static VALUE CLexer_alloc(VALUE klass)
888
- {
889
- VALUE obj;
890
- lexer_state *lxr = ALLOC(lexer_state);
891
- lexer_init(lxr);
892
-
893
- obj = Data_Wrap_Struct(klass, NULL, -1, lxr);
894
-
895
- return obj;
896
- }
897
-
898
- static VALUE CLexer_init(VALUE self, VALUE listener)
899
- {
900
- lexer_state *lxr;
901
- rb_iv_set(self, "@listener", listener);
902
-
903
- lxr = NULL;
904
- DATA_GET(self, lexer_state, lxr);
905
- lexer_init(lxr);
906
-
907
- return self;
908
- }
909
-
910
- static VALUE CLexer_scan(VALUE self, VALUE input)
911
- {
912
- VALUE input_copy;
913
- char *data;
914
- size_t len;
915
- VALUE listener = rb_iv_get(self, "@listener");
916
-
917
- lexer_state *lexer;
918
- lexer = NULL;
919
- DATA_GET(self, lexer_state, lexer);
920
-
921
- input_copy = rb_str_dup(input);
922
-
923
- rb_str_append(input_copy, rb_str_new2("\n%_FEATURE_END_%"));
924
- data = RSTRING_PTR(input_copy);
925
- len = RSTRING_LEN(input_copy);
926
-
927
- if (len == 0) {
928
- rb_raise(rb_eGherkinLexingError, "No content to lex.");
929
- } else {
930
-
931
- const char *p, *pe, *eof;
932
- int cs = 0;
933
-
934
- VALUE current_row = Qnil;
935
-
936
- p = data;
937
- pe = data + len;
938
- eof = pe;
939
-
940
- assert(*pe == '\0' && "pointer does not end on NULL");
941
-
942
-
943
- #line 944 "ext/gherkin_lexer_it/gherkin_lexer_it.c"
944
- {
945
- cs = lexer_start;
946
- }
947
-
948
- #line 425 "ragel/i18n/it.c.rl"
949
-
950
- #line 951 "ext/gherkin_lexer_it/gherkin_lexer_it.c"
951
- {
952
- int _klen;
953
- unsigned int _trans;
954
- const char *_acts;
955
- unsigned int _nacts;
956
- const char *_keys;
957
-
958
- if ( p == pe )
959
- goto _test_eof;
960
- if ( cs == 0 )
961
- goto _out;
962
- _resume:
963
- _keys = _lexer_trans_keys + _lexer_key_offsets[cs];
964
- _trans = _lexer_index_offsets[cs];
965
-
966
- _klen = _lexer_single_lengths[cs];
967
- if ( _klen > 0 ) {
968
- const char *_lower = _keys;
969
- const char *_mid;
970
- const char *_upper = _keys + _klen - 1;
971
- while (1) {
972
- if ( _upper < _lower )
973
- break;
974
-
975
- _mid = _lower + ((_upper-_lower) >> 1);
976
- if ( (*p) < *_mid )
977
- _upper = _mid - 1;
978
- else if ( (*p) > *_mid )
979
- _lower = _mid + 1;
980
- else {
981
- _trans += (unsigned int)(_mid - _keys);
982
- goto _match;
983
- }
984
- }
985
- _keys += _klen;
986
- _trans += _klen;
987
- }
988
-
989
- _klen = _lexer_range_lengths[cs];
990
- if ( _klen > 0 ) {
991
- const char *_lower = _keys;
992
- const char *_mid;
993
- const char *_upper = _keys + (_klen<<1) - 2;
994
- while (1) {
995
- if ( _upper < _lower )
996
- break;
997
-
998
- _mid = _lower + (((_upper-_lower) >> 1) & ~1);
999
- if ( (*p) < _mid[0] )
1000
- _upper = _mid - 2;
1001
- else if ( (*p) > _mid[1] )
1002
- _lower = _mid + 2;
1003
- else {
1004
- _trans += (unsigned int)((_mid - _keys)>>1);
1005
- goto _match;
1006
- }
1007
- }
1008
- _trans += _klen;
1009
- }
1010
-
1011
- _match:
1012
- cs = _lexer_trans_targs[_trans];
1013
-
1014
- if ( _lexer_trans_actions[_trans] == 0 )
1015
- goto _again;
1016
-
1017
- _acts = _lexer_actions + _lexer_trans_actions[_trans];
1018
- _nacts = (unsigned int) *_acts++;
1019
- while ( _nacts-- > 0 )
1020
- {
1021
- switch ( *_acts++ )
1022
- {
1023
- case 0:
1024
- #line 83 "ragel/i18n/it.c.rl"
1025
- {
1026
- MARK(content_start, p);
1027
- lexer->current_line = lexer->line_number;
1028
- lexer->start_col = lexer->content_start - lexer->last_newline - (lexer->keyword_end - lexer->keyword_start) + 2;
1029
- }
1030
- break;
1031
- case 1:
1032
- #line 89 "ragel/i18n/it.c.rl"
1033
- {
1034
- MARK(content_start, p);
1035
- }
1036
- break;
1037
- case 2:
1038
- #line 93 "ragel/i18n/it.c.rl"
1039
- {
1040
- lexer->current_line = lexer->line_number;
1041
- lexer->start_col = p - data - lexer->last_newline;
1042
- }
1043
- break;
1044
- case 3:
1045
- #line 98 "ragel/i18n/it.c.rl"
1046
- {
1047
- int len = LEN(content_start, PTR_TO(final_newline));
1048
- int type_len = LEN(docstring_content_type_start, PTR_TO(docstring_content_type_end));
1049
-
1050
- if (len < 0) len = 0;
1051
- if (type_len < 0) len = 0;
1052
-
1053
- store_docstring_content(listener, lexer->start_col, PTR_TO(docstring_content_type_start), type_len, PTR_TO(content_start), len, lexer->current_line);
1054
- }
1055
- break;
1056
- case 4:
1057
- #line 108 "ragel/i18n/it.c.rl"
1058
- {
1059
- MARK(docstring_content_type_start, p);
1060
- }
1061
- break;
1062
- case 5:
1063
- #line 112 "ragel/i18n/it.c.rl"
1064
- {
1065
- MARK(docstring_content_type_end, p);
1066
- }
1067
- break;
1068
- case 6:
1069
- #line 116 "ragel/i18n/it.c.rl"
1070
- {
1071
- STORE_KW_END_CON(feature);
1072
- }
1073
- break;
1074
- case 7:
1075
- #line 120 "ragel/i18n/it.c.rl"
1076
- {
1077
- STORE_KW_END_CON(background);
1078
- }
1079
- break;
1080
- case 8:
1081
- #line 124 "ragel/i18n/it.c.rl"
1082
- {
1083
- STORE_KW_END_CON(scenario);
1084
- }
1085
- break;
1086
- case 9:
1087
- #line 128 "ragel/i18n/it.c.rl"
1088
- {
1089
- STORE_KW_END_CON(scenario_outline);
1090
- }
1091
- break;
1092
- case 10:
1093
- #line 132 "ragel/i18n/it.c.rl"
1094
- {
1095
- STORE_KW_END_CON(examples);
1096
- }
1097
- break;
1098
- case 11:
1099
- #line 136 "ragel/i18n/it.c.rl"
1100
- {
1101
- store_kw_con(listener, "step",
1102
- PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end)),
1103
- PTR_TO(content_start), LEN(content_start, p),
1104
- lexer->current_line);
1105
- }
1106
- break;
1107
- case 12:
1108
- #line 143 "ragel/i18n/it.c.rl"
1109
- {
1110
- STORE_ATTR(comment);
1111
- lexer->mark = 0;
1112
- }
1113
- break;
1114
- case 13:
1115
- #line 148 "ragel/i18n/it.c.rl"
1116
- {
1117
- STORE_ATTR(tag);
1118
- lexer->mark = 0;
1119
- }
1120
- break;
1121
- case 14:
1122
- #line 153 "ragel/i18n/it.c.rl"
1123
- {
1124
- lexer->line_number += 1;
1125
- MARK(final_newline, p);
1126
- }
1127
- break;
1128
- case 15:
1129
- #line 158 "ragel/i18n/it.c.rl"
1130
- {
1131
- MARK(last_newline, p + 1);
1132
- }
1133
- break;
1134
- case 16:
1135
- #line 162 "ragel/i18n/it.c.rl"
1136
- {
1137
- if (lexer->mark == 0) {
1138
- MARK(mark, p);
1139
- }
1140
- }
1141
- break;
1142
- case 17:
1143
- #line 168 "ragel/i18n/it.c.rl"
1144
- {
1145
- MARK(keyword_end, p);
1146
- MARK(keyword_start, PTR_TO(mark));
1147
- MARK(content_start, p + 1);
1148
- lexer->mark = 0;
1149
- }
1150
- break;
1151
- case 18:
1152
- #line 175 "ragel/i18n/it.c.rl"
1153
- {
1154
- MARK(content_end, p);
1155
- }
1156
- break;
1157
- case 19:
1158
- #line 179 "ragel/i18n/it.c.rl"
1159
- {
1160
- p = p - 1;
1161
- lexer->current_line = lexer->line_number;
1162
- current_row = rb_ary_new();
1163
- }
1164
- break;
1165
- case 20:
1166
- #line 185 "ragel/i18n/it.c.rl"
1167
- {
1168
- MARK(content_start, p);
1169
- }
1170
- break;
1171
- case 21:
1172
- #line 189 "ragel/i18n/it.c.rl"
1173
- {
1174
- VALUE re_pipe, re_newline, re_backslash;
1175
- VALUE con = ENCODED_STR_NEW(PTR_TO(content_start), LEN(content_start, p));
1176
- rb_funcall(con, rb_intern("strip!"), 0);
1177
- re_pipe = rb_reg_regcomp(rb_str_new2("\\\\\\|"));
1178
- re_newline = rb_reg_regcomp(rb_str_new2("\\\\n"));
1179
- re_backslash = rb_reg_regcomp(rb_str_new2("\\\\\\\\"));
1180
- rb_funcall(con, rb_intern("gsub!"), 2, re_pipe, rb_str_new2("|"));
1181
- rb_funcall(con, rb_intern("gsub!"), 2, re_newline, rb_str_new2("\n"));
1182
- rb_funcall(con, rb_intern("gsub!"), 2, re_backslash, rb_str_new2("\\"));
1183
-
1184
- rb_ary_push(current_row, con);
1185
- }
1186
- break;
1187
- case 22:
1188
- #line 203 "ragel/i18n/it.c.rl"
1189
- {
1190
- rb_funcall(listener, rb_intern("row"), 2, current_row, INT2FIX(lexer->current_line));
1191
- }
1192
- break;
1193
- case 23:
1194
- #line 207 "ragel/i18n/it.c.rl"
1195
- {
1196
- int line;
1197
- if (cs < lexer_first_final) {
1198
- size_t count = 0;
1199
- VALUE newstr_val;
1200
- char *newstr;
1201
- int newstr_count = 0;
1202
- size_t len;
1203
- const char *buff;
1204
- if (lexer->last_newline != 0) {
1205
- len = LEN(last_newline, eof);
1206
- buff = PTR_TO(last_newline);
1207
- } else {
1208
- len = strlen(data);
1209
- buff = data;
1210
- }
1211
-
1212
- /* Allocate as a ruby string so that it gets cleaned up by GC */
1213
- newstr_val = rb_str_new(buff, len);
1214
- newstr = RSTRING_PTR(newstr_val);
1215
-
1216
-
1217
- for (count = 0; count < len; count++) {
1218
- if(buff[count] == 10) {
1219
- newstr[newstr_count] = '\0'; /* terminate new string at first newline found */
1220
- break;
1221
- } else {
1222
- if (buff[count] == '%') {
1223
- newstr[newstr_count++] = buff[count];
1224
- newstr[newstr_count] = buff[count];
1225
- } else {
1226
- newstr[newstr_count] = buff[count];
1227
- }
1228
- }
1229
- newstr_count++;
1230
- }
1231
-
1232
- line = lexer->line_number;
1233
- lexer_init(lexer); /* Re-initialize so we can scan again with the same lexer */
1234
- raise_lexer_error(newstr, line);
1235
- } else {
1236
- rb_funcall(listener, rb_intern("eof"), 0);
1237
- }
1238
- }
1239
- break;
1240
- #line 1241 "ext/gherkin_lexer_it/gherkin_lexer_it.c"
1241
- }
1242
- }
1243
-
1244
- _again:
1245
- if ( cs == 0 )
1246
- goto _out;
1247
- if ( ++p != pe )
1248
- goto _resume;
1249
- _test_eof: {}
1250
- if ( p == eof )
1251
- {
1252
- const char *__acts = _lexer_actions + _lexer_eof_actions[cs];
1253
- unsigned int __nacts = (unsigned int) *__acts++;
1254
- while ( __nacts-- > 0 ) {
1255
- switch ( *__acts++ ) {
1256
- case 23:
1257
- #line 207 "ragel/i18n/it.c.rl"
1258
- {
1259
- int line;
1260
- if (cs < lexer_first_final) {
1261
- size_t count = 0;
1262
- VALUE newstr_val;
1263
- char *newstr;
1264
- int newstr_count = 0;
1265
- size_t len;
1266
- const char *buff;
1267
- if (lexer->last_newline != 0) {
1268
- len = LEN(last_newline, eof);
1269
- buff = PTR_TO(last_newline);
1270
- } else {
1271
- len = strlen(data);
1272
- buff = data;
1273
- }
1274
-
1275
- /* Allocate as a ruby string so that it gets cleaned up by GC */
1276
- newstr_val = rb_str_new(buff, len);
1277
- newstr = RSTRING_PTR(newstr_val);
1278
-
1279
-
1280
- for (count = 0; count < len; count++) {
1281
- if(buff[count] == 10) {
1282
- newstr[newstr_count] = '\0'; /* terminate new string at first newline found */
1283
- break;
1284
- } else {
1285
- if (buff[count] == '%') {
1286
- newstr[newstr_count++] = buff[count];
1287
- newstr[newstr_count] = buff[count];
1288
- } else {
1289
- newstr[newstr_count] = buff[count];
1290
- }
1291
- }
1292
- newstr_count++;
1293
- }
1294
-
1295
- line = lexer->line_number;
1296
- lexer_init(lexer); /* Re-initialize so we can scan again with the same lexer */
1297
- raise_lexer_error(newstr, line);
1298
- } else {
1299
- rb_funcall(listener, rb_intern("eof"), 0);
1300
- }
1301
- }
1302
- break;
1303
- #line 1304 "ext/gherkin_lexer_it/gherkin_lexer_it.c"
1304
- }
1305
- }
1306
- }
1307
-
1308
- _out: {}
1309
- }
1310
-
1311
- #line 426 "ragel/i18n/it.c.rl"
1312
-
1313
- assert(p <= pe && "data overflow after parsing execute");
1314
- assert(lexer->content_start <= len && "content starts after data end");
1315
- assert(lexer->mark < len && "mark is after data end");
1316
-
1317
- /* Reset lexer by re-initializing the whole thing */
1318
- lexer_init(lexer);
1319
-
1320
- if (cs == lexer_error) {
1321
- rb_raise(rb_eGherkinLexingError, "Invalid format, lexing fails.");
1322
- } else {
1323
- return Qtrue;
1324
- }
1325
- }
1326
- }
1327
-
1328
- void Init_gherkin_lexer_it()
1329
- {
1330
- mGherkin = rb_define_module("Gherkin");
1331
- mGherkinLexer = rb_define_module_under(mGherkin, "Lexer");
1332
- rb_eGherkinLexingError = rb_const_get(mGherkinLexer, rb_intern("LexingError"));
1333
-
1334
- mCLexer = rb_define_module_under(mGherkin, "CLexer");
1335
- cI18nLexer = rb_define_class_under(mCLexer, "It", rb_cObject);
1336
- rb_define_alloc_func(cI18nLexer, CLexer_alloc);
1337
- rb_define_method(cI18nLexer, "initialize", CLexer_init, 1);
1338
- rb_define_method(cI18nLexer, "scan", CLexer_scan, 1);
1339
- }
1340
-