gherkin 2.12.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (333) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -15
  3. data/CONTRIBUTING.md +23 -0
  4. data/Gemfile +0 -3
  5. data/LICENSE +18 -17
  6. data/Makefile +65 -0
  7. data/README.md +9 -268
  8. data/Rakefile +17 -19
  9. data/bin/gherkin-generate-ast +21 -0
  10. data/bin/gherkin-generate-pickles +25 -0
  11. data/bin/gherkin-generate-tokens +12 -0
  12. data/gherkin-ruby.razor +218 -0
  13. data/gherkin.gemspec +22 -76
  14. data/lib/gherkin/ast_builder.rb +243 -0
  15. data/lib/gherkin/ast_node.rb +30 -0
  16. data/lib/gherkin/dialect.rb +58 -0
  17. data/lib/gherkin/errors.rb +45 -0
  18. data/lib/gherkin/gherkin-languages.json +2968 -0
  19. data/lib/gherkin/gherkin_line.rb +95 -0
  20. data/lib/gherkin/parser.rb +1910 -0
  21. data/lib/gherkin/pickles/compiler.rb +164 -0
  22. data/lib/gherkin/token.rb +18 -0
  23. data/lib/gherkin/token_formatter_builder.rb +39 -0
  24. data/lib/gherkin/token_matcher.rb +169 -0
  25. data/lib/gherkin/token_scanner.rb +40 -0
  26. data/spec/capture_warnings.rb +68 -0
  27. data/spec/coverage.rb +10 -0
  28. data/spec/gherkin/parser_spec.rb +146 -0
  29. metadata +60 -567
  30. data/.gitattributes +0 -2
  31. data/.mailmap +0 -2
  32. data/.rbenv-gemsets +0 -1
  33. data/.rspec +0 -1
  34. data/.ruby-gemset +0 -1
  35. data/.ruby-version +0 -1
  36. data/.yardopts +0 -5
  37. data/History.md +0 -881
  38. data/build_native_gems.sh +0 -7
  39. data/cucumber.yml +0 -5
  40. data/examples/parse_and_output_json.rb +0 -19
  41. data/ext/gherkin_lexer_ar/extconf.rb +0 -6
  42. data/ext/gherkin_lexer_ar/gherkin_lexer_ar.c +0 -1432
  43. data/ext/gherkin_lexer_bg/extconf.rb +0 -6
  44. data/ext/gherkin_lexer_bg/gherkin_lexer_bg.c +0 -1655
  45. data/ext/gherkin_lexer_bm/extconf.rb +0 -6
  46. data/ext/gherkin_lexer_bm/gherkin_lexer_bm.c +0 -1516
  47. data/ext/gherkin_lexer_ca/extconf.rb +0 -6
  48. data/ext/gherkin_lexer_ca/gherkin_lexer_ca.c +0 -1581
  49. data/ext/gherkin_lexer_cs/extconf.rb +0 -6
  50. data/ext/gherkin_lexer_cs/gherkin_lexer_cs.c +0 -1515
  51. data/ext/gherkin_lexer_cy_gb/extconf.rb +0 -6
  52. data/ext/gherkin_lexer_cy_gb/gherkin_lexer_cy_gb.c +0 -1282
  53. data/ext/gherkin_lexer_da/extconf.rb +0 -6
  54. data/ext/gherkin_lexer_da/gherkin_lexer_da.c +0 -1298
  55. data/ext/gherkin_lexer_de/extconf.rb +0 -6
  56. data/ext/gherkin_lexer_de/gherkin_lexer_de.c +0 -1425
  57. data/ext/gherkin_lexer_el/extconf.rb +0 -6
  58. data/ext/gherkin_lexer_el/gherkin_lexer_el.c +0 -1919
  59. data/ext/gherkin_lexer_en/extconf.rb +0 -6
  60. data/ext/gherkin_lexer_en/gherkin_lexer_en.c +0 -1418
  61. data/ext/gherkin_lexer_en_au/extconf.rb +0 -6
  62. data/ext/gherkin_lexer_en_au/gherkin_lexer_en_au.c +0 -1765
  63. data/ext/gherkin_lexer_en_lol/extconf.rb +0 -6
  64. data/ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c +0 -1177
  65. data/ext/gherkin_lexer_en_old/extconf.rb +0 -6
  66. data/ext/gherkin_lexer_en_old/gherkin_lexer_en_old.c +0 -1309
  67. data/ext/gherkin_lexer_en_pirate/extconf.rb +0 -6
  68. data/ext/gherkin_lexer_en_pirate/gherkin_lexer_en_pirate.c +0 -1471
  69. data/ext/gherkin_lexer_en_scouse/extconf.rb +0 -6
  70. data/ext/gherkin_lexer_en_scouse/gherkin_lexer_en_scouse.c +0 -1634
  71. data/ext/gherkin_lexer_en_tx/extconf.rb +0 -6
  72. data/ext/gherkin_lexer_en_tx/gherkin_lexer_en_tx.c +0 -1265
  73. data/ext/gherkin_lexer_eo/extconf.rb +0 -6
  74. data/ext/gherkin_lexer_eo/gherkin_lexer_eo.c +0 -1241
  75. data/ext/gherkin_lexer_es/extconf.rb +0 -6
  76. data/ext/gherkin_lexer_es/gherkin_lexer_es.c +0 -1399
  77. data/ext/gherkin_lexer_et/extconf.rb +0 -6
  78. data/ext/gherkin_lexer_et/gherkin_lexer_et.c +0 -1236
  79. data/ext/gherkin_lexer_fa/extconf.rb +0 -6
  80. data/ext/gherkin_lexer_fa/gherkin_lexer_fa.c +0 -1475
  81. data/ext/gherkin_lexer_fi/extconf.rb +0 -6
  82. data/ext/gherkin_lexer_fi/gherkin_lexer_fi.c +0 -1215
  83. data/ext/gherkin_lexer_fr/extconf.rb +0 -6
  84. data/ext/gherkin_lexer_fr/gherkin_lexer_fr.c +0 -1493
  85. data/ext/gherkin_lexer_gl/extconf.rb +0 -6
  86. data/ext/gherkin_lexer_gl/gherkin_lexer_gl.c +0 -1374
  87. data/ext/gherkin_lexer_he/extconf.rb +0 -6
  88. data/ext/gherkin_lexer_he/gherkin_lexer_he.c +0 -1374
  89. data/ext/gherkin_lexer_hi/extconf.rb +0 -6
  90. data/ext/gherkin_lexer_hi/gherkin_lexer_hi.c +0 -1848
  91. data/ext/gherkin_lexer_hr/extconf.rb +0 -6
  92. data/ext/gherkin_lexer_hr/gherkin_lexer_hr.c +0 -1323
  93. data/ext/gherkin_lexer_hu/extconf.rb +0 -6
  94. data/ext/gherkin_lexer_hu/gherkin_lexer_hu.c +0 -1376
  95. data/ext/gherkin_lexer_id/extconf.rb +0 -6
  96. data/ext/gherkin_lexer_id/gherkin_lexer_id.c +0 -1208
  97. data/ext/gherkin_lexer_is/extconf.rb +0 -6
  98. data/ext/gherkin_lexer_is/gherkin_lexer_is.c +0 -1376
  99. data/ext/gherkin_lexer_it/extconf.rb +0 -6
  100. data/ext/gherkin_lexer_it/gherkin_lexer_it.c +0 -1340
  101. data/ext/gherkin_lexer_ja/extconf.rb +0 -6
  102. data/ext/gherkin_lexer_ja/gherkin_lexer_ja.c +0 -1699
  103. data/ext/gherkin_lexer_kn/extconf.rb +0 -6
  104. data/ext/gherkin_lexer_kn/gherkin_lexer_kn.c +0 -1965
  105. data/ext/gherkin_lexer_ko/extconf.rb +0 -6
  106. data/ext/gherkin_lexer_ko/gherkin_lexer_ko.c +0 -1360
  107. data/ext/gherkin_lexer_lt/extconf.rb +0 -6
  108. data/ext/gherkin_lexer_lt/gherkin_lexer_lt.c +0 -1296
  109. data/ext/gherkin_lexer_lu/extconf.rb +0 -6
  110. data/ext/gherkin_lexer_lu/gherkin_lexer_lu.c +0 -1389
  111. data/ext/gherkin_lexer_lv/extconf.rb +0 -6
  112. data/ext/gherkin_lexer_lv/gherkin_lexer_lv.c +0 -1425
  113. data/ext/gherkin_lexer_nl/extconf.rb +0 -6
  114. data/ext/gherkin_lexer_nl/gherkin_lexer_nl.c +0 -1368
  115. data/ext/gherkin_lexer_no/extconf.rb +0 -6
  116. data/ext/gherkin_lexer_no/gherkin_lexer_no.c +0 -1311
  117. data/ext/gherkin_lexer_pa/extconf.rb +0 -6
  118. data/ext/gherkin_lexer_pa/gherkin_lexer_pa.c +0 -2160
  119. data/ext/gherkin_lexer_pl/extconf.rb +0 -6
  120. data/ext/gherkin_lexer_pl/gherkin_lexer_pl.c +0 -1738
  121. data/ext/gherkin_lexer_pt/extconf.rb +0 -6
  122. data/ext/gherkin_lexer_pt/gherkin_lexer_pt.c +0 -1711
  123. data/ext/gherkin_lexer_ro/extconf.rb +0 -6
  124. data/ext/gherkin_lexer_ro/gherkin_lexer_ro.c +0 -1427
  125. data/ext/gherkin_lexer_ru/extconf.rb +0 -6
  126. data/ext/gherkin_lexer_ru/gherkin_lexer_ru.c +0 -2071
  127. data/ext/gherkin_lexer_sk/extconf.rb +0 -6
  128. data/ext/gherkin_lexer_sk/gherkin_lexer_sk.c +0 -1739
  129. data/ext/gherkin_lexer_sr_cyrl/extconf.rb +0 -6
  130. data/ext/gherkin_lexer_sr_cyrl/gherkin_lexer_sr_cyrl.c +0 -2112
  131. data/ext/gherkin_lexer_sr_latn/extconf.rb +0 -6
  132. data/ext/gherkin_lexer_sr_latn/gherkin_lexer_sr_latn.c +0 -1567
  133. data/ext/gherkin_lexer_sv/extconf.rb +0 -6
  134. data/ext/gherkin_lexer_sv/gherkin_lexer_sv.c +0 -1324
  135. data/ext/gherkin_lexer_th/extconf.rb +0 -6
  136. data/ext/gherkin_lexer_th/gherkin_lexer_th.c +0 -2840
  137. data/ext/gherkin_lexer_tl/extconf.rb +0 -6
  138. data/ext/gherkin_lexer_tl/gherkin_lexer_tl.c +0 -2021
  139. data/ext/gherkin_lexer_tr/extconf.rb +0 -6
  140. data/ext/gherkin_lexer_tr/gherkin_lexer_tr.c +0 -1347
  141. data/ext/gherkin_lexer_tt/extconf.rb +0 -6
  142. data/ext/gherkin_lexer_tt/gherkin_lexer_tt.c +0 -1936
  143. data/ext/gherkin_lexer_uk/extconf.rb +0 -6
  144. data/ext/gherkin_lexer_uk/gherkin_lexer_uk.c +0 -1941
  145. data/ext/gherkin_lexer_uz/extconf.rb +0 -6
  146. data/ext/gherkin_lexer_uz/gherkin_lexer_uz.c +0 -1651
  147. data/ext/gherkin_lexer_vi/extconf.rb +0 -6
  148. data/ext/gherkin_lexer_vi/gherkin_lexer_vi.c +0 -1458
  149. data/ext/gherkin_lexer_zh_cn/extconf.rb +0 -6
  150. data/ext/gherkin_lexer_zh_cn/gherkin_lexer_zh_cn.c +0 -1314
  151. data/ext/gherkin_lexer_zh_tw/extconf.rb +0 -6
  152. data/ext/gherkin_lexer_zh_tw/gherkin_lexer_zh_tw.c +0 -1307
  153. data/features/.cucumber/stepdefs.json +0 -244
  154. data/features/escaped_pipes.feature +0 -8
  155. data/features/feature_parser.feature +0 -237
  156. data/features/json_formatter.feature +0 -498
  157. data/features/json_parser.feature +0 -331
  158. data/features/native_lexer.feature +0 -19
  159. data/features/parser_with_native_lexer.feature +0 -205
  160. data/features/pretty_formatter.feature +0 -17
  161. data/features/step_definitions/eyeball_steps.rb +0 -3
  162. data/features/step_definitions/gherkin_steps.rb +0 -29
  163. data/features/step_definitions/json_formatter_steps.rb +0 -30
  164. data/features/step_definitions/json_parser_steps.rb +0 -21
  165. data/features/step_definitions/pretty_formatter_steps.rb +0 -85
  166. data/features/steps_parser.feature +0 -46
  167. data/features/support/env.rb +0 -41
  168. data/install_mingw_os_x.sh +0 -5
  169. data/js/.npmignore +0 -1
  170. data/js/lib/gherkin/lexer/.npmignore +0 -0
  171. data/lib/gherkin.rb +0 -2
  172. data/lib/gherkin/README.md +0 -7
  173. data/lib/gherkin/c_lexer.rb +0 -17
  174. data/lib/gherkin/formatter/ansi_escapes.rb +0 -97
  175. data/lib/gherkin/formatter/argument.rb +0 -16
  176. data/lib/gherkin/formatter/escaping.rb +0 -15
  177. data/lib/gherkin/formatter/filter_formatter.rb +0 -150
  178. data/lib/gherkin/formatter/hashable.rb +0 -25
  179. data/lib/gherkin/formatter/json_formatter.rb +0 -133
  180. data/lib/gherkin/formatter/line_filter.rb +0 -26
  181. data/lib/gherkin/formatter/model.rb +0 -281
  182. data/lib/gherkin/formatter/pretty_formatter.rb +0 -245
  183. data/lib/gherkin/formatter/regexp_filter.rb +0 -21
  184. data/lib/gherkin/formatter/step_printer.rb +0 -21
  185. data/lib/gherkin/formatter/tag_count_formatter.rb +0 -47
  186. data/lib/gherkin/formatter/tag_filter.rb +0 -19
  187. data/lib/gherkin/i18n.json +0 -786
  188. data/lib/gherkin/i18n.rb +0 -176
  189. data/lib/gherkin/json_parser.rb +0 -177
  190. data/lib/gherkin/lexer/ar.rb +0 -1170
  191. data/lib/gherkin/lexer/bg.rb +0 -1382
  192. data/lib/gherkin/lexer/bm.rb +0 -1250
  193. data/lib/gherkin/lexer/ca.rb +0 -1310
  194. data/lib/gherkin/lexer/cs.rb +0 -1246
  195. data/lib/gherkin/lexer/cy_gb.rb +0 -1032
  196. data/lib/gherkin/lexer/da.rb +0 -1048
  197. data/lib/gherkin/lexer/de.rb +0 -1166
  198. data/lib/gherkin/lexer/el.rb +0 -1628
  199. data/lib/gherkin/lexer/en.rb +0 -1156
  200. data/lib/gherkin/lexer/en_au.rb +0 -1486
  201. data/lib/gherkin/lexer/en_lol.rb +0 -934
  202. data/lib/gherkin/lexer/en_old.rb +0 -1037
  203. data/lib/gherkin/lexer/en_pirate.rb +0 -1210
  204. data/lib/gherkin/lexer/en_scouse.rb +0 -1362
  205. data/lib/gherkin/lexer/en_tx.rb +0 -1016
  206. data/lib/gherkin/lexer/encoding.rb +0 -41
  207. data/lib/gherkin/lexer/eo.rb +0 -995
  208. data/lib/gherkin/lexer/es.rb +0 -1140
  209. data/lib/gherkin/lexer/et.rb +0 -990
  210. data/lib/gherkin/lexer/fa.rb +0 -1214
  211. data/lib/gherkin/lexer/fi.rb +0 -969
  212. data/lib/gherkin/lexer/fr.rb +0 -1228
  213. data/lib/gherkin/lexer/gl.rb +0 -1117
  214. data/lib/gherkin/lexer/he.rb +0 -1118
  215. data/lib/gherkin/lexer/hi.rb +0 -1559
  216. data/lib/gherkin/lexer/hr.rb +0 -1066
  217. data/lib/gherkin/lexer/hu.rb +0 -1118
  218. data/lib/gherkin/lexer/i18n_lexer.rb +0 -48
  219. data/lib/gherkin/lexer/id.rb +0 -963
  220. data/lib/gherkin/lexer/is.rb +0 -1120
  221. data/lib/gherkin/lexer/it.rb +0 -1086
  222. data/lib/gherkin/lexer/ja.rb +0 -1418
  223. data/lib/gherkin/lexer/kn.rb +0 -1672
  224. data/lib/gherkin/lexer/ko.rb +0 -1102
  225. data/lib/gherkin/lexer/lt.rb +0 -1045
  226. data/lib/gherkin/lexer/lu.rb +0 -1132
  227. data/lib/gherkin/lexer/lv.rb +0 -1166
  228. data/lib/gherkin/lexer/nl.rb +0 -1115
  229. data/lib/gherkin/lexer/no.rb +0 -1060
  230. data/lib/gherkin/lexer/pa.rb +0 -1852
  231. data/lib/gherkin/lexer/pl.rb +0 -1457
  232. data/lib/gherkin/lexer/pt.rb +0 -1430
  233. data/lib/gherkin/lexer/ro.rb +0 -1164
  234. data/lib/gherkin/lexer/ru.rb +0 -1766
  235. data/lib/gherkin/lexer/sk.rb +0 -1452
  236. data/lib/gherkin/lexer/sr_cyrl.rb +0 -1803
  237. data/lib/gherkin/lexer/sr_latn.rb +0 -1294
  238. data/lib/gherkin/lexer/sv.rb +0 -1070
  239. data/lib/gherkin/lexer/th.rb +0 -2492
  240. data/lib/gherkin/lexer/tl.rb +0 -1726
  241. data/lib/gherkin/lexer/tr.rb +0 -1092
  242. data/lib/gherkin/lexer/tt.rb +0 -1643
  243. data/lib/gherkin/lexer/uk.rb +0 -1646
  244. data/lib/gherkin/lexer/uz.rb +0 -1376
  245. data/lib/gherkin/lexer/vi.rb +0 -1198
  246. data/lib/gherkin/lexer/zh_cn.rb +0 -1058
  247. data/lib/gherkin/lexer/zh_tw.rb +0 -1052
  248. data/lib/gherkin/listener/event.rb +0 -45
  249. data/lib/gherkin/listener/formatter_listener.rb +0 -150
  250. data/lib/gherkin/native.rb +0 -7
  251. data/lib/gherkin/native/java.rb +0 -72
  252. data/lib/gherkin/native/null.rb +0 -5
  253. data/lib/gherkin/native/therubyracer.rb +0 -41
  254. data/lib/gherkin/parser/meta.txt +0 -5
  255. data/lib/gherkin/parser/parser.rb +0 -166
  256. data/lib/gherkin/parser/root.txt +0 -11
  257. data/lib/gherkin/parser/steps.txt +0 -4
  258. data/lib/gherkin/platform.rb +0 -13
  259. data/lib/gherkin/rubify.rb +0 -31
  260. data/lib/gherkin/tag_expression.rb +0 -63
  261. data/ragel/lexer.c.rl.erb +0 -454
  262. data/ragel/lexer.java.rl.erb +0 -219
  263. data/ragel/lexer.js.rl.erb +0 -322
  264. data/ragel/lexer.rb.rl.erb +0 -179
  265. data/ragel/lexer_common.rl.erb +0 -50
  266. data/spec/gherkin/c_lexer_spec.rb +0 -22
  267. data/spec/gherkin/fixtures/1.feature +0 -8
  268. data/spec/gherkin/fixtures/comments_in_table.feature +0 -9
  269. data/spec/gherkin/fixtures/complex.feature +0 -45
  270. data/spec/gherkin/fixtures/complex.json +0 -139
  271. data/spec/gherkin/fixtures/complex_for_filtering.feature +0 -60
  272. data/spec/gherkin/fixtures/complex_with_tags.feature +0 -61
  273. data/spec/gherkin/fixtures/dos_line_endings.feature +0 -45
  274. data/spec/gherkin/fixtures/examples_with_only_header.feature +0 -14
  275. data/spec/gherkin/fixtures/hantu_pisang.feature +0 -35
  276. data/spec/gherkin/fixtures/i18n_fr.feature +0 -14
  277. data/spec/gherkin/fixtures/i18n_fr2.feature +0 -8
  278. data/spec/gherkin/fixtures/i18n_no.feature +0 -7
  279. data/spec/gherkin/fixtures/i18n_pt1.feature +0 -44
  280. data/spec/gherkin/fixtures/i18n_pt2.feature +0 -4
  281. data/spec/gherkin/fixtures/i18n_pt3.feature +0 -4
  282. data/spec/gherkin/fixtures/i18n_pt4.feature +0 -4
  283. data/spec/gherkin/fixtures/i18n_zh-CN.feature +0 -9
  284. data/spec/gherkin/fixtures/iso-8859-1.feature +0 -6
  285. data/spec/gherkin/fixtures/issue_145.feature +0 -22
  286. data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +0 -13
  287. data/spec/gherkin/fixtures/scenario_without_steps.feature +0 -5
  288. data/spec/gherkin/fixtures/simple_with_comments.feature +0 -7
  289. data/spec/gherkin/fixtures/simple_with_tags.feature +0 -11
  290. data/spec/gherkin/fixtures/with_bom.feature +0 -3
  291. data/spec/gherkin/fixtures/with_bom_and_language_spec.feature +0 -4
  292. data/spec/gherkin/formatter/ansi_escapes_spec.rb +0 -32
  293. data/spec/gherkin/formatter/filter_formatter_spec.rb +0 -204
  294. data/spec/gherkin/formatter/json_formatter_spec.rb +0 -179
  295. data/spec/gherkin/formatter/model_spec.rb +0 -28
  296. data/spec/gherkin/formatter/pretty_formatter_spec.rb +0 -184
  297. data/spec/gherkin/formatter/spaces.feature +0 -9
  298. data/spec/gherkin/formatter/step_printer_spec.rb +0 -55
  299. data/spec/gherkin/formatter/tabs.feature +0 -9
  300. data/spec/gherkin/formatter/tag_count_formatter_spec.rb +0 -30
  301. data/spec/gherkin/i18n_spec.rb +0 -256
  302. data/spec/gherkin/java_lexer_spec.rb +0 -20
  303. data/spec/gherkin/json_parser_spec.rb +0 -165
  304. data/spec/gherkin/lexer/i18n_lexer_spec.rb +0 -65
  305. data/spec/gherkin/native_lexer_spec.rb +0 -29
  306. data/spec/gherkin/parser/parser_spec.rb +0 -16
  307. data/spec/gherkin/rubify_spec.rb +0 -23
  308. data/spec/gherkin/sexp_recorder.rb +0 -59
  309. data/spec/gherkin/shared/doc_string_group.rb +0 -161
  310. data/spec/gherkin/shared/encoding_group.rb +0 -48
  311. data/spec/gherkin/shared/lexer_group.rb +0 -589
  312. data/spec/gherkin/shared/row_group.rb +0 -123
  313. data/spec/gherkin/shared/tags_group.rb +0 -52
  314. data/spec/gherkin/tag_expression_spec.rb +0 -146
  315. data/spec/spec_helper.rb +0 -94
  316. data/tasks/apidoc.rake +0 -32
  317. data/tasks/bench.rake +0 -184
  318. data/tasks/bench/feature_builder.rb +0 -49
  319. data/tasks/bench/null_listener.rb +0 -4
  320. data/tasks/compile.rake +0 -83
  321. data/tasks/cucumber.rake +0 -23
  322. data/tasks/gems.rake +0 -46
  323. data/tasks/ikvm.rake +0 -126
  324. data/tasks/ragel_task.rb +0 -124
  325. data/tasks/release.rake +0 -34
  326. data/tasks/rspec.rake +0 -6
  327. data/tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  328. data/tasks/yard/default/layout/html/bubble_48x48.png +0 -0
  329. data/tasks/yard/default/layout/html/footer.erb +0 -5
  330. data/tasks/yard/default/layout/html/index.erb +0 -1
  331. data/tasks/yard/default/layout/html/layout.erb +0 -25
  332. data/tasks/yard/default/layout/html/logo.erb +0 -1
  333. data/tasks/yard/default/layout/html/setup.rb +0 -4
@@ -1,6 +0,0 @@
1
- require 'mkmf'
2
- CONFIG['warnflags'].gsub!(/-Wshorten-64-to-32/, '') if CONFIG['warnflags']
3
- $CFLAGS << ' -O0 -Wall' if CONFIG['CC'] =~ /gcc|clang/
4
- dir_config("gherkin_lexer_en_lol")
5
- have_library("c", "main")
6
- create_makefile("gherkin_lexer_en_lol")
@@ -1,1177 +0,0 @@
1
-
2
- #line 1 "ragel/i18n/en_lol.c.rl"
3
- #include <assert.h>
4
- #include <ruby.h>
5
-
6
- #if defined(_WIN32)
7
- #include <stddef.h>
8
- #endif
9
-
10
- #ifdef HAVE_RUBY_RE_H
11
- #include <ruby/re.h>
12
- #else
13
- #include <re.h>
14
- #endif
15
-
16
- #ifdef HAVE_RUBY_ENCODING_H
17
- #include <ruby/encoding.h>
18
- #define ENCODED_STR_NEW(ptr, len) \
19
- rb_enc_str_new(ptr, len, rb_utf8_encoding())
20
- #else
21
- #define ENCODED_STR_NEW(ptr, len) \
22
- rb_str_new(ptr, len)
23
- #endif
24
-
25
- #ifndef RSTRING_PTR
26
- #define RSTRING_PTR(s) (RSTRING(s)->ptr)
27
- #endif
28
-
29
- #ifndef RSTRING_LEN
30
- #define RSTRING_LEN(s) (RSTRING(s)->len)
31
- #endif
32
-
33
- #define DATA_GET(FROM, TYPE, NAME) \
34
- Data_Get_Struct(FROM, TYPE, NAME); \
35
- if (NAME == NULL) { \
36
- rb_raise(rb_eArgError, "NULL found for " # NAME " when it shouldn't be."); \
37
- }
38
-
39
- typedef struct lexer_state {
40
- int content_len;
41
- int line_number;
42
- int current_line;
43
- int start_col;
44
- size_t mark;
45
- size_t keyword_start;
46
- size_t keyword_end;
47
- size_t next_keyword_start;
48
- size_t content_start;
49
- size_t content_end;
50
- size_t docstring_content_type_start;
51
- size_t docstring_content_type_end;
52
- size_t query_start;
53
- size_t last_newline;
54
- size_t final_newline;
55
- } lexer_state;
56
-
57
- static VALUE mGherkin;
58
- static VALUE mGherkinLexer;
59
- static VALUE mCLexer;
60
- static VALUE cI18nLexer;
61
- static VALUE rb_eGherkinLexingError;
62
-
63
- #define LEN(AT, P) (P - data - lexer->AT)
64
- #define MARK(M, P) (lexer->M = (P) - data)
65
- #define PTR_TO(P) (data + lexer->P)
66
-
67
- #define STORE_KW_END_CON(EVENT) \
68
- store_multiline_kw_con(listener, # EVENT, \
69
- PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end - 1)), \
70
- PTR_TO(content_start), LEN(content_start, PTR_TO(content_end)), \
71
- lexer->current_line, lexer->start_col); \
72
- if (lexer->content_end != 0) { \
73
- p = PTR_TO(content_end - 1); \
74
- } \
75
- lexer->content_end = 0
76
-
77
- #define STORE_ATTR(ATTR) \
78
- store_attr(listener, # ATTR, \
79
- PTR_TO(content_start), LEN(content_start, p), \
80
- lexer->line_number)
81
-
82
-
83
- #line 254 "ragel/i18n/en_lol.c.rl"
84
-
85
-
86
- /** Data **/
87
-
88
- #line 89 "ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c"
89
- static const char _lexer_actions[] = {
90
- 0, 1, 0, 1, 1, 1, 2, 1,
91
- 3, 1, 4, 1, 5, 1, 6, 1,
92
- 7, 1, 8, 1, 9, 1, 10, 1,
93
- 11, 1, 12, 1, 13, 1, 16, 1,
94
- 17, 1, 18, 1, 19, 1, 20, 1,
95
- 21, 1, 22, 1, 23, 2, 1, 18,
96
- 2, 4, 5, 2, 13, 0, 2, 14,
97
- 15, 2, 17, 0, 2, 17, 2, 2,
98
- 17, 16, 2, 17, 19, 2, 18, 6,
99
- 2, 18, 7, 2, 18, 8, 2, 18,
100
- 9, 2, 18, 10, 2, 18, 16, 2,
101
- 20, 21, 2, 22, 0, 2, 22, 2,
102
- 2, 22, 16, 2, 22, 19, 3, 3,
103
- 14, 15, 3, 5, 14, 15, 3, 11,
104
- 14, 15, 3, 12, 14, 15, 3, 13,
105
- 14, 15, 3, 14, 15, 18, 3, 17,
106
- 0, 11, 3, 17, 14, 15, 4, 1,
107
- 14, 15, 18, 4, 4, 5, 14, 15,
108
- 4, 17, 0, 14, 15, 5, 17, 0,
109
- 11, 14, 15
110
- };
111
-
112
- static const short _lexer_key_offsets[] = {
113
- 0, 0, 19, 20, 21, 39, 40, 41,
114
- 43, 45, 50, 55, 60, 65, 69, 73,
115
- 75, 76, 77, 78, 79, 80, 81, 82,
116
- 83, 84, 85, 86, 87, 88, 89, 90,
117
- 91, 93, 95, 100, 107, 112, 113, 115,
118
- 116, 117, 118, 133, 135, 137, 139, 141,
119
- 143, 145, 147, 149, 151, 153, 155, 157,
120
- 159, 161, 163, 181, 182, 183, 184, 185,
121
- 186, 187, 188, 189, 190, 191, 198, 200,
122
- 202, 204, 206, 208, 210, 211, 212, 213,
123
- 214, 215, 216, 217, 218, 219, 220, 221,
124
- 222, 223, 225, 226, 227, 228, 229, 230,
125
- 231, 232, 233, 248, 250, 252, 254, 256,
126
- 258, 260, 262, 264, 266, 268, 270, 272,
127
- 274, 276, 278, 280, 282, 284, 286, 288,
128
- 290, 292, 294, 296, 298, 300, 302, 304,
129
- 306, 308, 310, 312, 314, 316, 318, 320,
130
- 322, 324, 325, 326, 341, 343, 345, 347,
131
- 349, 351, 353, 355, 357, 359, 361, 363,
132
- 365, 367, 369, 371, 373, 376, 378, 380,
133
- 382, 384, 386, 388, 390, 392, 394, 396,
134
- 398, 400, 402, 404, 406, 408, 411, 413,
135
- 415, 417, 419, 421, 423, 425, 427, 429,
136
- 431, 432, 433, 434, 435, 436, 437, 438,
137
- 439, 450, 452, 454, 456, 458, 460, 462,
138
- 464, 466, 468, 470, 472, 474, 476, 478,
139
- 480, 482, 484, 486, 488, 490, 492, 494,
140
- 496, 498, 500, 502, 504, 507, 509, 511,
141
- 513, 515, 517, 519, 521, 523, 525, 527,
142
- 531, 537, 540, 542, 548, 566, 568, 570,
143
- 572, 574, 576, 578, 580, 582, 584, 586,
144
- 588, 590, 592, 594, 596, 598, 600, 603,
145
- 605, 607, 609, 611, 613, 615, 617, 619,
146
- 621, 623, 625, 626
147
- };
148
-
149
- static const char _lexer_trans_keys[] = {
150
- -17, 10, 32, 34, 35, 37, 42, 64,
151
- 65, 66, 68, 69, 73, 77, 79, 87,
152
- 124, 9, 13, -69, -65, 10, 32, 34,
153
- 35, 37, 42, 64, 65, 66, 68, 69,
154
- 73, 77, 79, 87, 124, 9, 13, 34,
155
- 34, 10, 13, 10, 13, 10, 32, 34,
156
- 9, 13, 10, 32, 34, 9, 13, 10,
157
- 32, 34, 9, 13, 10, 32, 34, 9,
158
- 13, 10, 32, 9, 13, 10, 32, 9,
159
- 13, 10, 13, 10, 95, 70, 69, 65,
160
- 84, 85, 82, 69, 95, 69, 78, 68,
161
- 95, 37, 32, 10, 13, 10, 13, 13,
162
- 32, 64, 9, 10, 9, 10, 13, 32,
163
- 64, 11, 12, 10, 32, 64, 9, 13,
164
- 78, 52, 85, 58, 10, 10, 10, 32,
165
- 35, 37, 42, 64, 65, 66, 68, 73,
166
- 77, 79, 87, 9, 13, 10, 95, 10,
167
- 70, 10, 69, 10, 65, 10, 84, 10,
168
- 85, 10, 82, 10, 69, 10, 95, 10,
169
- 69, 10, 78, 10, 68, 10, 95, 10,
170
- 37, 10, 32, 10, 32, 34, 35, 37,
171
- 42, 64, 65, 66, 68, 69, 73, 77,
172
- 79, 87, 124, 9, 13, 69, 88, 65,
173
- 77, 80, 76, 90, 58, 10, 10, 10,
174
- 32, 35, 79, 124, 9, 13, 10, 72,
175
- 10, 32, 10, 72, 10, 65, 10, 73,
176
- 10, 58, 32, 67, 65, 78, 32, 72,
177
- 65, 90, 73, 83, 72, 85, 78, 32,
178
- 58, 83, 82, 83, 76, 89, 58, 10,
179
- 10, 10, 32, 35, 37, 42, 64, 65,
180
- 66, 68, 73, 77, 79, 87, 9, 13,
181
- 10, 95, 10, 70, 10, 69, 10, 65,
182
- 10, 84, 10, 85, 10, 82, 10, 69,
183
- 10, 95, 10, 69, 10, 78, 10, 68,
184
- 10, 95, 10, 37, 10, 32, 10, 78,
185
- 10, 85, 10, 84, 10, 69, 10, 32,
186
- 10, 67, 10, 65, 10, 78, 10, 32,
187
- 10, 72, 10, 65, 10, 90, 10, 73,
188
- 10, 83, 10, 72, 10, 85, 10, 78,
189
- 10, 58, 10, 72, 10, 32, 10, 72,
190
- 10, 65, 10, 73, 10, 10, 10, 32,
191
- 35, 37, 42, 64, 65, 66, 68, 73,
192
- 77, 79, 87, 9, 13, 10, 95, 10,
193
- 70, 10, 69, 10, 65, 10, 84, 10,
194
- 85, 10, 82, 10, 69, 10, 95, 10,
195
- 69, 10, 78, 10, 68, 10, 95, 10,
196
- 37, 10, 32, 10, 78, 10, 52, 85,
197
- 10, 58, 10, 84, 10, 69, 10, 32,
198
- 10, 67, 10, 65, 10, 78, 10, 32,
199
- 10, 72, 10, 65, 10, 90, 10, 73,
200
- 10, 83, 10, 72, 10, 85, 10, 78,
201
- 10, 32, 58, 10, 83, 10, 82, 10,
202
- 83, 10, 76, 10, 89, 10, 72, 10,
203
- 32, 10, 72, 10, 65, 10, 73, 72,
204
- 32, 72, 65, 73, 58, 10, 10, 10,
205
- 32, 35, 37, 64, 66, 69, 77, 79,
206
- 9, 13, 10, 95, 10, 70, 10, 69,
207
- 10, 65, 10, 84, 10, 85, 10, 82,
208
- 10, 69, 10, 95, 10, 69, 10, 78,
209
- 10, 68, 10, 95, 10, 37, 10, 52,
210
- 10, 58, 10, 88, 10, 65, 10, 77,
211
- 10, 80, 10, 76, 10, 90, 10, 73,
212
- 10, 83, 10, 72, 10, 85, 10, 78,
213
- 10, 32, 58, 10, 83, 10, 82, 10,
214
- 83, 10, 76, 10, 89, 10, 72, 10,
215
- 32, 10, 72, 10, 65, 10, 73, 32,
216
- 124, 9, 13, 10, 32, 92, 124, 9,
217
- 13, 10, 92, 124, 10, 92, 10, 32,
218
- 92, 124, 9, 13, 10, 32, 34, 35,
219
- 37, 42, 64, 65, 66, 68, 69, 73,
220
- 77, 79, 87, 124, 9, 13, 10, 78,
221
- 10, 85, 10, 84, 10, 69, 10, 32,
222
- 10, 67, 10, 65, 10, 78, 10, 32,
223
- 10, 72, 10, 65, 10, 90, 10, 73,
224
- 10, 83, 10, 72, 10, 85, 10, 78,
225
- 10, 32, 58, 10, 83, 10, 82, 10,
226
- 83, 10, 76, 10, 89, 10, 58, 10,
227
- 72, 10, 32, 10, 72, 10, 65, 10,
228
- 73, 84, 0
229
- };
230
-
231
- static const char _lexer_single_lengths[] = {
232
- 0, 17, 1, 1, 16, 1, 1, 2,
233
- 2, 3, 3, 3, 3, 2, 2, 2,
234
- 1, 1, 1, 1, 1, 1, 1, 1,
235
- 1, 1, 1, 1, 1, 1, 1, 1,
236
- 2, 2, 3, 5, 3, 1, 2, 1,
237
- 1, 1, 13, 2, 2, 2, 2, 2,
238
- 2, 2, 2, 2, 2, 2, 2, 2,
239
- 2, 2, 16, 1, 1, 1, 1, 1,
240
- 1, 1, 1, 1, 1, 5, 2, 2,
241
- 2, 2, 2, 2, 1, 1, 1, 1,
242
- 1, 1, 1, 1, 1, 1, 1, 1,
243
- 1, 2, 1, 1, 1, 1, 1, 1,
244
- 1, 1, 13, 2, 2, 2, 2, 2,
245
- 2, 2, 2, 2, 2, 2, 2, 2,
246
- 2, 2, 2, 2, 2, 2, 2, 2,
247
- 2, 2, 2, 2, 2, 2, 2, 2,
248
- 2, 2, 2, 2, 2, 2, 2, 2,
249
- 2, 1, 1, 13, 2, 2, 2, 2,
250
- 2, 2, 2, 2, 2, 2, 2, 2,
251
- 2, 2, 2, 2, 3, 2, 2, 2,
252
- 2, 2, 2, 2, 2, 2, 2, 2,
253
- 2, 2, 2, 2, 2, 3, 2, 2,
254
- 2, 2, 2, 2, 2, 2, 2, 2,
255
- 1, 1, 1, 1, 1, 1, 1, 1,
256
- 9, 2, 2, 2, 2, 2, 2, 2,
257
- 2, 2, 2, 2, 2, 2, 2, 2,
258
- 2, 2, 2, 2, 2, 2, 2, 2,
259
- 2, 2, 2, 2, 3, 2, 2, 2,
260
- 2, 2, 2, 2, 2, 2, 2, 2,
261
- 4, 3, 2, 4, 16, 2, 2, 2,
262
- 2, 2, 2, 2, 2, 2, 2, 2,
263
- 2, 2, 2, 2, 2, 2, 3, 2,
264
- 2, 2, 2, 2, 2, 2, 2, 2,
265
- 2, 2, 1, 0
266
- };
267
-
268
- static const char _lexer_range_lengths[] = {
269
- 0, 1, 0, 0, 1, 0, 0, 0,
270
- 0, 1, 1, 1, 1, 1, 1, 0,
271
- 0, 0, 0, 0, 0, 0, 0, 0,
272
- 0, 0, 0, 0, 0, 0, 0, 0,
273
- 0, 0, 1, 1, 1, 0, 0, 0,
274
- 0, 0, 1, 0, 0, 0, 0, 0,
275
- 0, 0, 0, 0, 0, 0, 0, 0,
276
- 0, 0, 1, 0, 0, 0, 0, 0,
277
- 0, 0, 0, 0, 0, 1, 0, 0,
278
- 0, 0, 0, 0, 0, 0, 0, 0,
279
- 0, 0, 0, 0, 0, 0, 0, 0,
280
- 0, 0, 0, 0, 0, 0, 0, 0,
281
- 0, 0, 1, 0, 0, 0, 0, 0,
282
- 0, 0, 0, 0, 0, 0, 0, 0,
283
- 0, 0, 0, 0, 0, 0, 0, 0,
284
- 0, 0, 0, 0, 0, 0, 0, 0,
285
- 0, 0, 0, 0, 0, 0, 0, 0,
286
- 0, 0, 0, 1, 0, 0, 0, 0,
287
- 0, 0, 0, 0, 0, 0, 0, 0,
288
- 0, 0, 0, 0, 0, 0, 0, 0,
289
- 0, 0, 0, 0, 0, 0, 0, 0,
290
- 0, 0, 0, 0, 0, 0, 0, 0,
291
- 0, 0, 0, 0, 0, 0, 0, 0,
292
- 0, 0, 0, 0, 0, 0, 0, 0,
293
- 1, 0, 0, 0, 0, 0, 0, 0,
294
- 0, 0, 0, 0, 0, 0, 0, 0,
295
- 0, 0, 0, 0, 0, 0, 0, 0,
296
- 0, 0, 0, 0, 0, 0, 0, 0,
297
- 0, 0, 0, 0, 0, 0, 0, 1,
298
- 1, 0, 0, 1, 1, 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
303
- };
304
-
305
- static const short _lexer_index_offsets[] = {
306
- 0, 0, 19, 21, 23, 41, 43, 45,
307
- 48, 51, 56, 61, 66, 71, 75, 79,
308
- 82, 84, 86, 88, 90, 92, 94, 96,
309
- 98, 100, 102, 104, 106, 108, 110, 112,
310
- 114, 117, 120, 125, 132, 137, 139, 142,
311
- 144, 146, 148, 163, 166, 169, 172, 175,
312
- 178, 181, 184, 187, 190, 193, 196, 199,
313
- 202, 205, 208, 226, 228, 230, 232, 234,
314
- 236, 238, 240, 242, 244, 246, 253, 256,
315
- 259, 262, 265, 268, 271, 273, 275, 277,
316
- 279, 281, 283, 285, 287, 289, 291, 293,
317
- 295, 297, 300, 302, 304, 306, 308, 310,
318
- 312, 314, 316, 331, 334, 337, 340, 343,
319
- 346, 349, 352, 355, 358, 361, 364, 367,
320
- 370, 373, 376, 379, 382, 385, 388, 391,
321
- 394, 397, 400, 403, 406, 409, 412, 415,
322
- 418, 421, 424, 427, 430, 433, 436, 439,
323
- 442, 445, 447, 449, 464, 467, 470, 473,
324
- 476, 479, 482, 485, 488, 491, 494, 497,
325
- 500, 503, 506, 509, 512, 516, 519, 522,
326
- 525, 528, 531, 534, 537, 540, 543, 546,
327
- 549, 552, 555, 558, 561, 564, 568, 571,
328
- 574, 577, 580, 583, 586, 589, 592, 595,
329
- 598, 600, 602, 604, 606, 608, 610, 612,
330
- 614, 625, 628, 631, 634, 637, 640, 643,
331
- 646, 649, 652, 655, 658, 661, 664, 667,
332
- 670, 673, 676, 679, 682, 685, 688, 691,
333
- 694, 697, 700, 703, 706, 710, 713, 716,
334
- 719, 722, 725, 728, 731, 734, 737, 740,
335
- 744, 750, 754, 757, 763, 781, 784, 787,
336
- 790, 793, 796, 799, 802, 805, 808, 811,
337
- 814, 817, 820, 823, 826, 829, 832, 836,
338
- 839, 842, 845, 848, 851, 854, 857, 860,
339
- 863, 866, 869, 871
340
- };
341
-
342
- static const short _lexer_trans_targs[] = {
343
- 2, 4, 4, 5, 15, 17, 31, 34,
344
- 37, 38, 59, 60, 76, 84, 184, 59,
345
- 231, 4, 0, 3, 0, 4, 0, 4,
346
- 4, 5, 15, 17, 31, 34, 37, 38,
347
- 59, 60, 76, 84, 184, 59, 231, 4,
348
- 0, 6, 0, 7, 0, 9, 8, 8,
349
- 9, 8, 8, 10, 10, 11, 10, 10,
350
- 10, 10, 11, 10, 10, 10, 10, 12,
351
- 10, 10, 10, 10, 13, 10, 10, 4,
352
- 14, 14, 0, 4, 14, 14, 0, 4,
353
- 16, 15, 4, 0, 18, 0, 19, 0,
354
- 20, 0, 21, 0, 22, 0, 23, 0,
355
- 24, 0, 25, 0, 26, 0, 27, 0,
356
- 28, 0, 29, 0, 30, 0, 267, 0,
357
- 32, 0, 4, 16, 33, 4, 16, 33,
358
- 0, 0, 0, 0, 35, 36, 4, 36,
359
- 36, 34, 35, 35, 4, 36, 34, 36,
360
- 0, 31, 0, 39, 266, 0, 40, 0,
361
- 42, 41, 42, 41, 42, 42, 4, 43,
362
- 57, 4, 237, 238, 240, 241, 249, 261,
363
- 240, 42, 41, 42, 44, 41, 42, 45,
364
- 41, 42, 46, 41, 42, 47, 41, 42,
365
- 48, 41, 42, 49, 41, 42, 50, 41,
366
- 42, 51, 41, 42, 52, 41, 42, 53,
367
- 41, 42, 54, 41, 42, 55, 41, 42,
368
- 56, 41, 42, 4, 41, 42, 58, 41,
369
- 4, 4, 5, 15, 17, 31, 34, 37,
370
- 38, 59, 60, 76, 84, 184, 59, 231,
371
- 4, 0, 37, 0, 61, 0, 62, 0,
372
- 63, 0, 64, 0, 65, 0, 66, 0,
373
- 67, 0, 69, 68, 69, 68, 69, 69,
374
- 4, 70, 4, 69, 68, 69, 71, 68,
375
- 69, 72, 68, 69, 73, 68, 69, 74,
376
- 68, 69, 75, 68, 69, 58, 68, 77,
377
- 0, 78, 0, 79, 0, 80, 0, 81,
378
- 0, 82, 0, 83, 0, 31, 0, 85,
379
- 0, 86, 0, 87, 0, 88, 0, 89,
380
- 0, 90, 137, 0, 91, 0, 92, 0,
381
- 93, 0, 94, 0, 95, 0, 96, 0,
382
- 98, 97, 98, 97, 98, 98, 4, 99,
383
- 113, 4, 114, 115, 117, 118, 126, 132,
384
- 117, 98, 97, 98, 100, 97, 98, 101,
385
- 97, 98, 102, 97, 98, 103, 97, 98,
386
- 104, 97, 98, 105, 97, 98, 106, 97,
387
- 98, 107, 97, 98, 108, 97, 98, 109,
388
- 97, 98, 110, 97, 98, 111, 97, 98,
389
- 112, 97, 98, 4, 97, 98, 58, 97,
390
- 98, 113, 97, 98, 116, 97, 98, 113,
391
- 97, 98, 114, 97, 98, 119, 97, 98,
392
- 120, 97, 98, 121, 97, 98, 122, 97,
393
- 98, 123, 97, 98, 124, 97, 98, 125,
394
- 97, 98, 113, 97, 98, 127, 97, 98,
395
- 128, 97, 98, 129, 97, 98, 130, 97,
396
- 98, 131, 97, 98, 58, 97, 98, 133,
397
- 97, 98, 134, 97, 98, 135, 97, 98,
398
- 136, 97, 98, 131, 97, 139, 138, 139,
399
- 138, 139, 139, 4, 140, 154, 4, 155,
400
- 156, 159, 160, 168, 179, 159, 139, 138,
401
- 139, 141, 138, 139, 142, 138, 139, 143,
402
- 138, 139, 144, 138, 139, 145, 138, 139,
403
- 146, 138, 139, 147, 138, 139, 148, 138,
404
- 139, 149, 138, 139, 150, 138, 139, 151,
405
- 138, 139, 152, 138, 139, 153, 138, 139,
406
- 4, 138, 139, 58, 138, 139, 154, 138,
407
- 139, 157, 158, 138, 139, 58, 138, 139,
408
- 154, 138, 139, 155, 138, 139, 161, 138,
409
- 139, 162, 138, 139, 163, 138, 139, 164,
410
- 138, 139, 165, 138, 139, 166, 138, 139,
411
- 167, 138, 139, 154, 138, 139, 169, 138,
412
- 139, 170, 138, 139, 171, 138, 139, 172,
413
- 138, 139, 173, 138, 139, 174, 58, 138,
414
- 139, 175, 138, 139, 176, 138, 139, 177,
415
- 138, 139, 178, 138, 139, 157, 138, 139,
416
- 180, 138, 139, 181, 138, 139, 182, 138,
417
- 139, 183, 138, 139, 157, 138, 185, 0,
418
- 186, 0, 187, 0, 188, 0, 189, 0,
419
- 190, 0, 192, 191, 192, 191, 192, 192,
420
- 4, 193, 4, 207, 209, 215, 226, 192,
421
- 191, 192, 194, 191, 192, 195, 191, 192,
422
- 196, 191, 192, 197, 191, 192, 198, 191,
423
- 192, 199, 191, 192, 200, 191, 192, 201,
424
- 191, 192, 202, 191, 192, 203, 191, 192,
425
- 204, 191, 192, 205, 191, 192, 206, 191,
426
- 192, 4, 191, 192, 208, 191, 192, 58,
427
- 191, 192, 210, 191, 192, 211, 191, 192,
428
- 212, 191, 192, 213, 191, 192, 214, 191,
429
- 192, 208, 191, 192, 216, 191, 192, 217,
430
- 191, 192, 218, 191, 192, 219, 191, 192,
431
- 220, 191, 192, 221, 58, 191, 192, 222,
432
- 191, 192, 223, 191, 192, 224, 191, 192,
433
- 225, 191, 192, 208, 191, 192, 227, 191,
434
- 192, 228, 191, 192, 229, 191, 192, 230,
435
- 191, 192, 208, 191, 231, 232, 231, 0,
436
- 236, 235, 234, 232, 235, 233, 0, 234,
437
- 232, 233, 0, 234, 233, 236, 235, 234,
438
- 232, 235, 233, 236, 236, 5, 15, 17,
439
- 31, 34, 37, 38, 59, 60, 76, 84,
440
- 184, 59, 231, 236, 0, 42, 57, 41,
441
- 42, 239, 41, 42, 57, 41, 42, 237,
442
- 41, 42, 242, 41, 42, 243, 41, 42,
443
- 244, 41, 42, 245, 41, 42, 246, 41,
444
- 42, 247, 41, 42, 248, 41, 42, 57,
445
- 41, 42, 250, 41, 42, 251, 41, 42,
446
- 252, 41, 42, 253, 41, 42, 254, 41,
447
- 42, 255, 58, 41, 42, 256, 41, 42,
448
- 257, 41, 42, 258, 41, 42, 259, 41,
449
- 42, 260, 41, 42, 58, 41, 42, 262,
450
- 41, 42, 263, 41, 42, 264, 41, 42,
451
- 265, 41, 42, 260, 41, 31, 0, 0,
452
- 0
453
- };
454
-
455
- static const unsigned char _lexer_trans_actions[] = {
456
- 0, 54, 0, 5, 1, 0, 29, 1,
457
- 29, 29, 29, 29, 29, 29, 29, 29,
458
- 35, 0, 43, 0, 43, 0, 43, 54,
459
- 0, 5, 1, 0, 29, 1, 29, 29,
460
- 29, 29, 29, 29, 29, 29, 35, 0,
461
- 43, 0, 43, 0, 43, 139, 48, 9,
462
- 106, 11, 0, 134, 45, 45, 45, 3,
463
- 122, 33, 33, 33, 0, 122, 33, 33,
464
- 33, 0, 122, 33, 0, 33, 0, 102,
465
- 7, 7, 43, 54, 0, 0, 43, 114,
466
- 25, 0, 54, 43, 0, 43, 0, 43,
467
- 0, 43, 0, 43, 0, 43, 0, 43,
468
- 0, 43, 0, 43, 0, 43, 0, 43,
469
- 0, 43, 0, 43, 0, 43, 0, 43,
470
- 0, 43, 149, 126, 57, 110, 23, 0,
471
- 43, 43, 43, 43, 0, 27, 118, 27,
472
- 27, 51, 27, 0, 54, 0, 1, 0,
473
- 43, 0, 43, 0, 0, 43, 0, 43,
474
- 144, 57, 54, 0, 54, 0, 72, 33,
475
- 84, 72, 84, 84, 84, 84, 84, 84,
476
- 84, 0, 0, 54, 0, 0, 54, 0,
477
- 0, 54, 0, 0, 54, 0, 0, 54,
478
- 0, 0, 54, 0, 0, 54, 0, 0,
479
- 54, 0, 0, 54, 0, 0, 54, 0,
480
- 0, 54, 0, 0, 54, 0, 0, 54,
481
- 0, 0, 54, 15, 0, 54, 15, 0,
482
- 130, 31, 60, 57, 31, 63, 57, 63,
483
- 63, 63, 63, 63, 63, 63, 63, 66,
484
- 31, 43, 0, 43, 0, 43, 0, 43,
485
- 0, 43, 0, 43, 0, 43, 0, 43,
486
- 0, 43, 144, 57, 54, 0, 54, 0,
487
- 81, 84, 81, 0, 0, 54, 0, 0,
488
- 54, 0, 0, 54, 0, 0, 54, 0,
489
- 0, 54, 0, 0, 54, 21, 0, 0,
490
- 43, 0, 43, 0, 43, 0, 43, 0,
491
- 43, 0, 43, 0, 43, 0, 43, 0,
492
- 43, 0, 43, 0, 43, 0, 43, 0,
493
- 43, 0, 0, 43, 0, 43, 0, 43,
494
- 0, 43, 0, 43, 0, 43, 0, 43,
495
- 144, 57, 54, 0, 54, 0, 78, 33,
496
- 84, 78, 84, 84, 84, 84, 84, 84,
497
- 84, 0, 0, 54, 0, 0, 54, 0,
498
- 0, 54, 0, 0, 54, 0, 0, 54,
499
- 0, 0, 54, 0, 0, 54, 0, 0,
500
- 54, 0, 0, 54, 0, 0, 54, 0,
501
- 0, 54, 0, 0, 54, 0, 0, 54,
502
- 0, 0, 54, 19, 0, 54, 19, 0,
503
- 54, 0, 0, 54, 0, 0, 54, 0,
504
- 0, 54, 0, 0, 54, 0, 0, 54,
505
- 0, 0, 54, 0, 0, 54, 0, 0,
506
- 54, 0, 0, 54, 0, 0, 54, 0,
507
- 0, 54, 0, 0, 54, 0, 0, 54,
508
- 0, 0, 54, 0, 0, 54, 0, 0,
509
- 54, 0, 0, 54, 19, 0, 54, 0,
510
- 0, 54, 0, 0, 54, 0, 0, 54,
511
- 0, 0, 54, 0, 0, 144, 57, 54,
512
- 0, 54, 0, 75, 33, 84, 75, 84,
513
- 84, 84, 84, 84, 84, 84, 0, 0,
514
- 54, 0, 0, 54, 0, 0, 54, 0,
515
- 0, 54, 0, 0, 54, 0, 0, 54,
516
- 0, 0, 54, 0, 0, 54, 0, 0,
517
- 54, 0, 0, 54, 0, 0, 54, 0,
518
- 0, 54, 0, 0, 54, 0, 0, 54,
519
- 17, 0, 54, 17, 0, 54, 0, 0,
520
- 54, 0, 0, 0, 54, 17, 0, 54,
521
- 0, 0, 54, 0, 0, 54, 0, 0,
522
- 54, 0, 0, 54, 0, 0, 54, 0,
523
- 0, 54, 0, 0, 54, 0, 0, 54,
524
- 0, 0, 54, 0, 0, 54, 0, 0,
525
- 54, 0, 0, 54, 0, 0, 54, 0,
526
- 0, 54, 0, 0, 54, 0, 17, 0,
527
- 54, 0, 0, 54, 0, 0, 54, 0,
528
- 0, 54, 0, 0, 54, 0, 0, 54,
529
- 0, 0, 54, 0, 0, 54, 0, 0,
530
- 54, 0, 0, 54, 0, 0, 0, 43,
531
- 0, 43, 0, 43, 0, 43, 0, 43,
532
- 0, 43, 144, 57, 54, 0, 54, 0,
533
- 69, 33, 69, 84, 84, 84, 84, 0,
534
- 0, 54, 0, 0, 54, 0, 0, 54,
535
- 0, 0, 54, 0, 0, 54, 0, 0,
536
- 54, 0, 0, 54, 0, 0, 54, 0,
537
- 0, 54, 0, 0, 54, 0, 0, 54,
538
- 0, 0, 54, 0, 0, 54, 0, 0,
539
- 54, 13, 0, 54, 0, 0, 54, 13,
540
- 0, 54, 0, 0, 54, 0, 0, 54,
541
- 0, 0, 54, 0, 0, 54, 0, 0,
542
- 54, 0, 0, 54, 0, 0, 54, 0,
543
- 0, 54, 0, 0, 54, 0, 0, 54,
544
- 0, 0, 54, 0, 13, 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, 0, 0, 54, 0,
548
- 0, 54, 0, 0, 0, 0, 0, 43,
549
- 54, 37, 37, 87, 37, 37, 43, 0,
550
- 39, 0, 43, 0, 0, 54, 0, 0,
551
- 39, 0, 0, 54, 0, 93, 90, 41,
552
- 96, 90, 96, 96, 96, 96, 96, 96,
553
- 96, 96, 99, 0, 43, 54, 0, 0,
554
- 54, 0, 0, 54, 0, 0, 54, 0,
555
- 0, 54, 0, 0, 54, 0, 0, 54,
556
- 0, 0, 54, 0, 0, 54, 0, 0,
557
- 54, 0, 0, 54, 0, 0, 54, 0,
558
- 0, 54, 0, 0, 54, 0, 0, 54,
559
- 0, 0, 54, 0, 0, 54, 0, 0,
560
- 54, 0, 15, 0, 54, 0, 0, 54,
561
- 0, 0, 54, 0, 0, 54, 0, 0,
562
- 54, 0, 0, 54, 15, 0, 54, 0,
563
- 0, 54, 0, 0, 54, 0, 0, 54,
564
- 0, 0, 54, 0, 0, 0, 43, 0,
565
- 0
566
- };
567
-
568
- static const unsigned char _lexer_eof_actions[] = {
569
- 0, 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, 43, 43, 43, 43, 43, 43, 43,
589
- 43, 43, 43, 43, 43, 43, 43, 43,
590
- 43, 43, 43, 43, 43, 43, 43, 43,
591
- 43, 43, 43, 43, 43, 43, 43, 43,
592
- 43, 43, 43, 43, 43, 43, 43, 43,
593
- 43, 43, 43, 43, 43, 43, 43, 43,
594
- 43, 43, 43, 43, 43, 43, 43, 43,
595
- 43, 43, 43, 43, 43, 43, 43, 43,
596
- 43, 43, 43, 43, 43, 43, 43, 43,
597
- 43, 43, 43, 43, 43, 43, 43, 43,
598
- 43, 43, 43, 43, 43, 43, 43, 43,
599
- 43, 43, 43, 43, 43, 43, 43, 43,
600
- 43, 43, 43, 43, 43, 43, 43, 43,
601
- 43, 43, 43, 43, 43, 43, 43, 43,
602
- 43, 43, 43, 43
603
- };
604
-
605
- static const int lexer_start = 1;
606
- static const int lexer_first_final = 267;
607
- static const int lexer_error = 0;
608
-
609
- static const int lexer_en_main = 1;
610
-
611
-
612
- #line 258 "ragel/i18n/en_lol.c.rl"
613
-
614
- static VALUE
615
- unindent(VALUE con, int start_col)
616
- {
617
- VALUE re;
618
- /* Gherkin will crash gracefully if the string representation of start_col pushes the pattern past 32 characters */
619
- char pat[32];
620
- snprintf(pat, 32, "^[\t ]{0,%d}", start_col);
621
- re = rb_reg_regcomp(rb_str_new2(pat));
622
- rb_funcall(con, rb_intern("gsub!"), 2, re, rb_str_new2(""));
623
-
624
- return Qnil;
625
-
626
- }
627
-
628
- static void
629
- store_kw_con(VALUE listener, const char * event_name,
630
- const char * keyword_at, size_t keyword_length,
631
- const char * at, size_t length,
632
- int current_line)
633
- {
634
- VALUE con = Qnil, kw = Qnil;
635
- kw = ENCODED_STR_NEW(keyword_at, keyword_length);
636
- con = ENCODED_STR_NEW(at, length);
637
- rb_funcall(con, rb_intern("strip!"), 0);
638
- rb_funcall(listener, rb_intern(event_name), 3, kw, con, INT2FIX(current_line));
639
- }
640
-
641
- static void
642
- store_multiline_kw_con(VALUE listener, const char * event_name,
643
- const char * keyword_at, size_t keyword_length,
644
- const char * at, size_t length,
645
- int current_line, int start_col)
646
- {
647
- VALUE split;
648
- VALUE con = Qnil, kw = Qnil, name = Qnil, desc = Qnil;
649
-
650
- kw = ENCODED_STR_NEW(keyword_at, keyword_length);
651
- con = ENCODED_STR_NEW(at, length);
652
-
653
- unindent(con, start_col);
654
-
655
- split = rb_str_split(con, "\n");
656
-
657
- name = rb_funcall(split, rb_intern("shift"), 0);
658
- desc = rb_ary_join(split, rb_str_new2( "\n" ));
659
-
660
- if( name == Qnil )
661
- {
662
- name = rb_str_new2("");
663
- }
664
- if( rb_funcall(desc, rb_intern("size"), 0) == 0)
665
- {
666
- desc = rb_str_new2("");
667
- }
668
- rb_funcall(name, rb_intern("strip!"), 0);
669
- rb_funcall(desc, rb_intern("rstrip!"), 0);
670
- rb_funcall(listener, rb_intern(event_name), 4, kw, name, desc, INT2FIX(current_line));
671
- }
672
-
673
- static void
674
- store_attr(VALUE listener, const char * attr_type,
675
- const char * at, size_t length,
676
- int line)
677
- {
678
- VALUE val = ENCODED_STR_NEW(at, length);
679
- rb_funcall(listener, rb_intern(attr_type), 2, val, INT2FIX(line));
680
- }
681
- static void
682
- store_docstring_content(VALUE listener,
683
- int start_col,
684
- const char *type_at, size_t type_length,
685
- const char *at, size_t length,
686
- int current_line)
687
- {
688
- VALUE re2;
689
- VALUE unescape_escaped_quotes;
690
- VALUE con = ENCODED_STR_NEW(at, length);
691
- VALUE con_type = ENCODED_STR_NEW(type_at, type_length);
692
-
693
- unindent(con, start_col);
694
-
695
- re2 = rb_reg_regcomp(rb_str_new2("\r\\Z"));
696
- unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\""));
697
- rb_funcall(con, rb_intern("sub!"), 2, re2, rb_str_new2(""));
698
- rb_funcall(con_type, rb_intern("strip!"), 0);
699
- rb_funcall(con, rb_intern("gsub!"), 2, unescape_escaped_quotes, rb_str_new2("\"\"\""));
700
- rb_funcall(listener, rb_intern("doc_string"), 3, con_type, con, INT2FIX(current_line));
701
- }
702
- static void
703
- raise_lexer_error(const char * at, int line)
704
- {
705
- rb_raise(rb_eGherkinLexingError, "Lexing error on line %d: '%s'. See http://wiki.github.com/cucumber/gherkin/lexingerror for more information.", line, at);
706
- }
707
-
708
- static void lexer_init(lexer_state *lexer) {
709
- lexer->content_start = 0;
710
- lexer->content_end = 0;
711
- lexer->content_len = 0;
712
- lexer->docstring_content_type_start = 0;
713
- lexer->docstring_content_type_end = 0;
714
- lexer->mark = 0;
715
- lexer->keyword_start = 0;
716
- lexer->keyword_end = 0;
717
- lexer->next_keyword_start = 0;
718
- lexer->line_number = 1;
719
- lexer->last_newline = 0;
720
- lexer->final_newline = 0;
721
- lexer->start_col = 0;
722
- }
723
-
724
- static VALUE CLexer_alloc(VALUE klass)
725
- {
726
- VALUE obj;
727
- lexer_state *lxr = ALLOC(lexer_state);
728
- lexer_init(lxr);
729
-
730
- obj = Data_Wrap_Struct(klass, NULL, -1, lxr);
731
-
732
- return obj;
733
- }
734
-
735
- static VALUE CLexer_init(VALUE self, VALUE listener)
736
- {
737
- lexer_state *lxr;
738
- rb_iv_set(self, "@listener", listener);
739
-
740
- lxr = NULL;
741
- DATA_GET(self, lexer_state, lxr);
742
- lexer_init(lxr);
743
-
744
- return self;
745
- }
746
-
747
- static VALUE CLexer_scan(VALUE self, VALUE input)
748
- {
749
- VALUE input_copy;
750
- char *data;
751
- size_t len;
752
- VALUE listener = rb_iv_get(self, "@listener");
753
-
754
- lexer_state *lexer;
755
- lexer = NULL;
756
- DATA_GET(self, lexer_state, lexer);
757
-
758
- input_copy = rb_str_dup(input);
759
-
760
- rb_str_append(input_copy, rb_str_new2("\n%_FEATURE_END_%"));
761
- data = RSTRING_PTR(input_copy);
762
- len = RSTRING_LEN(input_copy);
763
-
764
- if (len == 0) {
765
- rb_raise(rb_eGherkinLexingError, "No content to lex.");
766
- } else {
767
-
768
- const char *p, *pe, *eof;
769
- int cs = 0;
770
-
771
- VALUE current_row = Qnil;
772
-
773
- p = data;
774
- pe = data + len;
775
- eof = pe;
776
-
777
- assert(*pe == '\0' && "pointer does not end on NULL");
778
-
779
-
780
- #line 781 "ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c"
781
- {
782
- cs = lexer_start;
783
- }
784
-
785
- #line 425 "ragel/i18n/en_lol.c.rl"
786
-
787
- #line 788 "ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c"
788
- {
789
- int _klen;
790
- unsigned int _trans;
791
- const char *_acts;
792
- unsigned int _nacts;
793
- const char *_keys;
794
-
795
- if ( p == pe )
796
- goto _test_eof;
797
- if ( cs == 0 )
798
- goto _out;
799
- _resume:
800
- _keys = _lexer_trans_keys + _lexer_key_offsets[cs];
801
- _trans = _lexer_index_offsets[cs];
802
-
803
- _klen = _lexer_single_lengths[cs];
804
- if ( _klen > 0 ) {
805
- const char *_lower = _keys;
806
- const char *_mid;
807
- const char *_upper = _keys + _klen - 1;
808
- while (1) {
809
- if ( _upper < _lower )
810
- break;
811
-
812
- _mid = _lower + ((_upper-_lower) >> 1);
813
- if ( (*p) < *_mid )
814
- _upper = _mid - 1;
815
- else if ( (*p) > *_mid )
816
- _lower = _mid + 1;
817
- else {
818
- _trans += (unsigned int)(_mid - _keys);
819
- goto _match;
820
- }
821
- }
822
- _keys += _klen;
823
- _trans += _klen;
824
- }
825
-
826
- _klen = _lexer_range_lengths[cs];
827
- if ( _klen > 0 ) {
828
- const char *_lower = _keys;
829
- const char *_mid;
830
- const char *_upper = _keys + (_klen<<1) - 2;
831
- while (1) {
832
- if ( _upper < _lower )
833
- break;
834
-
835
- _mid = _lower + (((_upper-_lower) >> 1) & ~1);
836
- if ( (*p) < _mid[0] )
837
- _upper = _mid - 2;
838
- else if ( (*p) > _mid[1] )
839
- _lower = _mid + 2;
840
- else {
841
- _trans += (unsigned int)((_mid - _keys)>>1);
842
- goto _match;
843
- }
844
- }
845
- _trans += _klen;
846
- }
847
-
848
- _match:
849
- cs = _lexer_trans_targs[_trans];
850
-
851
- if ( _lexer_trans_actions[_trans] == 0 )
852
- goto _again;
853
-
854
- _acts = _lexer_actions + _lexer_trans_actions[_trans];
855
- _nacts = (unsigned int) *_acts++;
856
- while ( _nacts-- > 0 )
857
- {
858
- switch ( *_acts++ )
859
- {
860
- case 0:
861
- #line 83 "ragel/i18n/en_lol.c.rl"
862
- {
863
- MARK(content_start, p);
864
- lexer->current_line = lexer->line_number;
865
- lexer->start_col = lexer->content_start - lexer->last_newline - (lexer->keyword_end - lexer->keyword_start) + 2;
866
- }
867
- break;
868
- case 1:
869
- #line 89 "ragel/i18n/en_lol.c.rl"
870
- {
871
- MARK(content_start, p);
872
- }
873
- break;
874
- case 2:
875
- #line 93 "ragel/i18n/en_lol.c.rl"
876
- {
877
- lexer->current_line = lexer->line_number;
878
- lexer->start_col = p - data - lexer->last_newline;
879
- }
880
- break;
881
- case 3:
882
- #line 98 "ragel/i18n/en_lol.c.rl"
883
- {
884
- int len = LEN(content_start, PTR_TO(final_newline));
885
- int type_len = LEN(docstring_content_type_start, PTR_TO(docstring_content_type_end));
886
-
887
- if (len < 0) len = 0;
888
- if (type_len < 0) len = 0;
889
-
890
- store_docstring_content(listener, lexer->start_col, PTR_TO(docstring_content_type_start), type_len, PTR_TO(content_start), len, lexer->current_line);
891
- }
892
- break;
893
- case 4:
894
- #line 108 "ragel/i18n/en_lol.c.rl"
895
- {
896
- MARK(docstring_content_type_start, p);
897
- }
898
- break;
899
- case 5:
900
- #line 112 "ragel/i18n/en_lol.c.rl"
901
- {
902
- MARK(docstring_content_type_end, p);
903
- }
904
- break;
905
- case 6:
906
- #line 116 "ragel/i18n/en_lol.c.rl"
907
- {
908
- STORE_KW_END_CON(feature);
909
- }
910
- break;
911
- case 7:
912
- #line 120 "ragel/i18n/en_lol.c.rl"
913
- {
914
- STORE_KW_END_CON(background);
915
- }
916
- break;
917
- case 8:
918
- #line 124 "ragel/i18n/en_lol.c.rl"
919
- {
920
- STORE_KW_END_CON(scenario);
921
- }
922
- break;
923
- case 9:
924
- #line 128 "ragel/i18n/en_lol.c.rl"
925
- {
926
- STORE_KW_END_CON(scenario_outline);
927
- }
928
- break;
929
- case 10:
930
- #line 132 "ragel/i18n/en_lol.c.rl"
931
- {
932
- STORE_KW_END_CON(examples);
933
- }
934
- break;
935
- case 11:
936
- #line 136 "ragel/i18n/en_lol.c.rl"
937
- {
938
- store_kw_con(listener, "step",
939
- PTR_TO(keyword_start), LEN(keyword_start, PTR_TO(keyword_end)),
940
- PTR_TO(content_start), LEN(content_start, p),
941
- lexer->current_line);
942
- }
943
- break;
944
- case 12:
945
- #line 143 "ragel/i18n/en_lol.c.rl"
946
- {
947
- STORE_ATTR(comment);
948
- lexer->mark = 0;
949
- }
950
- break;
951
- case 13:
952
- #line 148 "ragel/i18n/en_lol.c.rl"
953
- {
954
- STORE_ATTR(tag);
955
- lexer->mark = 0;
956
- }
957
- break;
958
- case 14:
959
- #line 153 "ragel/i18n/en_lol.c.rl"
960
- {
961
- lexer->line_number += 1;
962
- MARK(final_newline, p);
963
- }
964
- break;
965
- case 15:
966
- #line 158 "ragel/i18n/en_lol.c.rl"
967
- {
968
- MARK(last_newline, p + 1);
969
- }
970
- break;
971
- case 16:
972
- #line 162 "ragel/i18n/en_lol.c.rl"
973
- {
974
- if (lexer->mark == 0) {
975
- MARK(mark, p);
976
- }
977
- }
978
- break;
979
- case 17:
980
- #line 168 "ragel/i18n/en_lol.c.rl"
981
- {
982
- MARK(keyword_end, p);
983
- MARK(keyword_start, PTR_TO(mark));
984
- MARK(content_start, p + 1);
985
- lexer->mark = 0;
986
- }
987
- break;
988
- case 18:
989
- #line 175 "ragel/i18n/en_lol.c.rl"
990
- {
991
- MARK(content_end, p);
992
- }
993
- break;
994
- case 19:
995
- #line 179 "ragel/i18n/en_lol.c.rl"
996
- {
997
- p = p - 1;
998
- lexer->current_line = lexer->line_number;
999
- current_row = rb_ary_new();
1000
- }
1001
- break;
1002
- case 20:
1003
- #line 185 "ragel/i18n/en_lol.c.rl"
1004
- {
1005
- MARK(content_start, p);
1006
- }
1007
- break;
1008
- case 21:
1009
- #line 189 "ragel/i18n/en_lol.c.rl"
1010
- {
1011
- VALUE re_pipe, re_newline, re_backslash;
1012
- VALUE con = ENCODED_STR_NEW(PTR_TO(content_start), LEN(content_start, p));
1013
- rb_funcall(con, rb_intern("strip!"), 0);
1014
- re_pipe = rb_reg_regcomp(rb_str_new2("\\\\\\|"));
1015
- re_newline = rb_reg_regcomp(rb_str_new2("\\\\n"));
1016
- re_backslash = rb_reg_regcomp(rb_str_new2("\\\\\\\\"));
1017
- rb_funcall(con, rb_intern("gsub!"), 2, re_pipe, rb_str_new2("|"));
1018
- rb_funcall(con, rb_intern("gsub!"), 2, re_newline, rb_str_new2("\n"));
1019
- rb_funcall(con, rb_intern("gsub!"), 2, re_backslash, rb_str_new2("\\"));
1020
-
1021
- rb_ary_push(current_row, con);
1022
- }
1023
- break;
1024
- case 22:
1025
- #line 203 "ragel/i18n/en_lol.c.rl"
1026
- {
1027
- rb_funcall(listener, rb_intern("row"), 2, current_row, INT2FIX(lexer->current_line));
1028
- }
1029
- break;
1030
- case 23:
1031
- #line 207 "ragel/i18n/en_lol.c.rl"
1032
- {
1033
- int line;
1034
- if (cs < lexer_first_final) {
1035
- size_t count = 0;
1036
- VALUE newstr_val;
1037
- char *newstr;
1038
- int newstr_count = 0;
1039
- size_t len;
1040
- const char *buff;
1041
- if (lexer->last_newline != 0) {
1042
- len = LEN(last_newline, eof);
1043
- buff = PTR_TO(last_newline);
1044
- } else {
1045
- len = strlen(data);
1046
- buff = data;
1047
- }
1048
-
1049
- /* Allocate as a ruby string so that it gets cleaned up by GC */
1050
- newstr_val = rb_str_new(buff, len);
1051
- newstr = RSTRING_PTR(newstr_val);
1052
-
1053
-
1054
- for (count = 0; count < len; count++) {
1055
- if(buff[count] == 10) {
1056
- newstr[newstr_count] = '\0'; /* terminate new string at first newline found */
1057
- break;
1058
- } else {
1059
- if (buff[count] == '%') {
1060
- newstr[newstr_count++] = buff[count];
1061
- newstr[newstr_count] = buff[count];
1062
- } else {
1063
- newstr[newstr_count] = buff[count];
1064
- }
1065
- }
1066
- newstr_count++;
1067
- }
1068
-
1069
- line = lexer->line_number;
1070
- lexer_init(lexer); /* Re-initialize so we can scan again with the same lexer */
1071
- raise_lexer_error(newstr, line);
1072
- } else {
1073
- rb_funcall(listener, rb_intern("eof"), 0);
1074
- }
1075
- }
1076
- break;
1077
- #line 1078 "ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c"
1078
- }
1079
- }
1080
-
1081
- _again:
1082
- if ( cs == 0 )
1083
- goto _out;
1084
- if ( ++p != pe )
1085
- goto _resume;
1086
- _test_eof: {}
1087
- if ( p == eof )
1088
- {
1089
- const char *__acts = _lexer_actions + _lexer_eof_actions[cs];
1090
- unsigned int __nacts = (unsigned int) *__acts++;
1091
- while ( __nacts-- > 0 ) {
1092
- switch ( *__acts++ ) {
1093
- case 23:
1094
- #line 207 "ragel/i18n/en_lol.c.rl"
1095
- {
1096
- int line;
1097
- if (cs < lexer_first_final) {
1098
- size_t count = 0;
1099
- VALUE newstr_val;
1100
- char *newstr;
1101
- int newstr_count = 0;
1102
- size_t len;
1103
- const char *buff;
1104
- if (lexer->last_newline != 0) {
1105
- len = LEN(last_newline, eof);
1106
- buff = PTR_TO(last_newline);
1107
- } else {
1108
- len = strlen(data);
1109
- buff = data;
1110
- }
1111
-
1112
- /* Allocate as a ruby string so that it gets cleaned up by GC */
1113
- newstr_val = rb_str_new(buff, len);
1114
- newstr = RSTRING_PTR(newstr_val);
1115
-
1116
-
1117
- for (count = 0; count < len; count++) {
1118
- if(buff[count] == 10) {
1119
- newstr[newstr_count] = '\0'; /* terminate new string at first newline found */
1120
- break;
1121
- } else {
1122
- if (buff[count] == '%') {
1123
- newstr[newstr_count++] = buff[count];
1124
- newstr[newstr_count] = buff[count];
1125
- } else {
1126
- newstr[newstr_count] = buff[count];
1127
- }
1128
- }
1129
- newstr_count++;
1130
- }
1131
-
1132
- line = lexer->line_number;
1133
- lexer_init(lexer); /* Re-initialize so we can scan again with the same lexer */
1134
- raise_lexer_error(newstr, line);
1135
- } else {
1136
- rb_funcall(listener, rb_intern("eof"), 0);
1137
- }
1138
- }
1139
- break;
1140
- #line 1141 "ext/gherkin_lexer_en_lol/gherkin_lexer_en_lol.c"
1141
- }
1142
- }
1143
- }
1144
-
1145
- _out: {}
1146
- }
1147
-
1148
- #line 426 "ragel/i18n/en_lol.c.rl"
1149
-
1150
- assert(p <= pe && "data overflow after parsing execute");
1151
- assert(lexer->content_start <= len && "content starts after data end");
1152
- assert(lexer->mark < len && "mark is after data end");
1153
-
1154
- /* Reset lexer by re-initializing the whole thing */
1155
- lexer_init(lexer);
1156
-
1157
- if (cs == lexer_error) {
1158
- rb_raise(rb_eGherkinLexingError, "Invalid format, lexing fails.");
1159
- } else {
1160
- return Qtrue;
1161
- }
1162
- }
1163
- }
1164
-
1165
- void Init_gherkin_lexer_en_lol()
1166
- {
1167
- mGherkin = rb_define_module("Gherkin");
1168
- mGherkinLexer = rb_define_module_under(mGherkin, "Lexer");
1169
- rb_eGherkinLexingError = rb_const_get(mGherkinLexer, rb_intern("LexingError"));
1170
-
1171
- mCLexer = rb_define_module_under(mGherkin, "CLexer");
1172
- cI18nLexer = rb_define_class_under(mCLexer, "En_lol", rb_cObject);
1173
- rb_define_alloc_func(cI18nLexer, CLexer_alloc);
1174
- rb_define_method(cI18nLexer, "initialize", CLexer_init, 1);
1175
- rb_define_method(cI18nLexer, "scan", CLexer_scan, 1);
1176
- }
1177
-