tranp 0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. bin/_input.sh +4 -0
  2. bin/analyze.sh +7 -0
  3. bin/ast.sh +13 -0
  4. bin/cache.sh +8 -0
  5. bin/ci-test.sh +8 -0
  6. bin/gram.sh +7 -0
  7. bin/instrument.sh +29 -0
  8. bin/j2.sh +7 -0
  9. bin/test.sh +66 -0
  10. bin/transpile.sh +7 -0
  11. data/cpp/template/assign/anno_assign.j2 +5 -0
  12. data/cpp/template/assign/aug_assign.j2 +1 -0
  13. data/cpp/template/assign/move_assign.j2 +1 -0
  14. data/cpp/template/assign/move_assign_declare.j2 +7 -0
  15. data/cpp/template/assign/move_assign_destruction.j2 +1 -0
  16. data/cpp/template/assign/move_assign_dict.j2 +1 -0
  17. data/cpp/template/block/entrypoint.j2 +8 -0
  18. data/cpp/template/class/_accessor.j2 +1 -0
  19. data/cpp/template/class/_after.j2 +0 -0
  20. data/cpp/template/class/_before.j2 +0 -0
  21. data/cpp/template/class/_classify.j2 +7 -0
  22. data/cpp/template/class/_comment.j2 +1 -0
  23. data/cpp/template/class/_constructor_inherits.j2 +7 -0
  24. data/cpp/template/class/_decl_class_var.j2 +1 -0
  25. data/cpp/template/class/_decl_this_var.j2 +1 -0
  26. data/cpp/template/class/_decorators.j2 +0 -0
  27. data/cpp/template/class/_definition_class.j2 +1 -0
  28. data/cpp/template/class/_definition_enum.j2 +1 -0
  29. data/cpp/template/class/_inherits.j2 +11 -0
  30. data/cpp/template/class/_post_definition.j2 +0 -0
  31. data/cpp/template/class/_prepare.j2 +1 -0
  32. data/cpp/template/class/_statements.j2 +5 -0
  33. data/cpp/template/class/_statements_enum.j2 +12 -0
  34. data/cpp/template/class/_template_types.j2 +4 -0
  35. data/cpp/template/class/alt_class.j2 +1 -0
  36. data/cpp/template/class/class.j2 +17 -0
  37. data/cpp/template/class/enum.j2 +10 -0
  38. data/cpp/template/class/template_class.j2 +5 -0
  39. data/cpp/template/comp/_assign_dict.j2 +1 -0
  40. data/cpp/template/comp/comp_for.j2 +6 -0
  41. data/cpp/template/comp/comp_for_enumerate.j2 +2 -0
  42. data/cpp/template/comp/comp_for_range.j2 +2 -0
  43. data/cpp/template/comp/dict_comp.j2 +16 -0
  44. data/cpp/template/comp/list_comp.j2 +13 -0
  45. data/cpp/template/element/decorator.j2 +1 -0
  46. data/cpp/template/element/param_type.j2 +1 -0
  47. data/cpp/template/element/parameter.j2 +1 -0
  48. data/cpp/template/expression/argument.j2 +5 -0
  49. data/cpp/template/expression/elipsis.j2 +0 -0
  50. data/cpp/template/expression/group.j2 +1 -0
  51. data/cpp/template/flow/catch.j2 +8 -0
  52. data/cpp/template/flow/for/default.j2 +8 -0
  53. data/cpp/template/flow/for/dict.j2 +8 -0
  54. data/cpp/template/flow/for/enumerate.j2 +9 -0
  55. data/cpp/template/flow/for/range.j2 +7 -0
  56. data/cpp/template/flow/if/else.j2 +6 -0
  57. data/cpp/template/flow/if/else_if.j2 +7 -0
  58. data/cpp/template/flow/if/if.j2 +29 -0
  59. data/cpp/template/flow/try.j2 +12 -0
  60. data/cpp/template/flow/while.j2 +7 -0
  61. data/cpp/template/flow/with.j2 +2 -0
  62. data/cpp/template/flow/with_entry.j2 +2 -0
  63. data/cpp/template/func_call/__py_copy__.j2 +1 -0
  64. data/cpp/template/func_call/_str_format.j2 +15 -0
  65. data/cpp/template/func_call/c_func_invoke.j2 +5 -0
  66. data/cpp/template/func_call/c_func_ref.j2 +1 -0
  67. data/cpp/template/func_call/c_include.j2 +1 -0
  68. data/cpp/template/func_call/c_macro.j2 +1 -0
  69. data/cpp/template/func_call/c_pragma.j2 +1 -0
  70. data/cpp/template/func_call/c_type_expr.j2 +1 -0
  71. data/cpp/template/func_call/cast_bin_to_bin.j2 +10 -0
  72. data/cpp/template/func_call/cast_bin_to_str.j2 +5 -0
  73. data/cpp/template/func_call/cast_char.j2 +5 -0
  74. data/cpp/template/func_call/cast_enum.j2 +2 -0
  75. data/cpp/template/func_call/cast_list.j2 +1 -0
  76. data/cpp/template/func_call/cast_str_to_bin.j2 +7 -0
  77. data/cpp/template/func_call/cast_str_to_str.j2 +1 -0
  78. data/cpp/template/func_call/cvar_as_a.j2 +5 -0
  79. data/cpp/template/func_call/cvar_copy.j2 +1 -0
  80. data/cpp/template/func_call/cvar_down.j2 +5 -0
  81. data/cpp/template/func_call/cvar_move.j2 +1 -0
  82. data/cpp/template/func_call/cvar_new_addr.j2 +1 -0
  83. data/cpp/template/func_call/cvar_new_smart.j2 +5 -0
  84. data/cpp/template/func_call/cvar_new_smart_list.j2 +5 -0
  85. data/cpp/template/func_call/cvar_self_to_raw.j2 +1 -0
  86. data/cpp/template/func_call/cvar_smart_empty.j2 +5 -0
  87. data/cpp/template/func_call/cvar_to.j2 +9 -0
  88. data/cpp/template/func_call/cvar_to_addr_hex.j2 +1 -0
  89. data/cpp/template/func_call/cvar_to_addr_id.j2 +5 -0
  90. data/cpp/template/func_call/default.j2 +1 -0
  91. data/cpp/template/func_call/dict_copy.j2 +1 -0
  92. data/cpp/template/func_call/dict_get.j2 +1 -0
  93. data/cpp/template/func_call/dict_items.j2 +1 -0
  94. data/cpp/template/func_call/dict_keys.j2 +7 -0
  95. data/cpp/template/func_call/dict_pop.j2 +5 -0
  96. data/cpp/template/func_call/dict_values.j2 +7 -0
  97. data/cpp/template/func_call/generic_call.j2 +1 -0
  98. data/cpp/template/func_call/len.j2 +5 -0
  99. data/cpp/template/func_call/list_copy.j2 +1 -0
  100. data/cpp/template/func_call/list_extend.j2 +1 -0
  101. data/cpp/template/func_call/list_insert.j2 +1 -0
  102. data/cpp/template/func_call/list_pop.j2 +6 -0
  103. data/cpp/template/func_call/list_sort.j2 +16 -0
  104. data/cpp/template/func_call/print.j2 +1 -0
  105. data/cpp/template/func_call/str_count.j2 +1 -0
  106. data/cpp/template/func_call/str_encode.j2 +5 -0
  107. data/cpp/template/func_call/str_endswith.j2 +1 -0
  108. data/cpp/template/func_call/str_find.j2 +1 -0
  109. data/cpp/template/func_call/str_format.j2 +2 -0
  110. data/cpp/template/func_call/str_join.j2 +1 -0
  111. data/cpp/template/func_call/str_lstrip.j2 +1 -0
  112. data/cpp/template/func_call/str_replace.j2 +1 -0
  113. data/cpp/template/func_call/str_rfind.j2 +1 -0
  114. data/cpp/template/func_call/str_rstrip.j2 +1 -0
  115. data/cpp/template/func_call/str_split.j2 +1 -0
  116. data/cpp/template/func_call/str_startswith.j2 +1 -0
  117. data/cpp/template/func_call/str_strip.j2 +1 -0
  118. data/cpp/template/func_call/super.j2 +5 -0
  119. data/cpp/template/function/_accessor.j2 +9 -0
  120. data/cpp/template/function/_block.j2 +11 -0
  121. data/cpp/template/function/_block_constructor.j2 +21 -0
  122. data/cpp/template/function/_comment.j2 +1 -0
  123. data/cpp/template/function/_decorators.j2 +0 -0
  124. data/cpp/template/function/_initializer.j2 +17 -0
  125. data/cpp/template/function/_iterator_dict.j2 +18 -0
  126. data/cpp/template/function/_iterator_list.j2 +11 -0
  127. data/cpp/template/function/_iterator_list_complex.j2 +17 -0
  128. data/cpp/template/function/_method_body.j2 +9 -0
  129. data/cpp/template/function/_params.j2 +8 -0
  130. data/cpp/template/function/_return_type.j2 +1 -0
  131. data/cpp/template/function/_signature_common.j2 +1 -0
  132. data/cpp/template/function/_signature_constructor.j2 +1 -0
  133. data/cpp/template/function/_signature_prefix.j2 +1 -0
  134. data/cpp/template/function/_signature_suffix.j2 +1 -0
  135. data/cpp/template/function/_template_types.j2 +4 -0
  136. data/cpp/template/function/class_method.j2 +10 -0
  137. data/cpp/template/function/closure.j2 +2 -0
  138. data/cpp/template/function/constructor.j2 +10 -0
  139. data/cpp/template/function/copy_constructor.j2 +10 -0
  140. data/cpp/template/function/destructor.j2 +14 -0
  141. data/cpp/template/function/function.j2 +9 -0
  142. data/cpp/template/function/method.j2 +10 -0
  143. data/cpp/template/indexer/class.j2 +1 -0
  144. data/cpp/template/indexer/cvar.j2 +1 -0
  145. data/cpp/template/indexer/default.j2 +1 -0
  146. data/cpp/template/indexer/slice_array.j2 +10 -0
  147. data/cpp/template/indexer/slice_string.j2 +7 -0
  148. data/cpp/template/indexer/tuple.j2 +1 -0
  149. data/cpp/template/lambda/_lambda_params.j2 +5 -0
  150. data/cpp/template/lambda/default.j2 +7 -0
  151. data/cpp/template/literal/dict.j2 +9 -0
  152. data/cpp/template/literal/doc_string.j2 +34 -0
  153. data/cpp/template/literal/falsy.j2 +1 -0
  154. data/cpp/template/literal/float.j2 +1 -0
  155. data/cpp/template/literal/integer.j2 +1 -0
  156. data/cpp/template/literal/list.j2 +9 -0
  157. data/cpp/template/literal/list_spread.j2 +11 -0
  158. data/cpp/template/literal/null.j2 +1 -0
  159. data/cpp/template/literal/pair.j2 +1 -0
  160. data/cpp/template/literal/string.j2 +1 -0
  161. data/cpp/template/literal/truthy.j2 +1 -0
  162. data/cpp/template/literal/tuple.j2 +1 -0
  163. data/cpp/template/operation/binary_fill_list.j2 +5 -0
  164. data/cpp/template/operation/binary_in.j2 +9 -0
  165. data/cpp/template/operation/binary_operator.j2 +13 -0
  166. data/cpp/template/operation/ternary_operator.j2 +1 -0
  167. data/cpp/template/operation/unary_operator.j2 +1 -0
  168. data/cpp/template/reference/class_ref.j2 +1 -0
  169. data/cpp/template/reference/decl_this_var.j2 +1 -0
  170. data/cpp/template/reference/this_ref.j2 +1 -0
  171. data/cpp/template/reference/var.j2 +5 -0
  172. data/cpp/template/relay/cvar_to.j2 +11 -0
  173. data/cpp/template/relay/default.j2 +7 -0
  174. data/cpp/template/relay/literalize.j2 +5 -0
  175. data/cpp/template/statement/_delete.j2 +7 -0
  176. data/cpp/template/statement/assert.j2 +1 -0
  177. data/cpp/template/statement/break.j2 +1 -0
  178. data/cpp/template/statement/comment.j2 +1 -0
  179. data/cpp/template/statement/continue.j2 +1 -0
  180. data/cpp/template/statement/delete.j2 +4 -0
  181. data/cpp/template/statement/import.j2 +5 -0
  182. data/cpp/template/statement/import_i18n.j2 +1 -0
  183. data/cpp/template/statement/pass.j2 +0 -0
  184. data/cpp/template/statement/return.j2 +5 -0
  185. data/cpp/template/statement/throw.j2 +8 -0
  186. data/cpp/template/statement/yield.j2 +1 -0
  187. data/cpp/template/type/callable_type.j2 +2 -0
  188. data/cpp/template/type/custom_type.j2 +28 -0
  189. data/cpp/template/type/dict_type.j2 +2 -0
  190. data/cpp/template/type/list_type.j2 +2 -0
  191. data/cpp/template/type/literal_dict_type.j2 +1 -0
  192. data/cpp/template/type/literal_type.j2 +1 -0
  193. data/cpp/template/type/null_type.j2 +1 -0
  194. data/cpp/template/type/pluck_method.j2 +2 -0
  195. data/cpp/template/type/relay_of_type.j2 +2 -0
  196. data/cpp/template/type/template.j2 +5 -0
  197. data/cpp/template/type/var_of_type.j2 +1 -0
  198. data/grammar.lark +370 -0
  199. data/i18n.yml +86 -0
  200. data/syntax/gram_rules.py +123 -0
  201. data/syntax/gram_tokenizer.py +15 -0
  202. data/syntax/py_rules.py +718 -0
  203. rogw/tranp/app/app.py +42 -0
  204. rogw/tranp/app/config.py +56 -0
  205. rogw/tranp/app/dir.py +12 -0
  206. rogw/tranp/app/dummy.py +44 -0
  207. rogw/tranp/app/env.py +52 -0
  208. rogw/tranp/app/loader.py +111 -0
  209. rogw/tranp/bin/analyze.py +480 -0
  210. rogw/tranp/bin/ast_check.py +233 -0
  211. rogw/tranp/bin/gram_check.py +176 -0
  212. rogw/tranp/bin/io.py +46 -0
  213. rogw/tranp/bin/j2_check.py +70 -0
  214. rogw/tranp/bin/transpile.py +478 -0
  215. rogw/tranp/cache/cache.py +268 -0
  216. rogw/tranp/cache/memo.py +84 -0
  217. rogw/tranp/cache/memo2.py +47 -0
  218. rogw/tranp/compatible/cpp/classes.py +25 -0
  219. rogw/tranp/compatible/cpp/convertion.py +47 -0
  220. rogw/tranp/compatible/cpp/cvar.py +625 -0
  221. rogw/tranp/compatible/cpp/function.py +58 -0
  222. rogw/tranp/compatible/cpp/preprocess.py +52 -0
  223. rogw/tranp/compatible/libralies/abc.py +4 -0
  224. rogw/tranp/compatible/libralies/binascii.py +1 -0
  225. rogw/tranp/compatible/libralies/classes.py +235 -0
  226. rogw/tranp/compatible/libralies/collections/abc.py +12 -0
  227. rogw/tranp/compatible/libralies/colorsys.py +2 -0
  228. rogw/tranp/compatible/libralies/datetime.py +21 -0
  229. rogw/tranp/compatible/libralies/enum.py +23 -0
  230. rogw/tranp/compatible/libralies/importlib.py +4 -0
  231. rogw/tranp/compatible/libralies/inspect.py +9 -0
  232. rogw/tranp/compatible/libralies/json.py +5 -0
  233. rogw/tranp/compatible/libralies/math.py +8 -0
  234. rogw/tranp/compatible/libralies/numpy.py +25 -0
  235. rogw/tranp/compatible/libralies/os.py +16 -0
  236. rogw/tranp/compatible/libralies/re.py +17 -0
  237. rogw/tranp/compatible/libralies/sys.py +3 -0
  238. rogw/tranp/compatible/libralies/type.py +1 -0
  239. rogw/tranp/compatible/libralies/types.py +5 -0
  240. rogw/tranp/compatible/libralies/typing.py +40 -0
  241. rogw/tranp/compatible/libralies/uuid.py +3 -0
  242. rogw/tranp/compatible/libralies/weakref.py +7 -0
  243. rogw/tranp/compatible/libralies/yaml.py +4 -0
  244. rogw/tranp/compatible/python/embed.py +238 -0
  245. rogw/tranp/compatible/python/types.py +10 -0
  246. rogw/tranp/data/meta/header.py +91 -0
  247. rogw/tranp/data/meta/types.py +39 -0
  248. rogw/tranp/data/version.py +13 -0
  249. rogw/tranp/dsn/dsn.py +124 -0
  250. rogw/tranp/dsn/module.py +164 -0
  251. rogw/tranp/dsn/translation.py +27 -0
  252. rogw/tranp/errors.py +31 -0
  253. rogw/tranp/file/loader.py +63 -0
  254. rogw/tranp/file/writer.py +46 -0
  255. rogw/tranp/i18n/i18n.py +57 -0
  256. rogw/tranp/implements/cpp/providers/i18n.py +18 -0
  257. rogw/tranp/implements/cpp/providers/view.py +19 -0
  258. rogw/tranp/implements/cpp/semantics/cvars.py +278 -0
  259. rogw/tranp/implements/cpp/transpiler/py2cpp.py +1830 -0
  260. rogw/tranp/implements/cpp/view/cpp_view_helper.py +216 -0
  261. rogw/tranp/implements/syntax/lark/entry.py +195 -0
  262. rogw/tranp/implements/syntax/lark/parser.py +179 -0
  263. rogw/tranp/implements/syntax/tranp/ast.py +234 -0
  264. rogw/tranp/implements/syntax/tranp/rule.py +742 -0
  265. rogw/tranp/implements/syntax/tranp/syntax.py +406 -0
  266. rogw/tranp/implements/syntax/tranp/token.py +382 -0
  267. rogw/tranp/implements/syntax/tranp/tokenizer.py +564 -0
  268. rogw/tranp/implements/transpiler/evaluator.py +261 -0
  269. rogw/tranp/lang/annotation.py +49 -0
  270. rogw/tranp/lang/comment.py +224 -0
  271. rogw/tranp/lang/convertion.py +30 -0
  272. rogw/tranp/lang/defer.py +93 -0
  273. rogw/tranp/lang/di.py +416 -0
  274. rogw/tranp/lang/dict.py +49 -0
  275. rogw/tranp/lang/error.py +77 -0
  276. rogw/tranp/lang/locator.py +56 -0
  277. rogw/tranp/lang/middleware.py +128 -0
  278. rogw/tranp/lang/module.py +92 -0
  279. rogw/tranp/lang/profile.py +37 -0
  280. rogw/tranp/lang/sequence.py +120 -0
  281. rogw/tranp/lang/string.py +49 -0
  282. rogw/tranp/lang/trace.py +60 -0
  283. rogw/tranp/lang/trait.py +132 -0
  284. rogw/tranp/lang/translator.py +16 -0
  285. rogw/tranp/lang/typehint.py +624 -0
  286. rogw/tranp/module/includer.py +33 -0
  287. rogw/tranp/module/loader.py +56 -0
  288. rogw/tranp/module/module.py +83 -0
  289. rogw/tranp/module/modules.py +121 -0
  290. rogw/tranp/module/types.py +26 -0
  291. rogw/tranp/providers/app.py +62 -0
  292. rogw/tranp/providers/cache.py +10 -0
  293. rogw/tranp/providers/module.py +113 -0
  294. rogw/tranp/providers/semantics.py +47 -0
  295. rogw/tranp/providers/syntax/ast.py +40 -0
  296. rogw/tranp/providers/syntax/entrypoints.py +50 -0
  297. rogw/tranp/providers/syntax/resolver.py +130 -0
  298. rogw/tranp/semantics/finder.py +285 -0
  299. rogw/tranp/semantics/procedure.py +263 -0
  300. rogw/tranp/semantics/processor.py +32 -0
  301. rogw/tranp/semantics/processors/expand_modules.py +197 -0
  302. rogw/tranp/semantics/processors/resolve_unknown.py +180 -0
  303. rogw/tranp/semantics/processors/restore_symbols.py +40 -0
  304. rogw/tranp/semantics/processors/store_symbols.py +32 -0
  305. rogw/tranp/semantics/processors/symbol_extends.py +161 -0
  306. rogw/tranp/semantics/reflection/base.py +228 -0
  307. rogw/tranp/semantics/reflection/db.py +214 -0
  308. rogw/tranp/semantics/reflection/definition.py +1 -0
  309. rogw/tranp/semantics/reflection/helper/naming.py +287 -0
  310. rogw/tranp/semantics/reflection/helper/template.py +472 -0
  311. rogw/tranp/semantics/reflection/interfaces.py +177 -0
  312. rogw/tranp/semantics/reflection/persistent.py +183 -0
  313. rogw/tranp/semantics/reflection/reflection.py +422 -0
  314. rogw/tranp/semantics/reflection/serialization.py +35 -0
  315. rogw/tranp/semantics/reflection/serializer.py +133 -0
  316. rogw/tranp/semantics/reflection/traits.py +475 -0
  317. rogw/tranp/semantics/reflections.py +709 -0
  318. rogw/tranp/syntax/ast/cache.py +97 -0
  319. rogw/tranp/syntax/ast/entry.py +150 -0
  320. rogw/tranp/syntax/ast/entrypoints.py +71 -0
  321. rogw/tranp/syntax/ast/finder.py +143 -0
  322. rogw/tranp/syntax/ast/parser.py +47 -0
  323. rogw/tranp/syntax/ast/path.py +186 -0
  324. rogw/tranp/syntax/ast/query.py +134 -0
  325. rogw/tranp/syntax/ast/resolver.py +114 -0
  326. rogw/tranp/syntax/node/accessible.py +43 -0
  327. rogw/tranp/syntax/node/behavior.py +34 -0
  328. rogw/tranp/syntax/node/definition/__init__.py +182 -0
  329. rogw/tranp/syntax/node/definition/accessible.py +83 -0
  330. rogw/tranp/syntax/node/definition/element.py +71 -0
  331. rogw/tranp/syntax/node/definition/expression.py +18 -0
  332. rogw/tranp/syntax/node/definition/general.py +51 -0
  333. rogw/tranp/syntax/node/definition/literal.py +173 -0
  334. rogw/tranp/syntax/node/definition/operator.py +94 -0
  335. rogw/tranp/syntax/node/definition/primary.py +883 -0
  336. rogw/tranp/syntax/node/definition/statement_compound.py +836 -0
  337. rogw/tranp/syntax/node/definition/statement_simple.py +184 -0
  338. rogw/tranp/syntax/node/definition/terminal.py +36 -0
  339. rogw/tranp/syntax/node/embed.py +229 -0
  340. rogw/tranp/syntax/node/interface.py +72 -0
  341. rogw/tranp/syntax/node/node.py +574 -0
  342. rogw/tranp/syntax/node/query.py +230 -0
  343. rogw/tranp/syntax/node/resolver.py +59 -0
  344. rogw/tranp/syntax/node/serializer.py +49 -0
  345. rogw/tranp/test/case_discovery.py +73 -0
  346. rogw/tranp/test/helper.py +35 -0
  347. rogw/tranp/test/validation.py +31 -0
  348. rogw/tranp/transpiler/middleware.py +73 -0
  349. rogw/tranp/transpiler/types.py +55 -0
  350. rogw/tranp/view/error_render.py +144 -0
  351. rogw/tranp/view/helper/block.py +371 -0
  352. rogw/tranp/view/helper/decorator.py +239 -0
  353. rogw/tranp/view/helper/helper.py +112 -0
  354. rogw/tranp/view/render.py +68 -0
  355. tranp-0.9.0.dist-info/METADATA +79 -0
  356. tranp-0.9.0.dist-info/RECORD +359 -0
  357. tranp-0.9.0.dist-info/WHEEL +5 -0
  358. tranp-0.9.0.dist-info/licenses/LICENCE +21 -0
  359. tranp-0.9.0.dist-info/top_level.txt +3 -0
bin/_input.sh ADDED
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ IFS= read -e input
4
+ echo "${input}"
bin/analyze.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ source ${cwd}/.env.sh
7
+ python ${appdir}/rogw/tranp/bin/analyze.py $*
bin/ast.sh ADDED
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ for arg in "$@"; do
7
+ if [ "${arg}" == "-v" ]; then
8
+ export TRANPVERBOSE=1
9
+ fi
10
+ done
11
+
12
+ source ${cwd}/.env.sh
13
+ python ${appdir}/rogw/tranp/bin/ast_check.py $*
bin/cache.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ if [ "$1" == "-d" ]; then
7
+ rm -fr ${appdir}/.cache/tranp
8
+ fi
bin/ci-test.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ source ${cwd}/.env.sh
7
+
8
+ pytest ${appdir}/tests/unit --cov rogw/ --ignore-glob=**/fixtures/*
bin/gram.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ source ${cwd}/.env.sh
7
+ python ${appdir}/rogw/tranp/bin/gram_check.py $*
bin/instrument.sh ADDED
@@ -0,0 +1,29 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ source ${cwd}/.env.sh
7
+
8
+ if [ "$1" != "-l" ]; then
9
+ echo '### Usage'
10
+ echo bin/profile.sh -l
11
+ echo bin/profile.sh -l '${query}'
12
+ exit
13
+ fi
14
+
15
+ target=$1
16
+ shift
17
+ peco_opt=
18
+ if [ "${1}" != "" -a "${1:0:1}" != "-" ]; then
19
+ peco_opt="--query ${1}"
20
+ shift
21
+ fi
22
+
23
+ target=$(find ./ -name 'test_*.py' | | egrep -v 'fixtures|vendor' | peco ${peco_opt})
24
+ target=$(echo "$target" | sed -e 's/^.\///g')
25
+ target=$(echo "$target" | sed -e 's/\//\./g')
26
+ target=$(echo "$target" | sed -e 's/\.py$//g')
27
+
28
+ echo python -m unittest ${target}
29
+ cd ${appdir} && ./vendor/bin/pyinstrument -m unittest ${target}
bin/j2.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ source ${cwd}/.env.sh
7
+ python ${appdir}/rogw/tranp/bin/j2_check.py $*
bin/test.sh ADDED
@@ -0,0 +1,66 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ if [ "$1" == "-h" ]; then
7
+ cat << EOS
8
+ # Usage
9
+ $ bin/test.sh [-l module_name] [-c case_name] [-v] [-p]
10
+ # Examples
11
+ $ bin/test.sh -l py2cpp
12
+ $ bin/test.sh -l reflections -c type_of
13
+ $ bin/test.sh -l py2cpp -v
14
+ $ bin/test.sh -l py2cpp -p
15
+ EOS
16
+ exit
17
+ fi
18
+
19
+ target=
20
+ if [ "$1" == "-l" ]; then
21
+ shift
22
+ peco_opt=
23
+ if [ "${1}" != "" -a "${1:0:1}" != "-" ]; then
24
+ peco_opt="--query ${1}"
25
+ shift
26
+ fi
27
+
28
+ module=$(find ./ -name 'test_*.py' | egrep -v 'fixtures|vendor' | peco ${peco_opt})
29
+ target=$(echo "$module" | sed -e 's/^.\///g')
30
+ target=$(echo "$target" | sed -e 's/\//\./g')
31
+ target=$(echo "$target" | sed -e 's/\.py$//g')
32
+
33
+ if [ "$1" == "-c" ]; then
34
+ shift
35
+ peco_opt=
36
+ if [ "${1}" != "" -a "${1:0:1}" != "-" ]; then
37
+ peco_opt="--query ${1}"
38
+ shift
39
+ fi
40
+
41
+ case=$(python ${appdir}/rogw/tranp/test/case_discovery.py ${module} | cat - | peco ${peco_opt})
42
+ target="${target}.${case}"
43
+ fi
44
+ fi
45
+
46
+ while [ $# -gt 0 ]; do
47
+ if [ "${1}" == "-v" ]; then
48
+ export TRANPVERBOSE=1
49
+ elif [ "${1}" == "-p" ]; then
50
+ export TRANPPROFILE=1
51
+ elif [ "${1}" == "--index" ]; then
52
+ shift
53
+ export TRANPTESTINDEX=$1
54
+ fi
55
+ shift
56
+ done
57
+
58
+ source ${cwd}/.env.sh
59
+
60
+ if [ "$target" == "" ]; then
61
+ echo python -m unittest discover ${appdir}/tests/
62
+ python -m unittest discover ${appdir}/tests/
63
+ else
64
+ echo python -m unittest ${target} ${profiler}
65
+ python -m unittest ${target} ${profiler}
66
+ fi
bin/transpile.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ cwd=$(cd $(dirname $0); pwd)
4
+ appdir=${cwd}/..
5
+
6
+ source ${cwd}/.env.sh
7
+ python ${appdir}/rogw/tranp/bin/transpile.py $*
@@ -0,0 +1,5 @@
1
+ {%- if is_initializer -%}
2
+ {% if 'Embed::static' in annotations %}static {% endif %}{{ var_type }} {{ receiver }}{% if value %}{{ '{' + value[(var_type | length) + 1:-1] + '}' }}{% endif %};
3
+ {%- else -%}
4
+ {% if 'Embed::static' in annotations %}static {% endif %}{{ var_type }} {{ receiver }}{% if value %} = {{ value }}{% endif %};
5
+ {%- endif -%}
@@ -0,0 +1 @@
1
+ {{ receiver }} {{ operator }} {{ value }};
@@ -0,0 +1 @@
1
+ {{ receiver }} = {{ value }};
@@ -0,0 +1,7 @@
1
+ {%- if is_initializer -%}
2
+ {{ var_type }} {{ receiver }}{{ '{' + value[(var_type | length) + 1:-1] + '}' }};
3
+ {%- elif is_static -%}
4
+ static {{ var_type }} {{ receiver }} = {{ (break_last_block(value, '{}')[1].strip() | replace('return ', ''))[:-1] }};
5
+ {%- else -%}
6
+ {{ var_type }} {{ receiver }} = {{ value }};
7
+ {%- endif -%}
@@ -0,0 +1 @@
1
+ auto [{{ receivers | join(', ') }}] = {{ value }};
@@ -0,0 +1 @@
1
+ {% include('assign/move_assign.j2') %}
@@ -0,0 +1,8 @@
1
+ // {{ meta_header }}
2
+ #pragma once
3
+ {%- for include_path in depends %}
4
+ #include {{ include_path }}
5
+ {%- endfor %}
6
+ {%- for statement in statements %}
7
+ {{ statement }}
8
+ {%- endfor %}{{ '\n' }}
@@ -0,0 +1 @@
1
+ {%- if accessor %}{{ accessor }}:{{ '\n' }}{% endif -%}
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ {%- if deco_query.contains('Embed.struct') -%}
2
+ struct
3
+ {%- elif deco_query.contains('Embed.union') -%}
4
+ union
5
+ {%- else -%}
6
+ class
7
+ {%- endif -%}
@@ -0,0 +1 @@
1
+ {%- if comment %}{{ comment }}{% else %}/** {{ symbol }} */{% endif %}
@@ -0,0 +1,7 @@
1
+ {%- for inherit in inherits -%}
2
+ {%- if not deco_ignore.any_args(inherit) -%}
3
+ {%- set _inherit_qual = inherit.split('<')[0] %}
4
+ {%- set _inherit_name = _inherit_qual.split('::')[-1] %}
5
+ using {{ _inherit_qual }}::{{ _inherit_name }};
6
+ {%- endif -%}
7
+ {%- endfor -%}
@@ -0,0 +1 @@
1
+ {{- accessor }}: inline static {{ decl_class_var -}}
@@ -0,0 +1 @@
1
+ {{- accessor }}: {{ decl_this_var -}}
File without changes
@@ -0,0 +1 @@
1
+ {% include('class/_classify.j2') %} {{ symbol }}{% include('class/_inherits.j2') %}
@@ -0,0 +1 @@
1
+ {% if accessor %}{{ accessor }}: {% endif %}enum class {{ symbol }}
@@ -0,0 +1,11 @@
1
+ {%- set _inherits = namespace(at=[]) -%}
2
+ {%- if not deco_ignore -%}
3
+ {%- set _inherits.at = inherits -%}
4
+ {%- else -%}
5
+ {%- for inherit in inherits -%}
6
+ {%- if not deco_ignore.any_args(inherit) -%}
7
+ {%- set _inherits.at = _inherits.at + [inherit] -%}
8
+ {%- endif -%}
9
+ {%- endfor -%}
10
+ {%- endif -%}
11
+ {%- if (_inherits.at | length) > 0 %} : public {{ _inherits.at | join(', public ') }}{% endif -%}
File without changes
@@ -0,0 +1 @@
1
+ {%- include('class/_decorators.j2') %}
@@ -0,0 +1,5 @@
1
+ {%- filter indent('\t') %}
2
+ {%- for statement in statements %}
3
+ {{ statement }}
4
+ {%- endfor %}
5
+ {%- endfilter %}
@@ -0,0 +1,12 @@
1
+ {%- set is_number = '"' not in statements[0] -%}
2
+ {%- filter indent('\t') %}
3
+ {%- for statement in statements %}
4
+ {%- if statement.startswith('//') %}
5
+ {{ statement }}
6
+ {%- elif is_number %}
7
+ {{ statement.split(' ')[1:] | join(' ') | replace(';', ',') }}
8
+ {%- else %}
9
+ {{ statement.split(' ')[1] }},
10
+ {%- endif %}
11
+ {%- endfor %}
12
+ {%- endfilter %}
@@ -0,0 +1,4 @@
1
+ {%- if template_types %}
2
+ {%- set join_types = template_types | filter_replace('([^.]+)([.]{3})?', '\\2\\1') | join(', typename ') %}
3
+ template<typename {{ join_types }}>
4
+ {%- endif %}
@@ -0,0 +1 @@
1
+ {% if accessor %}{{ accessor }}: {% endif %}using {{ symbol }} = {{ actual_type }};
@@ -0,0 +1,17 @@
1
+ {%- set deco_query = parse_decorators(decorators) -%}
2
+ {%- set deco_ignore = deco_query.any('Embed.ignore') -%}
3
+ {%- if deco_query.contains('Embed.python') -%}
4
+ // class {{ symbol }}
5
+ {%- else -%}
6
+ {%- include('class/_accessor.j2') %}
7
+ {%- include('class/_comment.j2') %}
8
+ {%- include('class/_prepare.j2') %}
9
+ {%- include('class/_template_types.j2') %}
10
+ {% include('class/_definition_class.j2') %} {
11
+ {%- include('class/_constructor_inherits.j2') %}
12
+ {%- include('class/_before.j2') %}
13
+ {%- include('class/_statements.j2') %}
14
+ {%- include('class/_after.j2') %}
15
+ };
16
+ {%- include('class/_post_definition.j2') %}
17
+ {%- endif -%}
@@ -0,0 +1,10 @@
1
+ {%- set deco_query = parse_decorators(decorators) -%}
2
+ {%- if deco_query.contains('Embed.python') -%}
3
+ // enum {{ symbol }}
4
+ {%- else -%}
5
+ {%- include('class/_comment.j2') %}
6
+ {%- include('class/_decorators.j2') %}
7
+ {% include('class/_definition_enum.j2') %} {
8
+ {%- include('class/_statements_enum.j2') %}
9
+ };
10
+ {%- endif -%}
@@ -0,0 +1,5 @@
1
+ {%- if is_declare -%}
2
+ // template<typename {{ symbol }}>
3
+ {%- else -%}
4
+ {{ symbol }}
5
+ {%- endif -%}
@@ -0,0 +1 @@
1
+ {{ receiver }}[{{ key }}] = {{ value }}
@@ -0,0 +1,6 @@
1
+ {%- set infer = ('const ' if is_const else '') + 'auto' + ('' if is_addr_raw else '&') -%}
2
+ {%- if symbols | length == 1 -%}
3
+ {{ infer }} {{ symbols[0] }} : {{ iterates }}
4
+ {%- else -%}
5
+ {{ infer }} [{{ symbols | join(', ') }}] : {{ iterates }}
6
+ {%- endif -%}
@@ -0,0 +1,2 @@
1
+ {%- set values = break_last_block(iterates, '()')[1] -%}
2
+ auto [{{ symbols[0] }}, __iter, __end, {{ symbols[1] }}] = {{ i18n('classes', 'tuple') }}{0, {{ values }}.{{ i18n('cpp', 'vector.begin') }}(), {{ values }}.{{ i18n('cpp', 'vector.end') }}(), *({{ values }}.{{ i18n('cpp', 'vector.begin') }}())}; __iter < __end; __iter++, {{ symbols[1] }} = *__iter
@@ -0,0 +1,2 @@
1
+ {%- set size = break_last_block(iterates, '()')[1] -%}
2
+ auto {{ symbols[0] }} = 0; {{ symbols[0] }} < {{ size }}; {{ symbols[0] }}++
@@ -0,0 +1,16 @@
1
+ [&]() -> {{ i18n('classes', 'dict') }}<{{ projection_types[0] }}, {{ projection_types[1] }}> {
2
+ {{ i18n('classes', 'dict') }}<{{ projection_types[0] }}, {{ projection_types[1] }}> __ret;
3
+ for ({{ comp_for }}) {
4
+ {%- set receiver = '__ret' %}
5
+ {%- set key = projection_key %}
6
+ {%- set value = projection_value %}
7
+ {%- if condition %}
8
+ if ({{ condition }}) {
9
+ {% include('comp/_assign_dict.j2') %};
10
+ }
11
+ {%- else %}
12
+ {% include('comp/_assign_dict.j2') %};
13
+ {%- endif %}
14
+ }
15
+ return __ret;
16
+ }()
@@ -0,0 +1,13 @@
1
+ [&]() -> {{ i18n('classes', 'list') }}<{{ projection_types[0] }}> {
2
+ {{ i18n('classes', 'list') }}<{{ projection_types[0] }}> __ret;
3
+ for ({{ comp_for }}) {
4
+ {%- if condition %}
5
+ if ({{ condition }}) {
6
+ __ret.{{ i18n('classes', 'list.append') }}({{ projection }});
7
+ }
8
+ {%- else %}
9
+ __ret.{{ i18n('classes', 'list.append') }}({{ projection }});
10
+ {%- endif %}
11
+ }
12
+ return __ret;
13
+ }()
@@ -0,0 +1 @@
1
+ {{- path }}({{ arguments | join(', ') }})
@@ -0,0 +1 @@
1
+ {{ param_type_annotated(var_type, annotations, env_get('immutable_param_types', [])) }}
@@ -0,0 +1 @@
1
+ {{ param_type_annotated(var_type, annotations, env_get('immutable_param_types', [])) }} {{ symbol }}{% if default_value %} = {{ default_value }}{% endif -%}
@@ -0,0 +1,5 @@
1
+ {%- if value == 'this' -%}
2
+ *{{ value }}
3
+ {%- else -%}
4
+ {{ value }}
5
+ {%- endif -%}
File without changes
@@ -0,0 +1 @@
1
+ ({{ expression }})
@@ -0,0 +1,8 @@
1
+ } catch (const {{ var_type }}&{% if symbol %} {{ symbol }}{% endif %}) {
2
+ {%- filter indent('\t') -%}
3
+ {%- for statement in statements -%}
4
+ {%- if statement %}
5
+ {{ statement }}
6
+ {%- endif -%}
7
+ {%- endfor -%}
8
+ {%- endfilter -%}
@@ -0,0 +1,8 @@
1
+ {%- set infer = ('const ' if is_const else '') + 'auto' + ('' if is_addr_raw else '&') -%}
2
+ for ({{ infer }} {% if symbols | length > 1 %}[{{ symbols | join(', ') }}]{% else %}{{ symbols[0] }}{% endif %} : {{ iterates }}) {
3
+ {%- filter indent('\t') %}
4
+ {%- for statement in statements %}
5
+ {{ statement }}
6
+ {%- endfor %}
7
+ {%- endfilter %}
8
+ }
@@ -0,0 +1,8 @@
1
+ {%- set infer = ('const ' if is_const else '') + 'auto' + ('' if is_addr_raw else '&') -%}
2
+ for ({{ infer }} [{{ symbols | join(', ') }}] : {{ iterates }}) {
3
+ {%- filter indent('\t') %}
4
+ {%- for statement in statements %}
5
+ {{ statement }}
6
+ {%- endfor %}
7
+ {%- endfilter %}
8
+ }
@@ -0,0 +1,9 @@
1
+ int {{ symbols[0] }} = 0;
2
+ for (auto& {{ symbols[1] }} : {{ iterates }}) {
3
+ {%- filter indent('\t') %}
4
+ {%- for statement in statements %}
5
+ {{ statement }}
6
+ {%- endfor %}
7
+ {{ symbols[0] }}++;
8
+ {%- endfilter %}
9
+ }
@@ -0,0 +1,7 @@
1
+ for (auto {{ symbol }} = {{ begin }}; {{ symbol }} < {{ size }}; {{ symbol }} += {{ step }}) {
2
+ {%- filter indent('\t') %}
3
+ {%- for statement in statements %}
4
+ {{ statement }}
5
+ {%- endfor %}
6
+ {%- endfilter %}
7
+ }
@@ -0,0 +1,6 @@
1
+ } else {
2
+ {%- filter indent('\t') %}
3
+ {%- for statement in statements %}
4
+ {{ statement }}
5
+ {%- endfor %}
6
+ {%- endfilter %}
@@ -0,0 +1,7 @@
1
+ {%- set is_type_expr = condition.startswith('std::is_same_v') -%}
2
+ } else if {% if is_type_expr %}constexpr {% endif %}({{ condition }}) {
3
+ {%- filter indent('\t') %}
4
+ {%- for statement in statements %}
5
+ {{ statement }}
6
+ {%- endfor %}
7
+ {%- endfilter %}
@@ -0,0 +1,29 @@
1
+ {%- if condition.startswith('std::is_same_v') -%}
2
+ if constexpr ({{ condition }}) {
3
+ {%- filter indent('\t') %}
4
+ {%- for statement in statements %}
5
+ {{ statement }}
6
+ {%- endfor %}
7
+ {%- endfilter %}
8
+ {%- for else_if in else_ifs %}
9
+ {{ else_if }}
10
+ {%- endfor %}
11
+ } else {
12
+ {%- set condition_type = reg_match('^std::is_same_v<([^,]+),', condition)[1] %}
13
+ static_assert(std::is_same_v<{{ condition_type }}, void>, "Unmatch type");
14
+ }
15
+ {%- else -%}
16
+ if ({{ condition }}) {
17
+ {%- filter indent('\t') %}
18
+ {%- for statement in statements %}
19
+ {{ statement }}
20
+ {%- endfor %}
21
+ {%- endfilter %}
22
+ {%- for else_if in else_ifs %}
23
+ {{ else_if }}
24
+ {%- endfor %}
25
+ {%- if else_clause %}
26
+ {{ else_clause }}
27
+ {%- endif %}
28
+ }
29
+ {%- endif -%}
@@ -0,0 +1,12 @@
1
+ try {
2
+ {%- filter indent('\t') -%}
3
+ {%- for statement in statements -%}
4
+ {%- if statement %}
5
+ {{ statement }}
6
+ {%- endif -%}
7
+ {%- endfor -%}
8
+ {%- endfilter -%}
9
+ {%- for catch in catches %}
10
+ {{ catch }}
11
+ {%- endfor %}
12
+ }
@@ -0,0 +1,7 @@
1
+ while ({{ condition }}) {
2
+ {%- filter indent('\t') %}
3
+ {%- for statement in statements %}
4
+ {{ statement }}
5
+ {%- endfor %}
6
+ {%- endfilter %}
7
+ }
@@ -0,0 +1,2 @@
1
+ {#- XXX C++上は非対応 -#}
2
+ Not supported for 'with'
@@ -0,0 +1,2 @@
1
+ {#- XXX C++上は非対応 -#}
2
+ Not supported for 'with_entry'
@@ -0,0 +1 @@
1
+ {{ receiver }} = {{ arguments[0] }}{% if is_statement %};{% endif %}
@@ -0,0 +1,15 @@
1
+ {%- macro get_content(format, formatters, arguments, unwrap_addr) -%}
2
+ {%- set alt_format = namespace(at=format) -%}
3
+ {%- set alt_arguments = namespace(at=[]) -%}
4
+ {%- for i in range(formatters | length) -%}
5
+ {%- set formatter = formatters[i] -%}
6
+ {%- set tag = '{' + formatter.label + '}' -%}
7
+ {%- set alt_format.at = alt_format.at | replace(tag, formatter.tag) -%}
8
+ {%- if formatter.tag == '%s' and not formatter.is_literal -%}
9
+ {%- set alt_arguments.at = alt_arguments.at + ['(' + arguments[i] + ').c_str()'] -%}
10
+ {%- else -%}
11
+ {%- set alt_arguments.at = alt_arguments.at + [arguments[i]] -%}
12
+ {%- endif -%}
13
+ {%- endfor -%}
14
+ {{ alt_format.at }}, {{ alt_arguments.at | join(', ') }}
15
+ {%- endmacro -%}
@@ -0,0 +1,5 @@
1
+ {%- if arguments[0] == '*this' -%}
2
+ ({{ arguments[0][1:] }}{{ operator }}*({{ arguments[1] }}))({{ arguments[2:] | join(', ') }}){% if is_statement %};{% endif %}
3
+ {%- else -%}
4
+ ({{ arguments[0] }}{{ operator }}*({{ arguments[1] }}))({{ arguments[2:] | join(', ') }}){% if is_statement %};{% endif %}
5
+ {%- endif -%}
@@ -0,0 +1 @@
1
+ &{{ arguments[0] }}
@@ -0,0 +1 @@
1
+ #include {{ arguments[0][1:-1] }}
@@ -0,0 +1 @@
1
+ {{ arguments[0][1:-1] }}
@@ -0,0 +1 @@
1
+ #pragma {{ arguments[0][1:-1] }}
@@ -0,0 +1 @@
1
+ std::is_same_v<{{ var_type }}, {{ arguments[1] }}>{% if is_statement %};{% endif %}
@@ -0,0 +1,10 @@
1
+ {%- if from_type in ['int', 'uint32'] and calls not in ['int64', 'uint64', 'float', 'double'] -%}
2
+ static_cast<{{ calls }}>({{ arguments[0] }}){% if is_statement %};{% endif %}
3
+ {%- elif from_type in ['int64', 'uint64'] and calls not in ['float', 'double'] -%}
4
+ static_cast<{{ calls }}>({{ arguments[0] }}){% if is_statement %};{% endif %}
5
+ {%- elif from_type == 'double' and calls == 'float' -%}
6
+ static_cast<{{ calls }}>({{ arguments[0] }}){% if is_statement %};{% endif %}
7
+ {%- else -%}
8
+ {#- XXX Initializerへの変換を防止するため`()`で囲う -#}
9
+ ({{ calls }}({{ arguments[0] }})){% if is_statement %};{% endif %}
10
+ {%- endif -%}
@@ -0,0 +1,5 @@
1
+ {%- if from_type in ['float', 'double'] -%}
2
+ {{ i18n('cpp', 'string.ftoa') }}({{ arguments[0] }}){% if is_statement %};{% endif %}
3
+ {%- else -%}
4
+ {{ i18n('cpp', 'string.itoa') }}({{ arguments[0] }}){% if is_statement %};{% endif %}
5
+ {%- endif -%}
@@ -0,0 +1,5 @@
1
+ {%- if arguments[0].startswith('"') and arguments[0].endswith('"') -%}
2
+ '{{ arguments[0][1:-1] }}'{% if is_statement %};{% endif %}
3
+ {%- else -%}
4
+ {{ arguments[0] }}{% if is_statement %};{% endif %}
5
+ {%- endif -%}
@@ -0,0 +1,2 @@
1
+ {#- XXX Initializerへの変換を防止するため`()`で囲う -#}
2
+ ({{ calls }}({{ arguments[0] }})){% if is_statement %};{% endif %}
@@ -0,0 +1 @@
1
+ {{ arguments[0] }}{% if is_statement %};{% endif %}
@@ -0,0 +1,7 @@
1
+ {%- if calls in ['float', 'double'] -%}
2
+ {{ i18n('cpp', 'string.stod') }}({{ arguments[0] }}){% if is_statement %};{% endif %}
3
+ {%- elif arguments | length == 1 -%}
4
+ {{ i18n('cpp', 'string.stoi') }}({{ arguments[0] }}){% if is_statement %};{% endif %}
5
+ {%- else -%}
6
+ {{ i18n('cpp', 'string.stoi') }}({{ arguments[0] }}, 0, {{ arguments[1] }}){% if is_statement %};{% endif %}
7
+ {%- endif -%}
@@ -0,0 +1 @@
1
+ {{ i18n('classes', 'str') }}({{ arguments[0] }}){% if is_statement %};{% endif %}