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