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