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_en_tx")
5
- have_library("c", "main")
6
- create_makefile("gherkin_lexer_en_tx")
@@ -1,1265 +0,0 @@
1
-
2
- #line 1 "ragel/i18n/en_tx.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/en_tx.c.rl"
84
-
85
-
86
- /** Data **/
87
-
88
- #line 89 "ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.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, 114, 115,
118
- 116, 117, 118, 119, 120, 121, 122, 123,
119
- 124, 139, 141, 143, 145, 147, 149, 151,
120
- 153, 155, 157, 159, 161, 163, 165, 167,
121
- 169, 187, 189, 190, 191, 192, 193, 194,
122
- 195, 196, 197, 198, 199, 200, 215, 217,
123
- 219, 221, 223, 225, 227, 229, 231, 233,
124
- 235, 237, 239, 241, 243, 245, 248, 250,
125
- 252, 254, 256, 258, 260, 262, 264, 266,
126
- 268, 270, 272, 274, 276, 278, 280, 282,
127
- 284, 286, 288, 290, 292, 294, 296, 298,
128
- 300, 302, 304, 306, 308, 310, 312, 314,
129
- 316, 318, 319, 320, 321, 322, 323, 324,
130
- 325, 326, 327, 328, 329, 330, 331, 332,
131
- 333, 334, 335, 342, 344, 346, 348, 350,
132
- 352, 354, 356, 357, 358, 359, 360, 361,
133
- 362, 363, 364, 365, 377, 379, 381, 383,
134
- 385, 387, 389, 391, 393, 395, 397, 399,
135
- 401, 403, 405, 407, 409, 411, 413, 415,
136
- 417, 419, 421, 423, 425, 427, 429, 431,
137
- 433, 435, 437, 439, 441, 443, 445, 447,
138
- 449, 451, 453, 455, 457, 459, 461, 463,
139
- 465, 467, 469, 471, 473, 475, 477, 479,
140
- 481, 482, 483, 484, 485, 486, 487, 488,
141
- 489, 490, 491, 492, 493, 494, 495, 510,
142
- 512, 514, 516, 518, 520, 522, 524, 526,
143
- 528, 530, 532, 534, 536, 538, 540, 543,
144
- 545, 547, 549, 551, 553, 555, 557, 559,
145
- 561, 563, 565, 567, 569, 571, 573, 576,
146
- 578, 580, 582, 584, 586, 588, 590, 592,
147
- 594, 596, 598, 600, 602, 604, 606, 608,
148
- 610, 612, 614, 616, 618, 620, 622, 624,
149
- 626, 628, 630, 631, 635, 641, 644, 646,
150
- 652, 670, 672, 674, 676, 678, 680, 682,
151
- 684, 686, 688, 690, 692, 694, 696, 698,
152
- 700, 702, 704, 706, 708, 710, 712, 714,
153
- 716, 718, 720, 722, 724, 726, 728, 729
154
- };
155
-
156
- static const char _lexer_trans_keys[] = {
157
- -17, 10, 32, 34, 35, 37, 42, 64,
158
- 65, 66, 69, 70, 71, 83, 84, 87,
159
- 124, 9, 13, -69, -65, 10, 32, 34,
160
- 35, 37, 42, 64, 65, 66, 69, 70,
161
- 71, 83, 84, 87, 124, 9, 13, 34,
162
- 34, 10, 13, 10, 13, 10, 32, 34,
163
- 9, 13, 10, 32, 34, 9, 13, 10,
164
- 32, 34, 9, 13, 10, 32, 34, 9,
165
- 13, 10, 32, 9, 13, 10, 32, 9,
166
- 13, 10, 13, 10, 95, 70, 69, 65,
167
- 84, 85, 82, 69, 95, 69, 78, 68,
168
- 95, 37, 32, 10, 13, 10, 13, 13,
169
- 32, 64, 9, 10, 9, 10, 13, 32,
170
- 64, 11, 12, 10, 32, 64, 9, 13,
171
- 108, 110, 108, 32, 121, 39, 97, 108,
172
- 108, 58, 10, 10, 10, 32, 35, 37,
173
- 42, 64, 65, 66, 70, 71, 83, 84,
174
- 87, 9, 13, 10, 95, 10, 70, 10,
175
- 69, 10, 65, 10, 84, 10, 85, 10,
176
- 82, 10, 69, 10, 95, 10, 69, 10,
177
- 78, 10, 68, 10, 95, 10, 37, 10,
178
- 32, 10, 32, 34, 35, 37, 42, 64,
179
- 65, 66, 69, 70, 71, 83, 84, 87,
180
- 124, 9, 13, 97, 117, 99, 107, 103,
181
- 114, 111, 117, 110, 100, 58, 10, 10,
182
- 10, 32, 35, 37, 42, 64, 65, 66,
183
- 70, 71, 83, 84, 87, 9, 13, 10,
184
- 95, 10, 70, 10, 69, 10, 65, 10,
185
- 84, 10, 85, 10, 82, 10, 69, 10,
186
- 95, 10, 69, 10, 78, 10, 68, 10,
187
- 95, 10, 37, 10, 32, 10, 108, 110,
188
- 10, 108, 10, 32, 10, 121, 10, 39,
189
- 10, 97, 10, 108, 10, 108, 10, 58,
190
- 10, 100, 10, 32, 10, 121, 10, 39,
191
- 10, 97, 10, 108, 10, 108, 10, 117,
192
- 10, 116, 10, 101, 10, 97, 10, 116,
193
- 10, 117, 10, 114, 10, 101, 10, 105,
194
- 10, 118, 10, 101, 10, 110, 10, 99,
195
- 10, 101, 10, 110, 10, 97, 10, 114,
196
- 10, 105, 10, 111, 10, 104, 116, 32,
197
- 121, 39, 97, 108, 108, 120, 97, 109,
198
- 112, 108, 101, 115, 58, 10, 10, 10,
199
- 32, 35, 70, 124, 9, 13, 10, 101,
200
- 10, 97, 10, 116, 10, 117, 10, 114,
201
- 10, 101, 10, 58, 101, 97, 116, 117,
202
- 114, 101, 58, 10, 10, 10, 32, 35,
203
- 37, 64, 65, 66, 69, 70, 83, 9,
204
- 13, 10, 95, 10, 70, 10, 69, 10,
205
- 65, 10, 84, 10, 85, 10, 82, 10,
206
- 69, 10, 95, 10, 69, 10, 78, 10,
207
- 68, 10, 95, 10, 37, 10, 108, 10,
208
- 108, 10, 32, 10, 121, 10, 39, 10,
209
- 97, 10, 108, 10, 108, 10, 58, 10,
210
- 97, 10, 99, 10, 107, 10, 103, 10,
211
- 114, 10, 111, 10, 117, 10, 110, 10,
212
- 100, 10, 120, 10, 97, 10, 109, 10,
213
- 112, 10, 108, 10, 101, 10, 115, 10,
214
- 101, 10, 97, 10, 116, 10, 117, 10,
215
- 114, 10, 101, 10, 99, 10, 101, 10,
216
- 110, 10, 97, 10, 114, 10, 105, 10,
217
- 111, 105, 118, 101, 110, 99, 101, 110,
218
- 97, 114, 105, 111, 58, 10, 10, 10,
219
- 32, 35, 37, 42, 64, 65, 66, 70,
220
- 71, 83, 84, 87, 9, 13, 10, 95,
221
- 10, 70, 10, 69, 10, 65, 10, 84,
222
- 10, 85, 10, 82, 10, 69, 10, 95,
223
- 10, 69, 10, 78, 10, 68, 10, 95,
224
- 10, 37, 10, 32, 10, 108, 110, 10,
225
- 108, 10, 32, 10, 121, 10, 39, 10,
226
- 97, 10, 108, 10, 108, 10, 58, 10,
227
- 100, 10, 32, 10, 121, 10, 39, 10,
228
- 97, 10, 108, 10, 108, 10, 97, 117,
229
- 10, 99, 10, 107, 10, 103, 10, 114,
230
- 10, 111, 10, 117, 10, 110, 10, 100,
231
- 10, 116, 10, 101, 10, 97, 10, 116,
232
- 10, 117, 10, 114, 10, 101, 10, 105,
233
- 10, 118, 10, 101, 10, 110, 10, 99,
234
- 10, 101, 10, 110, 10, 97, 10, 114,
235
- 10, 105, 10, 111, 10, 104, 104, 32,
236
- 124, 9, 13, 10, 32, 92, 124, 9,
237
- 13, 10, 92, 124, 10, 92, 10, 32,
238
- 92, 124, 9, 13, 10, 32, 34, 35,
239
- 37, 42, 64, 65, 66, 69, 70, 71,
240
- 83, 84, 87, 124, 9, 13, 10, 110,
241
- 10, 100, 10, 32, 10, 121, 10, 39,
242
- 10, 97, 10, 108, 10, 108, 10, 117,
243
- 10, 116, 10, 101, 10, 97, 10, 116,
244
- 10, 117, 10, 114, 10, 101, 10, 58,
245
- 10, 105, 10, 118, 10, 101, 10, 110,
246
- 10, 99, 10, 101, 10, 110, 10, 97,
247
- 10, 114, 10, 105, 10, 111, 10, 104,
248
- 100, 0
249
- };
250
-
251
- static const char _lexer_single_lengths[] = {
252
- 0, 17, 1, 1, 16, 1, 1, 2,
253
- 2, 3, 3, 3, 3, 2, 2, 2,
254
- 1, 1, 1, 1, 1, 1, 1, 1,
255
- 1, 1, 1, 1, 1, 1, 1, 1,
256
- 2, 2, 3, 5, 3, 2, 1, 1,
257
- 1, 1, 1, 1, 1, 1, 1, 1,
258
- 13, 2, 2, 2, 2, 2, 2, 2,
259
- 2, 2, 2, 2, 2, 2, 2, 2,
260
- 16, 2, 1, 1, 1, 1, 1, 1,
261
- 1, 1, 1, 1, 1, 13, 2, 2,
262
- 2, 2, 2, 2, 2, 2, 2, 2,
263
- 2, 2, 2, 2, 2, 3, 2, 2,
264
- 2, 2, 2, 2, 2, 2, 2, 2,
265
- 2, 2, 2, 2, 2, 2, 2, 2,
266
- 2, 2, 2, 2, 2, 2, 2, 2,
267
- 2, 2, 2, 2, 2, 2, 2, 2,
268
- 2, 1, 1, 1, 1, 1, 1, 1,
269
- 1, 1, 1, 1, 1, 1, 1, 1,
270
- 1, 1, 5, 2, 2, 2, 2, 2,
271
- 2, 2, 1, 1, 1, 1, 1, 1,
272
- 1, 1, 1, 10, 2, 2, 2, 2,
273
- 2, 2, 2, 2, 2, 2, 2, 2,
274
- 2, 2, 2, 2, 2, 2, 2, 2,
275
- 2, 2, 2, 2, 2, 2, 2, 2,
276
- 2, 2, 2, 2, 2, 2, 2, 2,
277
- 2, 2, 2, 2, 2, 2, 2, 2,
278
- 2, 2, 2, 2, 2, 2, 2, 2,
279
- 1, 1, 1, 1, 1, 1, 1, 1,
280
- 1, 1, 1, 1, 1, 1, 13, 2,
281
- 2, 2, 2, 2, 2, 2, 2, 2,
282
- 2, 2, 2, 2, 2, 2, 3, 2,
283
- 2, 2, 2, 2, 2, 2, 2, 2,
284
- 2, 2, 2, 2, 2, 2, 3, 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, 2, 2,
288
- 2, 2, 1, 2, 4, 3, 2, 4,
289
- 16, 2, 2, 2, 2, 2, 2, 2,
290
- 2, 2, 2, 2, 2, 2, 2, 2,
291
- 2, 2, 2, 2, 2, 2, 2, 2,
292
- 2, 2, 2, 2, 2, 2, 1, 0
293
- };
294
-
295
- static const char _lexer_range_lengths[] = {
296
- 0, 1, 0, 0, 1, 0, 0, 0,
297
- 0, 1, 1, 1, 1, 1, 1, 0,
298
- 0, 0, 0, 0, 0, 0, 0, 0,
299
- 0, 0, 0, 0, 0, 0, 0, 0,
300
- 0, 0, 1, 1, 1, 0, 0, 0,
301
- 0, 0, 0, 0, 0, 0, 0, 0,
302
- 1, 0, 0, 0, 0, 0, 0, 0,
303
- 0, 0, 0, 0, 0, 0, 0, 0,
304
- 1, 0, 0, 0, 0, 0, 0, 0,
305
- 0, 0, 0, 0, 0, 1, 0, 0,
306
- 0, 0, 0, 0, 0, 0, 0, 0,
307
- 0, 0, 0, 0, 0, 0, 0, 0,
308
- 0, 0, 0, 0, 0, 0, 0, 0,
309
- 0, 0, 0, 0, 0, 0, 0, 0,
310
- 0, 0, 0, 0, 0, 0, 0, 0,
311
- 0, 0, 0, 0, 0, 0, 0, 0,
312
- 0, 0, 0, 0, 0, 0, 0, 0,
313
- 0, 0, 0, 0, 0, 0, 0, 0,
314
- 0, 0, 1, 0, 0, 0, 0, 0,
315
- 0, 0, 0, 0, 0, 0, 0, 0,
316
- 0, 0, 0, 1, 0, 0, 0, 0,
317
- 0, 0, 0, 0, 0, 0, 0, 0,
318
- 0, 0, 0, 0, 0, 0, 0, 0,
319
- 0, 0, 0, 0, 0, 0, 0, 0,
320
- 0, 0, 0, 0, 0, 0, 0, 0,
321
- 0, 0, 0, 0, 0, 0, 0, 0,
322
- 0, 0, 0, 0, 0, 0, 0, 0,
323
- 0, 0, 0, 0, 0, 0, 0, 0,
324
- 0, 0, 0, 0, 0, 0, 1, 0,
325
- 0, 0, 0, 0, 0, 0, 0, 0,
326
- 0, 0, 0, 0, 0, 0, 0, 0,
327
- 0, 0, 0, 0, 0, 0, 0, 0,
328
- 0, 0, 0, 0, 0, 0, 0, 0,
329
- 0, 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, 1, 1, 0, 0, 1,
333
- 1, 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
- };
338
-
339
- static const short _lexer_index_offsets[] = {
340
- 0, 0, 19, 21, 23, 41, 43, 45,
341
- 48, 51, 56, 61, 66, 71, 75, 79,
342
- 82, 84, 86, 88, 90, 92, 94, 96,
343
- 98, 100, 102, 104, 106, 108, 110, 112,
344
- 114, 117, 120, 125, 132, 137, 140, 142,
345
- 144, 146, 148, 150, 152, 154, 156, 158,
346
- 160, 175, 178, 181, 184, 187, 190, 193,
347
- 196, 199, 202, 205, 208, 211, 214, 217,
348
- 220, 238, 241, 243, 245, 247, 249, 251,
349
- 253, 255, 257, 259, 261, 263, 278, 281,
350
- 284, 287, 290, 293, 296, 299, 302, 305,
351
- 308, 311, 314, 317, 320, 323, 327, 330,
352
- 333, 336, 339, 342, 345, 348, 351, 354,
353
- 357, 360, 363, 366, 369, 372, 375, 378,
354
- 381, 384, 387, 390, 393, 396, 399, 402,
355
- 405, 408, 411, 414, 417, 420, 423, 426,
356
- 429, 432, 434, 436, 438, 440, 442, 444,
357
- 446, 448, 450, 452, 454, 456, 458, 460,
358
- 462, 464, 466, 473, 476, 479, 482, 485,
359
- 488, 491, 494, 496, 498, 500, 502, 504,
360
- 506, 508, 510, 512, 524, 527, 530, 533,
361
- 536, 539, 542, 545, 548, 551, 554, 557,
362
- 560, 563, 566, 569, 572, 575, 578, 581,
363
- 584, 587, 590, 593, 596, 599, 602, 605,
364
- 608, 611, 614, 617, 620, 623, 626, 629,
365
- 632, 635, 638, 641, 644, 647, 650, 653,
366
- 656, 659, 662, 665, 668, 671, 674, 677,
367
- 680, 682, 684, 686, 688, 690, 692, 694,
368
- 696, 698, 700, 702, 704, 706, 708, 723,
369
- 726, 729, 732, 735, 738, 741, 744, 747,
370
- 750, 753, 756, 759, 762, 765, 768, 772,
371
- 775, 778, 781, 784, 787, 790, 793, 796,
372
- 799, 802, 805, 808, 811, 814, 817, 821,
373
- 824, 827, 830, 833, 836, 839, 842, 845,
374
- 848, 851, 854, 857, 860, 863, 866, 869,
375
- 872, 875, 878, 881, 884, 887, 890, 893,
376
- 896, 899, 902, 904, 908, 914, 918, 921,
377
- 927, 945, 948, 951, 954, 957, 960, 963,
378
- 966, 969, 972, 975, 978, 981, 984, 987,
379
- 990, 993, 996, 999, 1002, 1005, 1008, 1011,
380
- 1014, 1017, 1020, 1023, 1026, 1029, 1032, 1034
381
- };
382
-
383
- static const short _lexer_trans_targs[] = {
384
- 2, 4, 4, 5, 15, 17, 31, 34,
385
- 37, 65, 136, 154, 216, 220, 290, 290,
386
- 291, 4, 0, 3, 0, 4, 0, 4,
387
- 4, 5, 15, 17, 31, 34, 37, 65,
388
- 136, 154, 216, 220, 290, 290, 291, 4,
389
- 0, 6, 0, 7, 0, 9, 8, 8,
390
- 9, 8, 8, 10, 10, 11, 10, 10,
391
- 10, 10, 11, 10, 10, 10, 10, 12,
392
- 10, 10, 10, 10, 13, 10, 10, 4,
393
- 14, 14, 0, 4, 14, 14, 0, 4,
394
- 16, 15, 4, 0, 18, 0, 19, 0,
395
- 20, 0, 21, 0, 22, 0, 23, 0,
396
- 24, 0, 25, 0, 26, 0, 27, 0,
397
- 28, 0, 29, 0, 30, 0, 327, 0,
398
- 32, 0, 4, 16, 33, 4, 16, 33,
399
- 0, 0, 0, 0, 35, 36, 4, 36,
400
- 36, 34, 35, 35, 4, 36, 34, 36,
401
- 0, 38, 326, 0, 39, 0, 40, 0,
402
- 41, 0, 42, 0, 43, 0, 44, 0,
403
- 45, 0, 46, 0, 48, 47, 48, 47,
404
- 48, 48, 4, 49, 63, 4, 297, 305,
405
- 307, 314, 318, 325, 325, 48, 47, 48,
406
- 50, 47, 48, 51, 47, 48, 52, 47,
407
- 48, 53, 47, 48, 54, 47, 48, 55,
408
- 47, 48, 56, 47, 48, 57, 47, 48,
409
- 58, 47, 48, 59, 47, 48, 60, 47,
410
- 48, 61, 47, 48, 62, 47, 48, 4,
411
- 47, 48, 64, 47, 4, 4, 5, 15,
412
- 17, 31, 34, 37, 65, 136, 154, 216,
413
- 220, 290, 290, 291, 4, 0, 66, 129,
414
- 0, 67, 0, 68, 0, 69, 0, 70,
415
- 0, 71, 0, 72, 0, 73, 0, 74,
416
- 0, 75, 0, 77, 76, 77, 76, 77,
417
- 77, 4, 78, 92, 4, 93, 109, 111,
418
- 117, 121, 128, 128, 77, 76, 77, 79,
419
- 76, 77, 80, 76, 77, 81, 76, 77,
420
- 82, 76, 77, 83, 76, 77, 84, 76,
421
- 77, 85, 76, 77, 86, 76, 77, 87,
422
- 76, 77, 88, 76, 77, 89, 76, 77,
423
- 90, 76, 77, 91, 76, 77, 4, 76,
424
- 77, 64, 76, 77, 94, 102, 76, 77,
425
- 95, 76, 77, 96, 76, 77, 97, 76,
426
- 77, 98, 76, 77, 99, 76, 77, 100,
427
- 76, 77, 101, 76, 77, 64, 76, 77,
428
- 103, 76, 77, 104, 76, 77, 105, 76,
429
- 77, 106, 76, 77, 107, 76, 77, 108,
430
- 76, 77, 92, 76, 77, 110, 76, 77,
431
- 103, 76, 77, 112, 76, 77, 113, 76,
432
- 77, 114, 76, 77, 115, 76, 77, 116,
433
- 76, 77, 101, 76, 77, 118, 76, 77,
434
- 119, 76, 77, 120, 76, 77, 103, 76,
435
- 77, 122, 76, 77, 123, 76, 77, 124,
436
- 76, 77, 125, 76, 77, 126, 76, 77,
437
- 127, 76, 77, 101, 76, 77, 119, 76,
438
- 130, 0, 131, 0, 132, 0, 133, 0,
439
- 134, 0, 135, 0, 31, 0, 137, 0,
440
- 138, 0, 139, 0, 140, 0, 141, 0,
441
- 142, 0, 143, 0, 144, 0, 146, 145,
442
- 146, 145, 146, 146, 4, 147, 4, 146,
443
- 145, 146, 148, 145, 146, 149, 145, 146,
444
- 150, 145, 146, 151, 145, 146, 152, 145,
445
- 146, 153, 145, 146, 64, 145, 155, 0,
446
- 156, 0, 157, 0, 158, 0, 159, 0,
447
- 160, 0, 161, 0, 163, 162, 163, 162,
448
- 163, 163, 4, 164, 4, 178, 187, 196,
449
- 203, 209, 163, 162, 163, 165, 162, 163,
450
- 166, 162, 163, 167, 162, 163, 168, 162,
451
- 163, 169, 162, 163, 170, 162, 163, 171,
452
- 162, 163, 172, 162, 163, 173, 162, 163,
453
- 174, 162, 163, 175, 162, 163, 176, 162,
454
- 163, 177, 162, 163, 4, 162, 163, 179,
455
- 162, 163, 180, 162, 163, 181, 162, 163,
456
- 182, 162, 163, 183, 162, 163, 184, 162,
457
- 163, 185, 162, 163, 186, 162, 163, 64,
458
- 162, 163, 188, 162, 163, 189, 162, 163,
459
- 190, 162, 163, 191, 162, 163, 192, 162,
460
- 163, 193, 162, 163, 194, 162, 163, 195,
461
- 162, 163, 186, 162, 163, 197, 162, 163,
462
- 198, 162, 163, 199, 162, 163, 200, 162,
463
- 163, 201, 162, 163, 202, 162, 163, 186,
464
- 162, 163, 204, 162, 163, 205, 162, 163,
465
- 206, 162, 163, 207, 162, 163, 208, 162,
466
- 163, 186, 162, 163, 210, 162, 163, 211,
467
- 162, 163, 212, 162, 163, 213, 162, 163,
468
- 214, 162, 163, 215, 162, 163, 186, 162,
469
- 217, 0, 218, 0, 219, 0, 130, 0,
470
- 221, 0, 222, 0, 223, 0, 224, 0,
471
- 225, 0, 226, 0, 227, 0, 228, 0,
472
- 230, 229, 230, 229, 230, 230, 4, 231,
473
- 245, 4, 246, 262, 272, 278, 282, 289,
474
- 289, 230, 229, 230, 232, 229, 230, 233,
475
- 229, 230, 234, 229, 230, 235, 229, 230,
476
- 236, 229, 230, 237, 229, 230, 238, 229,
477
- 230, 239, 229, 230, 240, 229, 230, 241,
478
- 229, 230, 242, 229, 230, 243, 229, 230,
479
- 244, 229, 230, 4, 229, 230, 64, 229,
480
- 230, 247, 255, 229, 230, 248, 229, 230,
481
- 249, 229, 230, 250, 229, 230, 251, 229,
482
- 230, 252, 229, 230, 253, 229, 230, 254,
483
- 229, 230, 64, 229, 230, 256, 229, 230,
484
- 257, 229, 230, 258, 229, 230, 259, 229,
485
- 230, 260, 229, 230, 261, 229, 230, 245,
486
- 229, 230, 263, 271, 229, 230, 264, 229,
487
- 230, 265, 229, 230, 266, 229, 230, 267,
488
- 229, 230, 268, 229, 230, 269, 229, 230,
489
- 270, 229, 230, 254, 229, 230, 256, 229,
490
- 230, 273, 229, 230, 274, 229, 230, 275,
491
- 229, 230, 276, 229, 230, 277, 229, 230,
492
- 254, 229, 230, 279, 229, 230, 280, 229,
493
- 230, 281, 229, 230, 256, 229, 230, 283,
494
- 229, 230, 284, 229, 230, 285, 229, 230,
495
- 286, 229, 230, 287, 229, 230, 288, 229,
496
- 230, 254, 229, 230, 280, 229, 218, 0,
497
- 291, 292, 291, 0, 296, 295, 294, 292,
498
- 295, 293, 0, 294, 292, 293, 0, 294,
499
- 293, 296, 295, 294, 292, 295, 293, 296,
500
- 296, 5, 15, 17, 31, 34, 37, 65,
501
- 136, 154, 216, 220, 290, 290, 291, 296,
502
- 0, 48, 298, 47, 48, 299, 47, 48,
503
- 300, 47, 48, 301, 47, 48, 302, 47,
504
- 48, 303, 47, 48, 304, 47, 48, 63,
505
- 47, 48, 306, 47, 48, 299, 47, 48,
506
- 308, 47, 48, 309, 47, 48, 310, 47,
507
- 48, 311, 47, 48, 312, 47, 48, 313,
508
- 47, 48, 64, 47, 48, 315, 47, 48,
509
- 316, 47, 48, 317, 47, 48, 299, 47,
510
- 48, 319, 47, 48, 320, 47, 48, 321,
511
- 47, 48, 322, 47, 48, 323, 47, 48,
512
- 324, 47, 48, 313, 47, 48, 316, 47,
513
- 130, 0, 0, 0
514
- };
515
-
516
- static const unsigned char _lexer_trans_actions[] = {
517
- 0, 54, 0, 5, 1, 0, 29, 1,
518
- 29, 29, 29, 29, 29, 29, 29, 29,
519
- 35, 0, 43, 0, 43, 0, 43, 54,
520
- 0, 5, 1, 0, 29, 1, 29, 29,
521
- 29, 29, 29, 29, 29, 29, 35, 0,
522
- 43, 0, 43, 0, 43, 139, 48, 9,
523
- 106, 11, 0, 134, 45, 45, 45, 3,
524
- 122, 33, 33, 33, 0, 122, 33, 33,
525
- 33, 0, 122, 33, 0, 33, 0, 102,
526
- 7, 7, 43, 54, 0, 0, 43, 114,
527
- 25, 0, 54, 43, 0, 43, 0, 43,
528
- 0, 43, 0, 43, 0, 43, 0, 43,
529
- 0, 43, 0, 43, 0, 43, 0, 43,
530
- 0, 43, 0, 43, 0, 43, 0, 43,
531
- 0, 43, 149, 126, 57, 110, 23, 0,
532
- 43, 43, 43, 43, 0, 27, 118, 27,
533
- 27, 51, 27, 0, 54, 0, 1, 0,
534
- 43, 0, 0, 43, 0, 43, 0, 43,
535
- 0, 43, 0, 43, 0, 43, 0, 43,
536
- 0, 43, 0, 43, 144, 57, 54, 0,
537
- 54, 0, 78, 33, 84, 78, 84, 84,
538
- 84, 84, 84, 84, 84, 0, 0, 54,
539
- 0, 0, 54, 0, 0, 54, 0, 0,
540
- 54, 0, 0, 54, 0, 0, 54, 0,
541
- 0, 54, 0, 0, 54, 0, 0, 54,
542
- 0, 0, 54, 0, 0, 54, 0, 0,
543
- 54, 0, 0, 54, 0, 0, 54, 19,
544
- 0, 54, 19, 0, 130, 31, 60, 57,
545
- 31, 63, 57, 63, 63, 63, 63, 63,
546
- 63, 63, 63, 66, 31, 43, 0, 0,
547
- 43, 0, 43, 0, 43, 0, 43, 0,
548
- 43, 0, 43, 0, 43, 0, 43, 0,
549
- 43, 0, 43, 144, 57, 54, 0, 54,
550
- 0, 72, 33, 84, 72, 84, 84, 84,
551
- 84, 84, 84, 84, 0, 0, 54, 0,
552
- 0, 54, 0, 0, 54, 0, 0, 54,
553
- 0, 0, 54, 0, 0, 54, 0, 0,
554
- 54, 0, 0, 54, 0, 0, 54, 0,
555
- 0, 54, 0, 0, 54, 0, 0, 54,
556
- 0, 0, 54, 0, 0, 54, 15, 0,
557
- 54, 15, 0, 54, 0, 0, 0, 54,
558
- 0, 0, 54, 0, 0, 54, 0, 0,
559
- 54, 0, 0, 54, 0, 0, 54, 0,
560
- 0, 54, 0, 0, 54, 15, 0, 54,
561
- 0, 0, 54, 0, 0, 54, 0, 0,
562
- 54, 0, 0, 54, 0, 0, 54, 0,
563
- 0, 54, 0, 0, 54, 0, 0, 54,
564
- 0, 0, 54, 0, 0, 54, 0, 0,
565
- 54, 0, 0, 54, 0, 0, 54, 0,
566
- 0, 54, 0, 0, 54, 0, 0, 54,
567
- 0, 0, 54, 0, 0, 54, 0, 0,
568
- 54, 0, 0, 54, 0, 0, 54, 0,
569
- 0, 54, 0, 0, 54, 0, 0, 54,
570
- 0, 0, 54, 0, 0, 54, 0, 0,
571
- 0, 43, 0, 43, 0, 43, 0, 43,
572
- 0, 43, 0, 43, 0, 43, 0, 43,
573
- 0, 43, 0, 43, 0, 43, 0, 43,
574
- 0, 43, 0, 43, 0, 43, 144, 57,
575
- 54, 0, 54, 0, 81, 84, 81, 0,
576
- 0, 54, 0, 0, 54, 0, 0, 54,
577
- 0, 0, 54, 0, 0, 54, 0, 0,
578
- 54, 0, 0, 54, 21, 0, 0, 43,
579
- 0, 43, 0, 43, 0, 43, 0, 43,
580
- 0, 43, 0, 43, 144, 57, 54, 0,
581
- 54, 0, 69, 33, 69, 84, 84, 84,
582
- 84, 84, 0, 0, 54, 0, 0, 54,
583
- 0, 0, 54, 0, 0, 54, 0, 0,
584
- 54, 0, 0, 54, 0, 0, 54, 0,
585
- 0, 54, 0, 0, 54, 0, 0, 54,
586
- 0, 0, 54, 0, 0, 54, 0, 0,
587
- 54, 0, 0, 54, 13, 0, 54, 0,
588
- 0, 54, 0, 0, 54, 0, 0, 54,
589
- 0, 0, 54, 0, 0, 54, 0, 0,
590
- 54, 0, 0, 54, 0, 0, 54, 13,
591
- 0, 54, 0, 0, 54, 0, 0, 54,
592
- 0, 0, 54, 0, 0, 54, 0, 0,
593
- 54, 0, 0, 54, 0, 0, 54, 0,
594
- 0, 54, 0, 0, 54, 0, 0, 54,
595
- 0, 0, 54, 0, 0, 54, 0, 0,
596
- 54, 0, 0, 54, 0, 0, 54, 0,
597
- 0, 54, 0, 0, 54, 0, 0, 54,
598
- 0, 0, 54, 0, 0, 54, 0, 0,
599
- 54, 0, 0, 54, 0, 0, 54, 0,
600
- 0, 54, 0, 0, 54, 0, 0, 54,
601
- 0, 0, 54, 0, 0, 54, 0, 0,
602
- 0, 43, 0, 43, 0, 43, 0, 43,
603
- 0, 43, 0, 43, 0, 43, 0, 43,
604
- 0, 43, 0, 43, 0, 43, 0, 43,
605
- 144, 57, 54, 0, 54, 0, 75, 33,
606
- 84, 75, 84, 84, 84, 84, 84, 84,
607
- 84, 0, 0, 54, 0, 0, 54, 0,
608
- 0, 54, 0, 0, 54, 0, 0, 54,
609
- 0, 0, 54, 0, 0, 54, 0, 0,
610
- 54, 0, 0, 54, 0, 0, 54, 0,
611
- 0, 54, 0, 0, 54, 0, 0, 54,
612
- 0, 0, 54, 17, 0, 54, 17, 0,
613
- 54, 0, 0, 0, 54, 0, 0, 54,
614
- 0, 0, 54, 0, 0, 54, 0, 0,
615
- 54, 0, 0, 54, 0, 0, 54, 0,
616
- 0, 54, 17, 0, 54, 0, 0, 54,
617
- 0, 0, 54, 0, 0, 54, 0, 0,
618
- 54, 0, 0, 54, 0, 0, 54, 0,
619
- 0, 54, 0, 0, 0, 54, 0, 0,
620
- 54, 0, 0, 54, 0, 0, 54, 0,
621
- 0, 54, 0, 0, 54, 0, 0, 54,
622
- 0, 0, 54, 0, 0, 54, 0, 0,
623
- 54, 0, 0, 54, 0, 0, 54, 0,
624
- 0, 54, 0, 0, 54, 0, 0, 54,
625
- 0, 0, 54, 0, 0, 54, 0, 0,
626
- 54, 0, 0, 54, 0, 0, 54, 0,
627
- 0, 54, 0, 0, 54, 0, 0, 54,
628
- 0, 0, 54, 0, 0, 54, 0, 0,
629
- 54, 0, 0, 54, 0, 0, 0, 43,
630
- 0, 0, 0, 43, 54, 37, 37, 87,
631
- 37, 37, 43, 0, 39, 0, 43, 0,
632
- 0, 54, 0, 0, 39, 0, 0, 54,
633
- 0, 93, 90, 41, 96, 90, 96, 96,
634
- 96, 96, 96, 96, 96, 96, 99, 0,
635
- 43, 54, 0, 0, 54, 0, 0, 54,
636
- 0, 0, 54, 0, 0, 54, 0, 0,
637
- 54, 0, 0, 54, 0, 0, 54, 0,
638
- 0, 54, 0, 0, 54, 0, 0, 54,
639
- 0, 0, 54, 0, 0, 54, 0, 0,
640
- 54, 0, 0, 54, 0, 0, 54, 0,
641
- 0, 54, 19, 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
- 0, 43, 0, 0
647
- };
648
-
649
- static const unsigned char _lexer_eof_actions[] = {
650
- 0, 43, 43, 43, 43, 43, 43, 43,
651
- 43, 43, 43, 43, 43, 43, 43, 43,
652
- 43, 43, 43, 43, 43, 43, 43, 43,
653
- 43, 43, 43, 43, 43, 43, 43, 43,
654
- 43, 43, 43, 43, 43, 43, 43, 43,
655
- 43, 43, 43, 43, 43, 43, 43, 43,
656
- 43, 43, 43, 43, 43, 43, 43, 43,
657
- 43, 43, 43, 43, 43, 43, 43, 43,
658
- 43, 43, 43, 43, 43, 43, 43, 43,
659
- 43, 43, 43, 43, 43, 43, 43, 43,
660
- 43, 43, 43, 43, 43, 43, 43, 43,
661
- 43, 43, 43, 43, 43, 43, 43, 43,
662
- 43, 43, 43, 43, 43, 43, 43, 43,
663
- 43, 43, 43, 43, 43, 43, 43, 43,
664
- 43, 43, 43, 43, 43, 43, 43, 43,
665
- 43, 43, 43, 43, 43, 43, 43, 43,
666
- 43, 43, 43, 43, 43, 43, 43, 43,
667
- 43, 43, 43, 43, 43, 43, 43, 43,
668
- 43, 43, 43, 43, 43, 43, 43, 43,
669
- 43, 43, 43, 43, 43, 43, 43, 43,
670
- 43, 43, 43, 43, 43, 43, 43, 43,
671
- 43, 43, 43, 43, 43, 43, 43, 43,
672
- 43, 43, 43, 43, 43, 43, 43, 43,
673
- 43, 43, 43, 43, 43, 43, 43, 43,
674
- 43, 43, 43, 43, 43, 43, 43, 43,
675
- 43, 43, 43, 43, 43, 43, 43, 43,
676
- 43, 43, 43, 43, 43, 43, 43, 43,
677
- 43, 43, 43, 43, 43, 43, 43, 43,
678
- 43, 43, 43, 43, 43, 43, 43, 43,
679
- 43, 43, 43, 43, 43, 43, 43, 43,
680
- 43, 43, 43, 43, 43, 43, 43, 43,
681
- 43, 43, 43, 43, 43, 43, 43, 43,
682
- 43, 43, 43, 43, 43, 43, 43, 43,
683
- 43, 43, 43, 43, 43, 43, 43, 43,
684
- 43, 43, 43, 43, 43, 43, 43, 43,
685
- 43, 43, 43, 43, 43, 43, 43, 43,
686
- 43, 43, 43, 43, 43, 43, 43, 43,
687
- 43, 43, 43, 43, 43, 43, 43, 43,
688
- 43, 43, 43, 43, 43, 43, 43, 43,
689
- 43, 43, 43, 43, 43, 43, 43, 43,
690
- 43, 43, 43, 43, 43, 43, 43, 43
691
- };
692
-
693
- static const int lexer_start = 1;
694
- static const int lexer_first_final = 327;
695
- static const int lexer_error = 0;
696
-
697
- static const int lexer_en_main = 1;
698
-
699
-
700
- #line 258 "ragel/i18n/en_tx.c.rl"
701
-
702
- static VALUE
703
- unindent(VALUE con, int start_col)
704
- {
705
- VALUE re;
706
- /* Gherkin will crash gracefully if the string representation of start_col pushes the pattern past 32 characters */
707
- char pat[32];
708
- snprintf(pat, 32, "^[\t ]{0,%d}", start_col);
709
- re = rb_reg_regcomp(rb_str_new2(pat));
710
- rb_funcall(con, rb_intern("gsub!"), 2, re, rb_str_new2(""));
711
-
712
- return Qnil;
713
-
714
- }
715
-
716
- static void
717
- store_kw_con(VALUE listener, const char * event_name,
718
- const char * keyword_at, size_t keyword_length,
719
- const char * at, size_t length,
720
- int current_line)
721
- {
722
- VALUE con = Qnil, kw = Qnil;
723
- kw = ENCODED_STR_NEW(keyword_at, keyword_length);
724
- con = ENCODED_STR_NEW(at, length);
725
- rb_funcall(con, rb_intern("strip!"), 0);
726
- rb_funcall(listener, rb_intern(event_name), 3, kw, con, INT2FIX(current_line));
727
- }
728
-
729
- static void
730
- store_multiline_kw_con(VALUE listener, const char * event_name,
731
- const char * keyword_at, size_t keyword_length,
732
- const char * at, size_t length,
733
- int current_line, int start_col)
734
- {
735
- VALUE split;
736
- VALUE con = Qnil, kw = Qnil, name = Qnil, desc = Qnil;
737
-
738
- kw = ENCODED_STR_NEW(keyword_at, keyword_length);
739
- con = ENCODED_STR_NEW(at, length);
740
-
741
- unindent(con, start_col);
742
-
743
- split = rb_str_split(con, "\n");
744
-
745
- name = rb_funcall(split, rb_intern("shift"), 0);
746
- desc = rb_ary_join(split, rb_str_new2( "\n" ));
747
-
748
- if( name == Qnil )
749
- {
750
- name = rb_str_new2("");
751
- }
752
- if( rb_funcall(desc, rb_intern("size"), 0) == 0)
753
- {
754
- desc = rb_str_new2("");
755
- }
756
- rb_funcall(name, rb_intern("strip!"), 0);
757
- rb_funcall(desc, rb_intern("rstrip!"), 0);
758
- rb_funcall(listener, rb_intern(event_name), 4, kw, name, desc, INT2FIX(current_line));
759
- }
760
-
761
- static void
762
- store_attr(VALUE listener, const char * attr_type,
763
- const char * at, size_t length,
764
- int line)
765
- {
766
- VALUE val = ENCODED_STR_NEW(at, length);
767
- rb_funcall(listener, rb_intern(attr_type), 2, val, INT2FIX(line));
768
- }
769
- static void
770
- store_docstring_content(VALUE listener,
771
- int start_col,
772
- const char *type_at, size_t type_length,
773
- const char *at, size_t length,
774
- int current_line)
775
- {
776
- VALUE re2;
777
- VALUE unescape_escaped_quotes;
778
- VALUE con = ENCODED_STR_NEW(at, length);
779
- VALUE con_type = ENCODED_STR_NEW(type_at, type_length);
780
-
781
- unindent(con, start_col);
782
-
783
- re2 = rb_reg_regcomp(rb_str_new2("\r\\Z"));
784
- unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\""));
785
- rb_funcall(con, rb_intern("sub!"), 2, re2, rb_str_new2(""));
786
- rb_funcall(con_type, rb_intern("strip!"), 0);
787
- rb_funcall(con, rb_intern("gsub!"), 2, unescape_escaped_quotes, rb_str_new2("\"\"\""));
788
- rb_funcall(listener, rb_intern("doc_string"), 3, con_type, con, INT2FIX(current_line));
789
- }
790
- static void
791
- raise_lexer_error(const char * at, int line)
792
- {
793
- rb_raise(rb_eGherkinLexingError, "Lexing error on line %d: '%s'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.", line, at);
794
- }
795
-
796
- static void lexer_init(lexer_state *lexer) {
797
- lexer->content_start = 0;
798
- lexer->content_end = 0;
799
- lexer->content_len = 0;
800
- lexer->docstring_content_type_start = 0;
801
- lexer->docstring_content_type_end = 0;
802
- lexer->mark = 0;
803
- lexer->keyword_start = 0;
804
- lexer->keyword_end = 0;
805
- lexer->next_keyword_start = 0;
806
- lexer->line_number = 1;
807
- lexer->last_newline = 0;
808
- lexer->final_newline = 0;
809
- lexer->start_col = 0;
810
- }
811
-
812
- static VALUE CLexer_alloc(VALUE klass)
813
- {
814
- VALUE obj;
815
- lexer_state *lxr = ALLOC(lexer_state);
816
- lexer_init(lxr);
817
-
818
- obj = Data_Wrap_Struct(klass, NULL, -1, lxr);
819
-
820
- return obj;
821
- }
822
-
823
- static VALUE CLexer_init(VALUE self, VALUE listener)
824
- {
825
- lexer_state *lxr;
826
- rb_iv_set(self, "@listener", listener);
827
-
828
- lxr = NULL;
829
- DATA_GET(self, lexer_state, lxr);
830
- lexer_init(lxr);
831
-
832
- return self;
833
- }
834
-
835
- static VALUE CLexer_scan(VALUE self, VALUE input)
836
- {
837
- VALUE input_copy;
838
- char *data;
839
- size_t len;
840
- VALUE listener = rb_iv_get(self, "@listener");
841
-
842
- lexer_state *lexer;
843
- lexer = NULL;
844
- DATA_GET(self, lexer_state, lexer);
845
-
846
- input_copy = rb_str_dup(input);
847
-
848
- rb_str_append(input_copy, rb_str_new2("\n%_FEATURE_END_%"));
849
- data = RSTRING_PTR(input_copy);
850
- len = RSTRING_LEN(input_copy);
851
-
852
- if (len == 0) {
853
- rb_raise(rb_eGherkinLexingError, "No content to lex.");
854
- } else {
855
-
856
- const char *p, *pe, *eof;
857
- int cs = 0;
858
-
859
- VALUE current_row = Qnil;
860
-
861
- p = data;
862
- pe = data + len;
863
- eof = pe;
864
-
865
- assert(*pe == '\0' && "pointer does not end on NULL");
866
-
867
-
868
- #line 869 "ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c"
869
- {
870
- cs = lexer_start;
871
- }
872
-
873
- #line 425 "ragel/i18n/en_tx.c.rl"
874
-
875
- #line 876 "ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c"
876
- {
877
- int _klen;
878
- unsigned int _trans;
879
- const char *_acts;
880
- unsigned int _nacts;
881
- const char *_keys;
882
-
883
- if ( p == pe )
884
- goto _test_eof;
885
- if ( cs == 0 )
886
- goto _out;
887
- _resume:
888
- _keys = _lexer_trans_keys + _lexer_key_offsets[cs];
889
- _trans = _lexer_index_offsets[cs];
890
-
891
- _klen = _lexer_single_lengths[cs];
892
- if ( _klen > 0 ) {
893
- const char *_lower = _keys;
894
- const char *_mid;
895
- const char *_upper = _keys + _klen - 1;
896
- while (1) {
897
- if ( _upper < _lower )
898
- break;
899
-
900
- _mid = _lower + ((_upper-_lower) >> 1);
901
- if ( (*p) < *_mid )
902
- _upper = _mid - 1;
903
- else if ( (*p) > *_mid )
904
- _lower = _mid + 1;
905
- else {
906
- _trans += (unsigned int)(_mid - _keys);
907
- goto _match;
908
- }
909
- }
910
- _keys += _klen;
911
- _trans += _klen;
912
- }
913
-
914
- _klen = _lexer_range_lengths[cs];
915
- if ( _klen > 0 ) {
916
- const char *_lower = _keys;
917
- const char *_mid;
918
- const char *_upper = _keys + (_klen<<1) - 2;
919
- while (1) {
920
- if ( _upper < _lower )
921
- break;
922
-
923
- _mid = _lower + (((_upper-_lower) >> 1) & ~1);
924
- if ( (*p) < _mid[0] )
925
- _upper = _mid - 2;
926
- else if ( (*p) > _mid[1] )
927
- _lower = _mid + 2;
928
- else {
929
- _trans += (unsigned int)((_mid - _keys)>>1);
930
- goto _match;
931
- }
932
- }
933
- _trans += _klen;
934
- }
935
-
936
- _match:
937
- cs = _lexer_trans_targs[_trans];
938
-
939
- if ( _lexer_trans_actions[_trans] == 0 )
940
- goto _again;
941
-
942
- _acts = _lexer_actions + _lexer_trans_actions[_trans];
943
- _nacts = (unsigned int) *_acts++;
944
- while ( _nacts-- > 0 )
945
- {
946
- switch ( *_acts++ )
947
- {
948
- case 0:
949
- #line 83 "ragel/i18n/en_tx.c.rl"
950
- {
951
- MARK(content_start, p);
952
- lexer->current_line = lexer->line_number;
953
- lexer->start_col = lexer->content_start - lexer->last_newline - (lexer->keyword_end - lexer->keyword_start) + 2;
954
- }
955
- break;
956
- case 1:
957
- #line 89 "ragel/i18n/en_tx.c.rl"
958
- {
959
- MARK(content_start, p);
960
- }
961
- break;
962
- case 2:
963
- #line 93 "ragel/i18n/en_tx.c.rl"
964
- {
965
- lexer->current_line = lexer->line_number;
966
- lexer->start_col = p - data - lexer->last_newline;
967
- }
968
- break;
969
- case 3:
970
- #line 98 "ragel/i18n/en_tx.c.rl"
971
- {
972
- int len = LEN(content_start, PTR_TO(final_newline));
973
- int type_len = LEN(docstring_content_type_start, PTR_TO(docstring_content_type_end));
974
-
975
- if (len < 0) len = 0;
976
- if (type_len < 0) len = 0;
977
-
978
- store_docstring_content(listener, lexer->start_col, PTR_TO(docstring_content_type_start), type_len, PTR_TO(content_start), len, lexer->current_line);
979
- }
980
- break;
981
- case 4:
982
- #line 108 "ragel/i18n/en_tx.c.rl"
983
- {
984
- MARK(docstring_content_type_start, p);
985
- }
986
- break;
987
- case 5:
988
- #line 112 "ragel/i18n/en_tx.c.rl"
989
- {
990
- MARK(docstring_content_type_end, p);
991
- }
992
- break;
993
- case 6:
994
- #line 116 "ragel/i18n/en_tx.c.rl"
995
- {
996
- STORE_KW_END_CON(feature);
997
- }
998
- break;
999
- case 7:
1000
- #line 120 "ragel/i18n/en_tx.c.rl"
1001
- {
1002
- STORE_KW_END_CON(background);
1003
- }
1004
- break;
1005
- case 8:
1006
- #line 124 "ragel/i18n/en_tx.c.rl"
1007
- {
1008
- STORE_KW_END_CON(scenario);
1009
- }
1010
- break;
1011
- case 9:
1012
- #line 128 "ragel/i18n/en_tx.c.rl"
1013
- {
1014
- STORE_KW_END_CON(scenario_outline);
1015
- }
1016
- break;
1017
- case 10:
1018
- #line 132 "ragel/i18n/en_tx.c.rl"
1019
- {
1020
- STORE_KW_END_CON(examples);
1021
- }
1022
- break;
1023
- case 11:
1024
- #line 136 "ragel/i18n/en_tx.c.rl"
1025
- {
1026
- store_kw_con(listener, "step",
1027
- PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end)),
1028
- PTR_TO(content_start), LEN(content_start, p),
1029
- lexer->current_line);
1030
- }
1031
- break;
1032
- case 12:
1033
- #line 143 "ragel/i18n/en_tx.c.rl"
1034
- {
1035
- STORE_ATTR(comment);
1036
- lexer->mark = 0;
1037
- }
1038
- break;
1039
- case 13:
1040
- #line 148 "ragel/i18n/en_tx.c.rl"
1041
- {
1042
- STORE_ATTR(tag);
1043
- lexer->mark = 0;
1044
- }
1045
- break;
1046
- case 14:
1047
- #line 153 "ragel/i18n/en_tx.c.rl"
1048
- {
1049
- lexer->line_number += 1;
1050
- MARK(final_newline, p);
1051
- }
1052
- break;
1053
- case 15:
1054
- #line 158 "ragel/i18n/en_tx.c.rl"
1055
- {
1056
- MARK(last_newline, p + 1);
1057
- }
1058
- break;
1059
- case 16:
1060
- #line 162 "ragel/i18n/en_tx.c.rl"
1061
- {
1062
- if (lexer->mark == 0) {
1063
- MARK(mark, p);
1064
- }
1065
- }
1066
- break;
1067
- case 17:
1068
- #line 168 "ragel/i18n/en_tx.c.rl"
1069
- {
1070
- MARK(keyword_end, p);
1071
- MARK(keyword_start, PTR_TO(mark));
1072
- MARK(content_start, p + 1);
1073
- lexer->mark = 0;
1074
- }
1075
- break;
1076
- case 18:
1077
- #line 175 "ragel/i18n/en_tx.c.rl"
1078
- {
1079
- MARK(content_end, p);
1080
- }
1081
- break;
1082
- case 19:
1083
- #line 179 "ragel/i18n/en_tx.c.rl"
1084
- {
1085
- p = p - 1;
1086
- lexer->current_line = lexer->line_number;
1087
- current_row = rb_ary_new();
1088
- }
1089
- break;
1090
- case 20:
1091
- #line 185 "ragel/i18n/en_tx.c.rl"
1092
- {
1093
- MARK(content_start, p);
1094
- }
1095
- break;
1096
- case 21:
1097
- #line 189 "ragel/i18n/en_tx.c.rl"
1098
- {
1099
- VALUE re_pipe, re_newline, re_backslash;
1100
- VALUE con = ENCODED_STR_NEW(PTR_TO(content_start), LEN(content_start, p));
1101
- rb_funcall(con, rb_intern("strip!"), 0);
1102
- re_pipe = rb_reg_regcomp(rb_str_new2("\\\\\\|"));
1103
- re_newline = rb_reg_regcomp(rb_str_new2("\\\\n"));
1104
- re_backslash = rb_reg_regcomp(rb_str_new2("\\\\\\\\"));
1105
- rb_funcall(con, rb_intern("gsub!"), 2, re_pipe, rb_str_new2("|"));
1106
- rb_funcall(con, rb_intern("gsub!"), 2, re_newline, rb_str_new2("\n"));
1107
- rb_funcall(con, rb_intern("gsub!"), 2, re_backslash, rb_str_new2("\\"));
1108
-
1109
- rb_ary_push(current_row, con);
1110
- }
1111
- break;
1112
- case 22:
1113
- #line 203 "ragel/i18n/en_tx.c.rl"
1114
- {
1115
- rb_funcall(listener, rb_intern("row"), 2, current_row, INT2FIX(lexer->current_line));
1116
- }
1117
- break;
1118
- case 23:
1119
- #line 207 "ragel/i18n/en_tx.c.rl"
1120
- {
1121
- int line;
1122
- if (cs < lexer_first_final) {
1123
- size_t count = 0;
1124
- VALUE newstr_val;
1125
- char *newstr;
1126
- int newstr_count = 0;
1127
- size_t len;
1128
- const char *buff;
1129
- if (lexer->last_newline != 0) {
1130
- len = LEN(last_newline, eof);
1131
- buff = PTR_TO(last_newline);
1132
- } else {
1133
- len = strlen(data);
1134
- buff = data;
1135
- }
1136
-
1137
- /* Allocate as a ruby string so that it gets cleaned up by GC */
1138
- newstr_val = rb_str_new(buff, len);
1139
- newstr = RSTRING_PTR(newstr_val);
1140
-
1141
-
1142
- for (count = 0; count < len; count++) {
1143
- if(buff[count] == 10) {
1144
- newstr[newstr_count] = '\0'; /* terminate new string at first newline found */
1145
- break;
1146
- } else {
1147
- if (buff[count] == '%') {
1148
- newstr[newstr_count++] = buff[count];
1149
- newstr[newstr_count] = buff[count];
1150
- } else {
1151
- newstr[newstr_count] = buff[count];
1152
- }
1153
- }
1154
- newstr_count++;
1155
- }
1156
-
1157
- line = lexer->line_number;
1158
- lexer_init(lexer); /* Re-initialize so we can scan again with the same lexer */
1159
- raise_lexer_error(newstr, line);
1160
- } else {
1161
- rb_funcall(listener, rb_intern("eof"), 0);
1162
- }
1163
- }
1164
- break;
1165
- #line 1166 "ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c"
1166
- }
1167
- }
1168
-
1169
- _again:
1170
- if ( cs == 0 )
1171
- goto _out;
1172
- if ( ++p != pe )
1173
- goto _resume;
1174
- _test_eof: {}
1175
- if ( p == eof )
1176
- {
1177
- const char *__acts = _lexer_actions + _lexer_eof_actions[cs];
1178
- unsigned int __nacts = (unsigned int) *__acts++;
1179
- while ( __nacts-- > 0 ) {
1180
- switch ( *__acts++ ) {
1181
- case 23:
1182
- #line 207 "ragel/i18n/en_tx.c.rl"
1183
- {
1184
- int line;
1185
- if (cs < lexer_first_final) {
1186
- size_t count = 0;
1187
- VALUE newstr_val;
1188
- char *newstr;
1189
- int newstr_count = 0;
1190
- size_t len;
1191
- const char *buff;
1192
- if (lexer->last_newline != 0) {
1193
- len = LEN(last_newline, eof);
1194
- buff = PTR_TO(last_newline);
1195
- } else {
1196
- len = strlen(data);
1197
- buff = data;
1198
- }
1199
-
1200
- /* Allocate as a ruby string so that it gets cleaned up by GC */
1201
- newstr_val = rb_str_new(buff, len);
1202
- newstr = RSTRING_PTR(newstr_val);
1203
-
1204
-
1205
- for (count = 0; count < len; count++) {
1206
- if(buff[count] == 10) {
1207
- newstr[newstr_count] = '\0'; /* terminate new string at first newline found */
1208
- break;
1209
- } else {
1210
- if (buff[count] == '%') {
1211
- newstr[newstr_count++] = buff[count];
1212
- newstr[newstr_count] = buff[count];
1213
- } else {
1214
- newstr[newstr_count] = buff[count];
1215
- }
1216
- }
1217
- newstr_count++;
1218
- }
1219
-
1220
- line = lexer->line_number;
1221
- lexer_init(lexer); /* Re-initialize so we can scan again with the same lexer */
1222
- raise_lexer_error(newstr, line);
1223
- } else {
1224
- rb_funcall(listener, rb_intern("eof"), 0);
1225
- }
1226
- }
1227
- break;
1228
- #line 1229 "ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c"
1229
- }
1230
- }
1231
- }
1232
-
1233
- _out: {}
1234
- }
1235
-
1236
- #line 426 "ragel/i18n/en_tx.c.rl"
1237
-
1238
- assert(p <= pe && "data overflow after parsing execute");
1239
- assert(lexer->content_start <= len && "content starts after data end");
1240
- assert(lexer->mark < len && "mark is after data end");
1241
-
1242
- /* Reset lexer by re-initializing the whole thing */
1243
- lexer_init(lexer);
1244
-
1245
- if (cs == lexer_error) {
1246
- rb_raise(rb_eGherkinLexingError, "Invalid format, lexing fails.");
1247
- } else {
1248
- return Qtrue;
1249
- }
1250
- }
1251
- }
1252
-
1253
- void Init_gherkin_lexer_en_tx()
1254
- {
1255
- mGherkin = rb_define_module("Gherkin");
1256
- mGherkinLexer = rb_define_module_under(mGherkin, "Lexer");
1257
- rb_eGherkinLexingError = rb_const_get(mGherkinLexer, rb_intern("LexingError"));
1258
-
1259
- mCLexer = rb_define_module_under(mGherkin, "CLexer");
1260
- cI18nLexer = rb_define_class_under(mCLexer, "En_tx", rb_cObject);
1261
- rb_define_alloc_func(cI18nLexer, CLexer_alloc);
1262
- rb_define_method(cI18nLexer, "initialize", CLexer_init, 1);
1263
- rb_define_method(cI18nLexer, "scan", CLexer_scan, 1);
1264
- }
1265
-