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,48 +0,0 @@
1
- #encoding: utf-8
2
- require 'gherkin/i18n'
3
- require 'gherkin/native'
4
-
5
- module Gherkin
6
- module Lexer
7
- LexingError = Class.new(StandardError)
8
-
9
- # The main entry point to lexing Gherkin source.
10
- class I18nLexer
11
- native_impl('gherkin')
12
-
13
- COMMENT_OR_EMPTY_LINE_PATTERN = /^(\xEF\xBB\xBF)?\s*#|^\s*$/
14
- LANGUAGE_PATTERN = /^(\xEF\xBB\xBF)?\s*#\s*language\s*:\s*([a-zA-Z\-]+)/ #:nodoc:
15
- attr_reader :i18n_language
16
-
17
- def initialize(listener, force_ruby=false, iso_code='en')
18
- @listener = listener
19
- @force_ruby = force_ruby
20
- @iso_code = iso_code
21
- end
22
-
23
- def scan(source)
24
- create_delegate(source).scan(source)
25
- end
26
-
27
- private
28
-
29
- def create_delegate(source)
30
- @i18n_language = lang(source)
31
- @i18n_language.lexer(@listener, @force_ruby)
32
- end
33
-
34
- def lang(source)
35
- key = @iso_code
36
- source.each_line do |line|
37
- break unless COMMENT_OR_EMPTY_LINE_PATTERN =~ line
38
- if LANGUAGE_PATTERN =~ line
39
- key = $2
40
- break
41
- end
42
- end
43
- I18n.get(key)
44
- end
45
-
46
- end
47
- end
48
- end
@@ -1,963 +0,0 @@
1
-
2
- # line 1 "ragel/i18n/id.rb.rl"
3
- require 'gherkin/native'
4
-
5
- module Gherkin
6
- module Lexer
7
- class Id #:nodoc:
8
- native_impl('gherkin')
9
-
10
-
11
- # line 125 "ragel/i18n/id.rb.rl"
12
-
13
-
14
- def initialize(listener)
15
- @listener = listener
16
-
17
- # Initialize ivars to avoid warnings
18
- @keyword = nil
19
-
20
- # line 21 "lib/gherkin/lexer/id.rb"
21
- class << self
22
- attr_accessor :_lexer_actions
23
- private :_lexer_actions, :_lexer_actions=
24
- end
25
- self._lexer_actions = [
26
- 0, 1, 0, 1, 1, 1, 2, 1,
27
- 3, 1, 4, 1, 5, 1, 6, 1,
28
- 7, 1, 8, 1, 9, 1, 10, 1,
29
- 11, 1, 12, 1, 13, 1, 16, 1,
30
- 17, 1, 18, 1, 19, 1, 20, 1,
31
- 21, 1, 22, 1, 23, 2, 2, 18,
32
- 2, 3, 4, 2, 13, 0, 2, 14,
33
- 15, 2, 17, 0, 2, 17, 1, 2,
34
- 17, 16, 2, 17, 19, 2, 18, 6,
35
- 2, 18, 7, 2, 18, 8, 2, 18,
36
- 9, 2, 18, 10, 2, 18, 16, 2,
37
- 20, 21, 2, 22, 0, 2, 22, 1,
38
- 2, 22, 16, 2, 22, 19, 3, 4,
39
- 14, 15, 3, 5, 14, 15, 3, 11,
40
- 14, 15, 3, 12, 14, 15, 3, 13,
41
- 14, 15, 3, 14, 15, 18, 3, 17,
42
- 0, 11, 3, 17, 14, 15, 4, 2,
43
- 14, 15, 18, 4, 3, 4, 14, 15,
44
- 4, 17, 0, 14, 15, 5, 17, 0,
45
- 11, 14, 15
46
- ]
47
-
48
- class << self
49
- attr_accessor :_lexer_key_offsets
50
- private :_lexer_key_offsets, :_lexer_key_offsets=
51
- end
52
- self._lexer_key_offsets = [
53
- 0, 0, 18, 19, 20, 37, 38, 39,
54
- 41, 43, 48, 53, 58, 63, 67, 71,
55
- 73, 74, 75, 76, 77, 78, 79, 80,
56
- 81, 82, 83, 84, 85, 86, 87, 88,
57
- 89, 91, 93, 98, 105, 110, 111, 112,
58
- 113, 114, 115, 116, 117, 118, 125, 127,
59
- 129, 131, 133, 135, 152, 154, 156, 157,
60
- 158, 159, 160, 161, 175, 177, 179, 181,
61
- 183, 185, 187, 189, 191, 193, 195, 197,
62
- 199, 201, 203, 205, 208, 210, 212, 214,
63
- 216, 218, 220, 222, 224, 226, 228, 230,
64
- 232, 234, 236, 238, 240, 242, 244, 246,
65
- 248, 250, 252, 255, 257, 259, 261, 263,
66
- 265, 267, 269, 271, 273, 274, 275, 276,
67
- 277, 278, 279, 280, 281, 282, 283, 284,
68
- 295, 297, 299, 301, 303, 305, 307, 309,
69
- 311, 313, 315, 317, 319, 321, 323, 325,
70
- 327, 329, 331, 333, 335, 337, 339, 341,
71
- 343, 345, 347, 349, 351, 353, 355, 357,
72
- 359, 361, 363, 366, 368, 370, 372, 374,
73
- 376, 378, 379, 380, 381, 382, 383, 384,
74
- 385, 386, 387, 388, 389, 390, 391, 393,
75
- 394, 395, 396, 397, 398, 399, 400, 401,
76
- 402, 416, 418, 420, 422, 424, 426, 428,
77
- 430, 432, 434, 436, 438, 440, 442, 444,
78
- 446, 449, 451, 453, 455, 457, 459, 461,
79
- 463, 465, 467, 469, 471, 473, 475, 477,
80
- 479, 481, 483, 485, 487, 489, 491, 493,
81
- 495, 497, 499, 500, 501, 515, 517, 519,
82
- 521, 523, 525, 527, 529, 531, 533, 535,
83
- 537, 539, 541, 543, 545, 548, 551, 553,
84
- 555, 557, 559, 561, 563, 565, 567, 569,
85
- 571, 573, 575, 577, 579, 581, 583, 585,
86
- 587, 589, 591, 593, 595, 597, 600, 602,
87
- 604, 606, 608, 610, 612, 614, 616, 618,
88
- 619, 620, 621, 625, 631, 634, 636, 642,
89
- 659
90
- ]
91
-
92
- class << self
93
- attr_accessor :_lexer_trans_keys
94
- private :_lexer_trans_keys, :_lexer_trans_keys=
95
- end
96
- self._lexer_trans_keys = [
97
- -17, 10, 32, 34, 35, 37, 42, 64,
98
- 67, 68, 70, 75, 77, 83, 84, 124,
99
- 9, 13, -69, -65, 10, 32, 34, 35,
100
- 37, 42, 64, 67, 68, 70, 75, 77,
101
- 83, 84, 124, 9, 13, 34, 34, 10,
102
- 13, 10, 13, 10, 32, 34, 9, 13,
103
- 10, 32, 34, 9, 13, 10, 32, 34,
104
- 9, 13, 10, 32, 34, 9, 13, 10,
105
- 32, 9, 13, 10, 32, 9, 13, 10,
106
- 13, 10, 95, 70, 69, 65, 84, 85,
107
- 82, 69, 95, 69, 78, 68, 95, 37,
108
- 32, 10, 13, 10, 13, 13, 32, 64,
109
- 9, 10, 9, 10, 13, 32, 64, 11,
110
- 12, 10, 32, 64, 9, 13, 111, 110,
111
- 116, 111, 104, 58, 10, 10, 10, 32,
112
- 35, 70, 124, 9, 13, 10, 105, 10,
113
- 116, 10, 117, 10, 114, 10, 58, 10,
114
- 32, 34, 35, 37, 42, 64, 67, 68,
115
- 70, 75, 77, 83, 84, 124, 9, 13,
116
- 97, 101, 110, 115, 97, 114, 58, 10,
117
- 10, 10, 32, 35, 37, 42, 64, 68,
118
- 70, 75, 77, 83, 84, 9, 13, 10,
119
- 95, 10, 70, 10, 69, 10, 65, 10,
120
- 84, 10, 85, 10, 82, 10, 69, 10,
121
- 95, 10, 69, 10, 78, 10, 68, 10,
122
- 95, 10, 37, 10, 32, 10, 97, 101,
123
- 10, 110, 10, 110, 10, 103, 10, 97,
124
- 10, 105, 10, 116, 10, 117, 10, 114,
125
- 10, 58, 10, 101, 10, 116, 10, 105,
126
- 10, 107, 10, 97, 10, 97, 10, 107,
127
- 10, 101, 10, 110, 10, 97, 10, 114,
128
- 10, 105, 10, 111, 10, 32, 58, 10,
129
- 107, 10, 111, 10, 110, 10, 115, 10,
130
- 101, 10, 112, 10, 97, 10, 112, 10,
131
- 105, 110, 103, 97, 110, 105, 116, 117,
132
- 114, 58, 10, 10, 10, 32, 35, 37,
133
- 64, 67, 68, 70, 83, 9, 13, 10,
134
- 95, 10, 70, 10, 69, 10, 65, 10,
135
- 84, 10, 85, 10, 82, 10, 69, 10,
136
- 95, 10, 69, 10, 78, 10, 68, 10,
137
- 95, 10, 37, 10, 111, 10, 110, 10,
138
- 116, 10, 111, 10, 104, 10, 58, 10,
139
- 97, 10, 115, 10, 97, 10, 114, 10,
140
- 105, 10, 116, 10, 117, 10, 107, 10,
141
- 101, 10, 110, 10, 97, 10, 114, 10,
142
- 105, 10, 111, 10, 32, 58, 10, 107,
143
- 10, 111, 10, 110, 10, 115, 10, 101,
144
- 10, 112, 101, 116, 105, 107, 97, 97,
145
- 107, 101, 110, 97, 114, 105, 111, 32,
146
- 58, 107, 111, 110, 115, 101, 112, 58,
147
- 10, 10, 10, 32, 35, 37, 42, 64,
148
- 68, 70, 75, 77, 83, 84, 9, 13,
149
- 10, 95, 10, 70, 10, 69, 10, 65,
150
- 10, 84, 10, 85, 10, 82, 10, 69,
151
- 10, 95, 10, 69, 10, 78, 10, 68,
152
- 10, 95, 10, 37, 10, 32, 10, 97,
153
- 101, 10, 110, 10, 110, 10, 103, 10,
154
- 97, 10, 105, 10, 116, 10, 117, 10,
155
- 114, 10, 58, 10, 101, 10, 116, 10,
156
- 105, 10, 107, 10, 97, 10, 97, 10,
157
- 107, 10, 101, 10, 110, 10, 97, 10,
158
- 114, 10, 105, 10, 111, 10, 97, 10,
159
- 112, 10, 105, 10, 10, 10, 32, 35,
160
- 37, 42, 64, 68, 70, 75, 77, 83,
161
- 84, 9, 13, 10, 95, 10, 70, 10,
162
- 69, 10, 65, 10, 84, 10, 85, 10,
163
- 82, 10, 69, 10, 95, 10, 69, 10,
164
- 78, 10, 68, 10, 95, 10, 37, 10,
165
- 32, 10, 97, 101, 10, 110, 115, 10,
166
- 97, 10, 114, 10, 58, 10, 110, 10,
167
- 103, 10, 97, 10, 110, 10, 105, 10,
168
- 116, 10, 117, 10, 101, 10, 116, 10,
169
- 105, 10, 107, 10, 97, 10, 97, 10,
170
- 107, 10, 101, 10, 110, 10, 97, 10,
171
- 114, 10, 105, 10, 111, 10, 32, 58,
172
- 10, 107, 10, 111, 10, 110, 10, 115,
173
- 10, 101, 10, 112, 10, 97, 10, 112,
174
- 10, 105, 97, 112, 105, 32, 124, 9,
175
- 13, 10, 32, 92, 124, 9, 13, 10,
176
- 92, 124, 10, 92, 10, 32, 92, 124,
177
- 9, 13, 10, 32, 34, 35, 37, 42,
178
- 64, 67, 68, 70, 75, 77, 83, 84,
179
- 124, 9, 13, 0
180
- ]
181
-
182
- class << self
183
- attr_accessor :_lexer_single_lengths
184
- private :_lexer_single_lengths, :_lexer_single_lengths=
185
- end
186
- self._lexer_single_lengths = [
187
- 0, 16, 1, 1, 15, 1, 1, 2,
188
- 2, 3, 3, 3, 3, 2, 2, 2,
189
- 1, 1, 1, 1, 1, 1, 1, 1,
190
- 1, 1, 1, 1, 1, 1, 1, 1,
191
- 2, 2, 3, 5, 3, 1, 1, 1,
192
- 1, 1, 1, 1, 1, 5, 2, 2,
193
- 2, 2, 2, 15, 2, 2, 1, 1,
194
- 1, 1, 1, 12, 2, 2, 2, 2,
195
- 2, 2, 2, 2, 2, 2, 2, 2,
196
- 2, 2, 2, 3, 2, 2, 2, 2,
197
- 2, 2, 2, 2, 2, 2, 2, 2,
198
- 2, 2, 2, 2, 2, 2, 2, 2,
199
- 2, 2, 3, 2, 2, 2, 2, 2,
200
- 2, 2, 2, 2, 1, 1, 1, 1,
201
- 1, 1, 1, 1, 1, 1, 1, 9,
202
- 2, 2, 2, 2, 2, 2, 2, 2,
203
- 2, 2, 2, 2, 2, 2, 2, 2,
204
- 2, 2, 2, 2, 2, 2, 2, 2,
205
- 2, 2, 2, 2, 2, 2, 2, 2,
206
- 2, 2, 3, 2, 2, 2, 2, 2,
207
- 2, 1, 1, 1, 1, 1, 1, 1,
208
- 1, 1, 1, 1, 1, 1, 2, 1,
209
- 1, 1, 1, 1, 1, 1, 1, 1,
210
- 12, 2, 2, 2, 2, 2, 2, 2,
211
- 2, 2, 2, 2, 2, 2, 2, 2,
212
- 3, 2, 2, 2, 2, 2, 2, 2,
213
- 2, 2, 2, 2, 2, 2, 2, 2,
214
- 2, 2, 2, 2, 2, 2, 2, 2,
215
- 2, 2, 1, 1, 12, 2, 2, 2,
216
- 2, 2, 2, 2, 2, 2, 2, 2,
217
- 2, 2, 2, 2, 3, 3, 2, 2,
218
- 2, 2, 2, 2, 2, 2, 2, 2,
219
- 2, 2, 2, 2, 2, 2, 2, 2,
220
- 2, 2, 2, 2, 2, 3, 2, 2,
221
- 2, 2, 2, 2, 2, 2, 2, 1,
222
- 1, 1, 2, 4, 3, 2, 4, 15,
223
- 0
224
- ]
225
-
226
- class << self
227
- attr_accessor :_lexer_range_lengths
228
- private :_lexer_range_lengths, :_lexer_range_lengths=
229
- end
230
- self._lexer_range_lengths = [
231
- 0, 1, 0, 0, 1, 0, 0, 0,
232
- 0, 1, 1, 1, 1, 1, 1, 0,
233
- 0, 0, 0, 0, 0, 0, 0, 0,
234
- 0, 0, 0, 0, 0, 0, 0, 0,
235
- 0, 0, 1, 1, 1, 0, 0, 0,
236
- 0, 0, 0, 0, 0, 1, 0, 0,
237
- 0, 0, 0, 1, 0, 0, 0, 0,
238
- 0, 0, 0, 1, 0, 0, 0, 0,
239
- 0, 0, 0, 0, 0, 0, 0, 0,
240
- 0, 0, 0, 0, 0, 0, 0, 0,
241
- 0, 0, 0, 0, 0, 0, 0, 0,
242
- 0, 0, 0, 0, 0, 0, 0, 0,
243
- 0, 0, 0, 0, 0, 0, 0, 0,
244
- 0, 0, 0, 0, 0, 0, 0, 0,
245
- 0, 0, 0, 0, 0, 0, 0, 1,
246
- 0, 0, 0, 0, 0, 0, 0, 0,
247
- 0, 0, 0, 0, 0, 0, 0, 0,
248
- 0, 0, 0, 0, 0, 0, 0, 0,
249
- 0, 0, 0, 0, 0, 0, 0, 0,
250
- 0, 0, 0, 0, 0, 0, 0, 0,
251
- 0, 0, 0, 0, 0, 0, 0, 0,
252
- 0, 0, 0, 0, 0, 0, 0, 0,
253
- 0, 0, 0, 0, 0, 0, 0, 0,
254
- 1, 0, 0, 0, 0, 0, 0, 0,
255
- 0, 0, 0, 0, 0, 0, 0, 0,
256
- 0, 0, 0, 0, 0, 0, 0, 0,
257
- 0, 0, 0, 0, 0, 0, 0, 0,
258
- 0, 0, 0, 0, 0, 0, 0, 0,
259
- 0, 0, 0, 0, 1, 0, 0, 0,
260
- 0, 0, 0, 0, 0, 0, 0, 0,
261
- 0, 0, 0, 0, 0, 0, 0, 0,
262
- 0, 0, 0, 0, 0, 0, 0, 0,
263
- 0, 0, 0, 0, 0, 0, 0, 0,
264
- 0, 0, 0, 0, 0, 0, 0, 0,
265
- 0, 0, 0, 0, 0, 0, 0, 0,
266
- 0, 0, 1, 1, 0, 0, 1, 1,
267
- 0
268
- ]
269
-
270
- class << self
271
- attr_accessor :_lexer_index_offsets
272
- private :_lexer_index_offsets, :_lexer_index_offsets=
273
- end
274
- self._lexer_index_offsets = [
275
- 0, 0, 18, 20, 22, 39, 41, 43,
276
- 46, 49, 54, 59, 64, 69, 73, 77,
277
- 80, 82, 84, 86, 88, 90, 92, 94,
278
- 96, 98, 100, 102, 104, 106, 108, 110,
279
- 112, 115, 118, 123, 130, 135, 137, 139,
280
- 141, 143, 145, 147, 149, 151, 158, 161,
281
- 164, 167, 170, 173, 190, 193, 196, 198,
282
- 200, 202, 204, 206, 220, 223, 226, 229,
283
- 232, 235, 238, 241, 244, 247, 250, 253,
284
- 256, 259, 262, 265, 269, 272, 275, 278,
285
- 281, 284, 287, 290, 293, 296, 299, 302,
286
- 305, 308, 311, 314, 317, 320, 323, 326,
287
- 329, 332, 335, 339, 342, 345, 348, 351,
288
- 354, 357, 360, 363, 366, 368, 370, 372,
289
- 374, 376, 378, 380, 382, 384, 386, 388,
290
- 399, 402, 405, 408, 411, 414, 417, 420,
291
- 423, 426, 429, 432, 435, 438, 441, 444,
292
- 447, 450, 453, 456, 459, 462, 465, 468,
293
- 471, 474, 477, 480, 483, 486, 489, 492,
294
- 495, 498, 501, 505, 508, 511, 514, 517,
295
- 520, 523, 525, 527, 529, 531, 533, 535,
296
- 537, 539, 541, 543, 545, 547, 549, 552,
297
- 554, 556, 558, 560, 562, 564, 566, 568,
298
- 570, 584, 587, 590, 593, 596, 599, 602,
299
- 605, 608, 611, 614, 617, 620, 623, 626,
300
- 629, 633, 636, 639, 642, 645, 648, 651,
301
- 654, 657, 660, 663, 666, 669, 672, 675,
302
- 678, 681, 684, 687, 690, 693, 696, 699,
303
- 702, 705, 708, 710, 712, 726, 729, 732,
304
- 735, 738, 741, 744, 747, 750, 753, 756,
305
- 759, 762, 765, 768, 771, 775, 779, 782,
306
- 785, 788, 791, 794, 797, 800, 803, 806,
307
- 809, 812, 815, 818, 821, 824, 827, 830,
308
- 833, 836, 839, 842, 845, 848, 852, 855,
309
- 858, 861, 864, 867, 870, 873, 876, 879,
310
- 881, 883, 885, 889, 895, 899, 902, 908,
311
- 925
312
- ]
313
-
314
- class << self
315
- attr_accessor :_lexer_indicies
316
- private :_lexer_indicies, :_lexer_indicies=
317
- end
318
- self._lexer_indicies = [
319
- 1, 3, 2, 4, 5, 6, 7, 8,
320
- 9, 10, 11, 12, 13, 14, 15, 16,
321
- 2, 0, 17, 0, 2, 0, 3, 2,
322
- 4, 5, 6, 7, 8, 9, 10, 11,
323
- 12, 13, 14, 15, 16, 2, 0, 18,
324
- 0, 19, 0, 21, 22, 20, 24, 25,
325
- 23, 28, 27, 29, 27, 26, 32, 31,
326
- 33, 31, 30, 32, 31, 34, 31, 30,
327
- 32, 31, 35, 31, 30, 37, 36, 36,
328
- 0, 3, 38, 38, 0, 40, 41, 39,
329
- 3, 0, 42, 0, 43, 0, 44, 0,
330
- 45, 0, 46, 0, 47, 0, 48, 0,
331
- 49, 0, 50, 0, 51, 0, 52, 0,
332
- 53, 0, 54, 0, 55, 0, 56, 0,
333
- 58, 59, 57, 61, 62, 60, 0, 0,
334
- 0, 0, 63, 64, 65, 64, 64, 67,
335
- 66, 63, 3, 68, 8, 68, 0, 69,
336
- 0, 70, 0, 71, 0, 72, 0, 73,
337
- 0, 74, 0, 76, 75, 78, 77, 78,
338
- 79, 80, 81, 80, 79, 77, 78, 82,
339
- 77, 78, 83, 77, 78, 84, 77, 78,
340
- 85, 77, 78, 86, 77, 88, 87, 89,
341
- 90, 91, 92, 93, 94, 95, 96, 97,
342
- 98, 99, 100, 101, 87, 0, 102, 103,
343
- 0, 104, 105, 0, 106, 0, 107, 0,
344
- 108, 0, 110, 109, 112, 111, 112, 113,
345
- 114, 115, 116, 114, 117, 118, 119, 120,
346
- 121, 122, 113, 111, 112, 123, 111, 112,
347
- 124, 111, 112, 125, 111, 112, 126, 111,
348
- 112, 127, 111, 112, 128, 111, 112, 129,
349
- 111, 112, 130, 111, 112, 131, 111, 112,
350
- 132, 111, 112, 133, 111, 112, 134, 111,
351
- 112, 135, 111, 112, 136, 111, 112, 137,
352
- 111, 112, 138, 139, 111, 112, 140, 111,
353
- 112, 141, 111, 112, 142, 111, 112, 138,
354
- 111, 112, 143, 111, 112, 144, 111, 112,
355
- 145, 111, 112, 146, 111, 112, 137, 111,
356
- 112, 147, 111, 112, 148, 111, 112, 149,
357
- 111, 112, 150, 111, 112, 140, 111, 112,
358
- 149, 111, 112, 151, 111, 112, 152, 111,
359
- 112, 153, 111, 112, 154, 111, 112, 155,
360
- 111, 112, 156, 111, 112, 157, 111, 112,
361
- 158, 137, 111, 112, 159, 111, 112, 160,
362
- 111, 112, 161, 111, 112, 162, 111, 112,
363
- 163, 111, 112, 146, 111, 112, 164, 111,
364
- 112, 165, 111, 112, 140, 111, 166, 0,
365
- 167, 0, 168, 0, 104, 0, 169, 0,
366
- 170, 0, 171, 0, 172, 0, 173, 0,
367
- 175, 174, 177, 176, 177, 178, 179, 180,
368
- 179, 181, 182, 183, 184, 178, 176, 177,
369
- 185, 176, 177, 186, 176, 177, 187, 176,
370
- 177, 188, 176, 177, 189, 176, 177, 190,
371
- 176, 177, 191, 176, 177, 192, 176, 177,
372
- 193, 176, 177, 194, 176, 177, 195, 176,
373
- 177, 196, 176, 177, 197, 176, 177, 198,
374
- 176, 177, 199, 176, 177, 200, 176, 177,
375
- 201, 176, 177, 202, 176, 177, 203, 176,
376
- 177, 204, 176, 177, 205, 176, 177, 206,
377
- 176, 177, 207, 176, 177, 203, 176, 177,
378
- 208, 176, 177, 209, 176, 177, 207, 176,
379
- 177, 210, 176, 177, 211, 176, 177, 212,
380
- 176, 177, 213, 176, 177, 214, 176, 177,
381
- 215, 176, 177, 216, 176, 177, 217, 204,
382
- 176, 177, 218, 176, 177, 219, 176, 177,
383
- 220, 176, 177, 221, 176, 177, 222, 176,
384
- 177, 203, 176, 223, 0, 224, 0, 225,
385
- 0, 226, 0, 104, 0, 225, 0, 227,
386
- 0, 228, 0, 229, 0, 230, 0, 231,
387
- 0, 232, 0, 233, 0, 234, 235, 0,
388
- 236, 0, 237, 0, 238, 0, 239, 0,
389
- 240, 0, 241, 0, 242, 0, 244, 243,
390
- 246, 245, 246, 247, 248, 249, 250, 248,
391
- 251, 252, 253, 254, 255, 256, 247, 245,
392
- 246, 257, 245, 246, 258, 245, 246, 259,
393
- 245, 246, 260, 245, 246, 261, 245, 246,
394
- 262, 245, 246, 263, 245, 246, 264, 245,
395
- 246, 265, 245, 246, 266, 245, 246, 267,
396
- 245, 246, 268, 245, 246, 269, 245, 246,
397
- 270, 245, 246, 271, 245, 246, 272, 273,
398
- 245, 246, 274, 245, 246, 275, 245, 246,
399
- 276, 245, 246, 272, 245, 246, 277, 245,
400
- 246, 278, 245, 246, 279, 245, 246, 280,
401
- 245, 246, 271, 245, 246, 281, 245, 246,
402
- 282, 245, 246, 283, 245, 246, 284, 245,
403
- 246, 274, 245, 246, 283, 245, 246, 285,
404
- 245, 246, 286, 245, 246, 287, 245, 246,
405
- 288, 245, 246, 289, 245, 246, 290, 245,
406
- 246, 280, 245, 246, 291, 245, 246, 292,
407
- 245, 246, 274, 245, 294, 293, 296, 295,
408
- 296, 297, 298, 299, 300, 298, 301, 302,
409
- 303, 304, 305, 306, 297, 295, 296, 307,
410
- 295, 296, 308, 295, 296, 309, 295, 296,
411
- 310, 295, 296, 311, 295, 296, 312, 295,
412
- 296, 313, 295, 296, 314, 295, 296, 315,
413
- 295, 296, 316, 295, 296, 317, 295, 296,
414
- 318, 295, 296, 319, 295, 296, 320, 295,
415
- 296, 321, 295, 296, 322, 323, 295, 296,
416
- 324, 325, 295, 296, 326, 295, 296, 327,
417
- 295, 296, 321, 295, 296, 328, 295, 296,
418
- 329, 295, 296, 330, 295, 296, 324, 295,
419
- 296, 331, 295, 296, 332, 295, 296, 326,
420
- 295, 296, 333, 295, 296, 334, 295, 296,
421
- 335, 295, 296, 336, 295, 296, 324, 295,
422
- 296, 335, 295, 296, 337, 295, 296, 338,
423
- 295, 296, 339, 295, 296, 340, 295, 296,
424
- 341, 295, 296, 342, 295, 296, 343, 295,
425
- 296, 344, 321, 295, 296, 345, 295, 296,
426
- 346, 295, 296, 347, 295, 296, 348, 295,
427
- 296, 349, 295, 296, 327, 295, 296, 350,
428
- 295, 296, 351, 295, 296, 324, 295, 352,
429
- 0, 353, 0, 104, 0, 354, 355, 354,
430
- 0, 358, 357, 359, 360, 357, 356, 0,
431
- 362, 363, 361, 0, 362, 361, 358, 364,
432
- 362, 363, 364, 361, 358, 365, 366, 367,
433
- 368, 369, 370, 371, 372, 373, 374, 375,
434
- 376, 377, 378, 365, 0, 379, 0
435
- ]
436
-
437
- class << self
438
- attr_accessor :_lexer_trans_targs
439
- private :_lexer_trans_targs, :_lexer_trans_targs=
440
- end
441
- self._lexer_trans_targs = [
442
- 0, 2, 4, 4, 5, 15, 17, 31,
443
- 34, 37, 52, 112, 161, 166, 167, 279,
444
- 282, 3, 6, 7, 8, 9, 8, 8,
445
- 9, 8, 10, 10, 10, 11, 10, 10,
446
- 10, 11, 12, 13, 14, 4, 14, 15,
447
- 4, 16, 18, 19, 20, 21, 22, 23,
448
- 24, 25, 26, 27, 28, 29, 30, 288,
449
- 32, 33, 4, 16, 33, 4, 16, 35,
450
- 36, 4, 35, 34, 36, 38, 39, 40,
451
- 41, 42, 43, 44, 45, 44, 45, 45,
452
- 4, 46, 47, 48, 49, 50, 51, 4,
453
- 4, 5, 15, 17, 31, 34, 37, 52,
454
- 112, 161, 166, 167, 279, 282, 53, 108,
455
- 31, 54, 55, 56, 57, 58, 59, 58,
456
- 59, 59, 4, 60, 74, 75, 80, 85,
457
- 90, 91, 105, 61, 62, 63, 64, 65,
458
- 66, 67, 68, 69, 70, 71, 72, 73,
459
- 4, 51, 76, 77, 74, 78, 79, 81,
460
- 82, 83, 84, 86, 87, 88, 89, 92,
461
- 93, 94, 95, 96, 97, 98, 99, 100,
462
- 101, 102, 103, 104, 106, 107, 109, 110,
463
- 111, 113, 114, 115, 116, 117, 118, 119,
464
- 118, 119, 119, 4, 120, 134, 140, 144,
465
- 147, 121, 122, 123, 124, 125, 126, 127,
466
- 128, 129, 130, 131, 132, 133, 4, 135,
467
- 136, 137, 138, 139, 51, 141, 142, 143,
468
- 145, 146, 148, 149, 150, 151, 152, 153,
469
- 154, 155, 156, 157, 158, 159, 160, 162,
470
- 163, 164, 165, 168, 169, 170, 171, 172,
471
- 173, 174, 175, 226, 176, 177, 178, 179,
472
- 180, 181, 182, 183, 184, 183, 184, 184,
473
- 4, 185, 199, 200, 205, 210, 215, 216,
474
- 223, 186, 187, 188, 189, 190, 191, 192,
475
- 193, 194, 195, 196, 197, 198, 4, 51,
476
- 201, 202, 199, 203, 204, 206, 207, 208,
477
- 209, 211, 212, 213, 214, 217, 218, 219,
478
- 220, 221, 222, 224, 225, 227, 228, 227,
479
- 228, 228, 4, 229, 243, 244, 253, 256,
480
- 261, 262, 276, 230, 231, 232, 233, 234,
481
- 235, 236, 237, 238, 239, 240, 241, 242,
482
- 4, 51, 245, 249, 243, 246, 247, 248,
483
- 250, 251, 252, 254, 255, 257, 258, 259,
484
- 260, 263, 264, 265, 266, 267, 268, 269,
485
- 270, 271, 272, 273, 274, 275, 277, 278,
486
- 280, 281, 282, 283, 284, 286, 287, 285,
487
- 283, 284, 285, 283, 286, 287, 5, 15,
488
- 17, 31, 34, 37, 52, 112, 161, 166,
489
- 167, 279, 282, 0
490
- ]
491
-
492
- class << self
493
- attr_accessor :_lexer_trans_actions
494
- private :_lexer_trans_actions, :_lexer_trans_actions=
495
- end
496
- self._lexer_trans_actions = [
497
- 43, 0, 0, 54, 3, 1, 0, 29,
498
- 1, 29, 29, 29, 29, 29, 29, 29,
499
- 35, 0, 0, 0, 7, 139, 48, 0,
500
- 102, 9, 5, 45, 134, 45, 0, 33,
501
- 122, 33, 33, 0, 11, 106, 0, 0,
502
- 114, 25, 0, 0, 0, 0, 0, 0,
503
- 0, 0, 0, 0, 0, 0, 0, 0,
504
- 0, 57, 149, 126, 0, 110, 23, 0,
505
- 27, 118, 27, 51, 0, 0, 0, 0,
506
- 0, 0, 0, 57, 144, 0, 54, 0,
507
- 81, 84, 0, 0, 0, 0, 21, 31,
508
- 130, 60, 57, 31, 63, 57, 63, 63,
509
- 63, 63, 63, 63, 63, 66, 0, 0,
510
- 0, 0, 0, 0, 0, 57, 144, 0,
511
- 54, 0, 72, 33, 84, 84, 84, 84,
512
- 84, 84, 84, 0, 0, 0, 0, 0,
513
- 0, 0, 0, 0, 0, 0, 0, 0,
514
- 15, 15, 0, 0, 0, 0, 0, 0,
515
- 0, 0, 0, 0, 0, 0, 0, 0,
516
- 0, 0, 0, 0, 0, 0, 0, 0,
517
- 0, 0, 0, 0, 0, 0, 0, 0,
518
- 0, 0, 0, 0, 0, 0, 57, 144,
519
- 0, 54, 0, 69, 33, 84, 84, 84,
520
- 84, 0, 0, 0, 0, 0, 0, 0,
521
- 0, 0, 0, 0, 0, 0, 13, 0,
522
- 0, 0, 0, 0, 13, 0, 0, 0,
523
- 0, 0, 0, 0, 0, 0, 0, 0,
524
- 0, 0, 0, 0, 0, 0, 0, 0,
525
- 0, 0, 0, 0, 0, 0, 0, 0,
526
- 0, 0, 0, 0, 0, 0, 0, 0,
527
- 0, 0, 0, 57, 144, 0, 54, 0,
528
- 78, 33, 84, 84, 84, 84, 84, 84,
529
- 84, 0, 0, 0, 0, 0, 0, 0,
530
- 0, 0, 0, 0, 0, 0, 19, 19,
531
- 0, 0, 0, 0, 0, 0, 0, 0,
532
- 0, 0, 0, 0, 0, 0, 0, 0,
533
- 0, 0, 0, 0, 0, 57, 144, 0,
534
- 54, 0, 75, 33, 84, 84, 84, 84,
535
- 84, 84, 84, 0, 0, 0, 0, 0,
536
- 0, 0, 0, 0, 0, 0, 0, 0,
537
- 17, 17, 0, 0, 0, 0, 0, 0,
538
- 0, 0, 0, 0, 0, 0, 0, 0,
539
- 0, 0, 0, 0, 0, 0, 0, 0,
540
- 0, 0, 0, 0, 0, 0, 0, 0,
541
- 0, 0, 0, 0, 37, 37, 54, 37,
542
- 87, 0, 0, 39, 0, 0, 93, 90,
543
- 41, 96, 90, 96, 96, 96, 96, 96,
544
- 96, 96, 99, 0
545
- ]
546
-
547
- class << self
548
- attr_accessor :_lexer_eof_actions
549
- private :_lexer_eof_actions, :_lexer_eof_actions=
550
- end
551
- self._lexer_eof_actions = [
552
- 0, 43, 43, 43, 43, 43, 43, 43,
553
- 43, 43, 43, 43, 43, 43, 43, 43,
554
- 43, 43, 43, 43, 43, 43, 43, 43,
555
- 43, 43, 43, 43, 43, 43, 43, 43,
556
- 43, 43, 43, 43, 43, 43, 43, 43,
557
- 43, 43, 43, 43, 43, 43, 43, 43,
558
- 43, 43, 43, 43, 43, 43, 43, 43,
559
- 43, 43, 43, 43, 43, 43, 43, 43,
560
- 43, 43, 43, 43, 43, 43, 43, 43,
561
- 43, 43, 43, 43, 43, 43, 43, 43,
562
- 43, 43, 43, 43, 43, 43, 43, 43,
563
- 43, 43, 43, 43, 43, 43, 43, 43,
564
- 43, 43, 43, 43, 43, 43, 43, 43,
565
- 43, 43, 43, 43, 43, 43, 43, 43,
566
- 43, 43, 43, 43, 43, 43, 43, 43,
567
- 43, 43, 43, 43, 43, 43, 43, 43,
568
- 43, 43, 43, 43, 43, 43, 43, 43,
569
- 43, 43, 43, 43, 43, 43, 43, 43,
570
- 43, 43, 43, 43, 43, 43, 43, 43,
571
- 43, 43, 43, 43, 43, 43, 43, 43,
572
- 43, 43, 43, 43, 43, 43, 43, 43,
573
- 43, 43, 43, 43, 43, 43, 43, 43,
574
- 43, 43, 43, 43, 43, 43, 43, 43,
575
- 43, 43, 43, 43, 43, 43, 43, 43,
576
- 43, 43, 43, 43, 43, 43, 43, 43,
577
- 43, 43, 43, 43, 43, 43, 43, 43,
578
- 43, 43, 43, 43, 43, 43, 43, 43,
579
- 43, 43, 43, 43, 43, 43, 43, 43,
580
- 43, 43, 43, 43, 43, 43, 43, 43,
581
- 43, 43, 43, 43, 43, 43, 43, 43,
582
- 43, 43, 43, 43, 43, 43, 43, 43,
583
- 43, 43, 43, 43, 43, 43, 43, 43,
584
- 43, 43, 43, 43, 43, 43, 43, 43,
585
- 43, 43, 43, 43, 43, 43, 43, 43,
586
- 43, 43, 43, 43, 43, 43, 43, 43,
587
- 43, 43, 43, 43, 43, 43, 43, 43,
588
- 43
589
- ]
590
-
591
- class << self
592
- attr_accessor :lexer_start
593
- end
594
- self.lexer_start = 1;
595
- class << self
596
- attr_accessor :lexer_first_final
597
- end
598
- self.lexer_first_final = 288;
599
- class << self
600
- attr_accessor :lexer_error
601
- end
602
- self.lexer_error = 0;
603
-
604
- class << self
605
- attr_accessor :lexer_en_main
606
- end
607
- self.lexer_en_main = 1;
608
-
609
-
610
- # line 133 "ragel/i18n/id.rb.rl"
611
- end
612
-
613
- def scan(data)
614
- data = (data + "\n%_FEATURE_END_%").unpack("c*") # Explicit EOF simplifies things considerably
615
- eof = pe = data.length
616
-
617
- @line_number = 1
618
- @last_newline = 0
619
-
620
-
621
- # line 622 "lib/gherkin/lexer/id.rb"
622
- begin
623
- p ||= 0
624
- pe ||= data.length
625
- cs = lexer_start
626
- end
627
-
628
- # line 143 "ragel/i18n/id.rb.rl"
629
-
630
- # line 631 "lib/gherkin/lexer/id.rb"
631
- begin
632
- _klen, _trans, _keys, _acts, _nacts = nil
633
- _goto_level = 0
634
- _resume = 10
635
- _eof_trans = 15
636
- _again = 20
637
- _test_eof = 30
638
- _out = 40
639
- while true
640
- _trigger_goto = false
641
- if _goto_level <= 0
642
- if p == pe
643
- _goto_level = _test_eof
644
- next
645
- end
646
- if cs == 0
647
- _goto_level = _out
648
- next
649
- end
650
- end
651
- if _goto_level <= _resume
652
- _keys = _lexer_key_offsets[cs]
653
- _trans = _lexer_index_offsets[cs]
654
- _klen = _lexer_single_lengths[cs]
655
- _break_match = false
656
-
657
- begin
658
- if _klen > 0
659
- _lower = _keys
660
- _upper = _keys + _klen - 1
661
-
662
- loop do
663
- break if _upper < _lower
664
- _mid = _lower + ( (_upper - _lower) >> 1 )
665
-
666
- if data[p].ord < _lexer_trans_keys[_mid]
667
- _upper = _mid - 1
668
- elsif data[p].ord > _lexer_trans_keys[_mid]
669
- _lower = _mid + 1
670
- else
671
- _trans += (_mid - _keys)
672
- _break_match = true
673
- break
674
- end
675
- end # loop
676
- break if _break_match
677
- _keys += _klen
678
- _trans += _klen
679
- end
680
- _klen = _lexer_range_lengths[cs]
681
- if _klen > 0
682
- _lower = _keys
683
- _upper = _keys + (_klen << 1) - 2
684
- loop do
685
- break if _upper < _lower
686
- _mid = _lower + (((_upper-_lower) >> 1) & ~1)
687
- if data[p].ord < _lexer_trans_keys[_mid]
688
- _upper = _mid - 2
689
- elsif data[p].ord > _lexer_trans_keys[_mid+1]
690
- _lower = _mid + 2
691
- else
692
- _trans += ((_mid - _keys) >> 1)
693
- _break_match = true
694
- break
695
- end
696
- end # loop
697
- break if _break_match
698
- _trans += _klen
699
- end
700
- end while false
701
- _trans = _lexer_indicies[_trans]
702
- cs = _lexer_trans_targs[_trans]
703
- if _lexer_trans_actions[_trans] != 0
704
- _acts = _lexer_trans_actions[_trans]
705
- _nacts = _lexer_actions[_acts]
706
- _acts += 1
707
- while _nacts > 0
708
- _nacts -= 1
709
- _acts += 1
710
- case _lexer_actions[_acts - 1]
711
- when 0 then
712
- # line 11 "ragel/i18n/id.rb.rl"
713
- begin
714
-
715
- @content_start = p
716
- @current_line = @line_number
717
- @start_col = p - @last_newline - "#{@keyword}:".length
718
- end
719
- when 1 then
720
- # line 17 "ragel/i18n/id.rb.rl"
721
- begin
722
-
723
- @current_line = @line_number
724
- @start_col = p - @last_newline
725
- end
726
- when 2 then
727
- # line 22 "ragel/i18n/id.rb.rl"
728
- begin
729
-
730
- @content_start = p
731
- end
732
- when 3 then
733
- # line 26 "ragel/i18n/id.rb.rl"
734
- begin
735
-
736
- @docstring_content_type_start = p
737
- end
738
- when 4 then
739
- # line 29 "ragel/i18n/id.rb.rl"
740
- begin
741
-
742
- @docstring_content_type_end = p
743
- end
744
- when 5 then
745
- # line 33 "ragel/i18n/id.rb.rl"
746
- begin
747
-
748
- con = unindent(@start_col, utf8_pack(data[@content_start...@next_keyword_start-1]).sub(/(\r?\n)?([\t ])*\Z/, '').gsub(/\\"\\"\\"/, '"""'))
749
- con_type = utf8_pack(data[@docstring_content_type_start...@docstring_content_type_end]).strip
750
- @listener.doc_string(con_type, con, @current_line)
751
- end
752
- when 6 then
753
- # line 38 "ragel/i18n/id.rb.rl"
754
- begin
755
-
756
- p = store_keyword_content(:feature, data, p, eof)
757
- end
758
- when 7 then
759
- # line 42 "ragel/i18n/id.rb.rl"
760
- begin
761
-
762
- p = store_keyword_content(:background, data, p, eof)
763
- end
764
- when 8 then
765
- # line 46 "ragel/i18n/id.rb.rl"
766
- begin
767
-
768
- p = store_keyword_content(:scenario, data, p, eof)
769
- end
770
- when 9 then
771
- # line 50 "ragel/i18n/id.rb.rl"
772
- begin
773
-
774
- p = store_keyword_content(:scenario_outline, data, p, eof)
775
- end
776
- when 10 then
777
- # line 54 "ragel/i18n/id.rb.rl"
778
- begin
779
-
780
- p = store_keyword_content(:examples, data, p, eof)
781
- end
782
- when 11 then
783
- # line 58 "ragel/i18n/id.rb.rl"
784
- begin
785
-
786
- con = utf8_pack(data[@content_start...p]).strip
787
- @listener.step(@keyword, con, @current_line)
788
- end
789
- when 12 then
790
- # line 63 "ragel/i18n/id.rb.rl"
791
- begin
792
-
793
- con = utf8_pack(data[@content_start...p]).strip
794
- @listener.comment(con, @line_number)
795
- @keyword_start = nil
796
- end
797
- when 13 then
798
- # line 69 "ragel/i18n/id.rb.rl"
799
- begin
800
-
801
- con = utf8_pack(data[@content_start...p]).strip
802
- @listener.tag(con, @current_line)
803
- @keyword_start = nil
804
- end
805
- when 14 then
806
- # line 75 "ragel/i18n/id.rb.rl"
807
- begin
808
-
809
- @line_number += 1
810
- end
811
- when 15 then
812
- # line 79 "ragel/i18n/id.rb.rl"
813
- begin
814
-
815
- @last_newline = p + 1
816
- end
817
- when 16 then
818
- # line 83 "ragel/i18n/id.rb.rl"
819
- begin
820
-
821
- @keyword_start ||= p
822
- end
823
- when 17 then
824
- # line 87 "ragel/i18n/id.rb.rl"
825
- begin
826
-
827
- @keyword = utf8_pack(data[@keyword_start...p]).sub(/:$/,'')
828
- @keyword_start = nil
829
- end
830
- when 18 then
831
- # line 92 "ragel/i18n/id.rb.rl"
832
- begin
833
-
834
- @next_keyword_start = p
835
- end
836
- when 19 then
837
- # line 96 "ragel/i18n/id.rb.rl"
838
- begin
839
-
840
- p = p - 1
841
- current_row = []
842
- @current_line = @line_number
843
- end
844
- when 20 then
845
- # line 102 "ragel/i18n/id.rb.rl"
846
- begin
847
-
848
- @content_start = p
849
- end
850
- when 21 then
851
- # line 106 "ragel/i18n/id.rb.rl"
852
- begin
853
-
854
- con = utf8_pack(data[@content_start...p]).strip
855
- current_row << con.gsub(/\\\|/, "|").gsub(/\\n/, "\n").gsub(/\\\\/, "\\")
856
- end
857
- when 22 then
858
- # line 111 "ragel/i18n/id.rb.rl"
859
- begin
860
-
861
- @listener.row(current_row, @current_line)
862
- end
863
- when 23 then
864
- # line 115 "ragel/i18n/id.rb.rl"
865
- begin
866
-
867
- if cs < lexer_first_final
868
- content = current_line_content(data, p)
869
- raise Gherkin::Lexer::LexingError.new("Lexing error on line %d: '%s'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information." % [@line_number, content])
870
- else
871
- @listener.eof
872
- end
873
- end
874
- # line 875 "lib/gherkin/lexer/id.rb"
875
- end # action switch
876
- end
877
- end
878
- if _trigger_goto
879
- next
880
- end
881
- end
882
- if _goto_level <= _again
883
- if cs == 0
884
- _goto_level = _out
885
- next
886
- end
887
- p += 1
888
- if p != pe
889
- _goto_level = _resume
890
- next
891
- end
892
- end
893
- if _goto_level <= _test_eof
894
- if p == eof
895
- __acts = _lexer_eof_actions[cs]
896
- __nacts = _lexer_actions[__acts]
897
- __acts += 1
898
- while __nacts > 0
899
- __nacts -= 1
900
- __acts += 1
901
- case _lexer_actions[__acts - 1]
902
- when 23 then
903
- # line 115 "ragel/i18n/id.rb.rl"
904
- begin
905
-
906
- if cs < lexer_first_final
907
- content = current_line_content(data, p)
908
- raise Gherkin::Lexer::LexingError.new("Lexing error on line %d: '%s'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information." % [@line_number, content])
909
- else
910
- @listener.eof
911
- end
912
- end
913
- # line 914 "lib/gherkin/lexer/id.rb"
914
- end # eof action switch
915
- end
916
- if _trigger_goto
917
- next
918
- end
919
- end
920
- end
921
- if _goto_level <= _out
922
- break
923
- end
924
- end
925
- end
926
-
927
- # line 144 "ragel/i18n/id.rb.rl"
928
- end
929
-
930
- def unindent(startcol, text)
931
- text.gsub(/^[\t ]{0,#{startcol}}/, "")
932
- end
933
-
934
- def store_keyword_content(event, data, p, eof)
935
- end_point = (!@next_keyword_start or (p == eof)) ? p : @next_keyword_start
936
- content = unindent(@start_col + 2, utf8_pack(data[@content_start...end_point])).rstrip
937
- content_lines = content.split("\n")
938
- name = content_lines.shift || ""
939
- name.strip!
940
- description = content_lines.join("\n")
941
- @listener.__send__(event, @keyword, name, description, @current_line)
942
- @next_keyword_start ? @next_keyword_start - 1 : p
943
- ensure
944
- @next_keyword_start = nil
945
- end
946
-
947
- def current_line_content(data, p)
948
- rest = data[@last_newline..-1]
949
- utf8_pack(rest[0..rest.index(10)||-1]).strip # 10 is \n
950
- end
951
-
952
- if (RUBY_VERSION =~ /^1\.9|2\.0/)
953
- def utf8_pack(array)
954
- array.pack("c*").force_encoding("UTF-8")
955
- end
956
- else
957
- def utf8_pack(array)
958
- array.pack("c*")
959
- end
960
- end
961
- end
962
- end
963
- end