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