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