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