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