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