string-to-code 0.4.0__tar.gz → 0.4.1__tar.gz
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.
- {string_to_code-0.4.0 → string_to_code-0.4.1}/PKG-INFO +1 -1
- {string_to_code-0.4.0 → string_to_code-0.4.1}/pyproject.toml +1 -1
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_fortran90.py +14 -16
- {string_to_code-0.4.0 → string_to_code-0.4.1}/LICENSE +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/README.md +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/__init__.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/c_like_utils.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/core.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/string_to_code.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_ada.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_algol68.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_ballerina.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_bash.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_c.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_cobol.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_cpp.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_haskell.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_java.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_lisp.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_lua.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_nim.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_pascal.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_python3.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/to_rust.py +0 -0
- {string_to_code-0.4.0 → string_to_code-0.4.1}/string_to_code/utils.py +0 -0
|
@@ -12,13 +12,13 @@ _get_function_name = utils.get_function_name_fun("fun_")
|
|
|
12
12
|
def _atom_to_code(in_atom: core.Atom) -> str:
|
|
13
13
|
if in_atom.atom_char == "\n":
|
|
14
14
|
return "write (*, *)"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
special_chars = {
|
|
16
|
+
'"': "'\"'",
|
|
17
|
+
"\t": "char(9)",
|
|
18
|
+
}
|
|
19
|
+
return 'write (*, "(A)", advance="no") ' + special_chars.get(
|
|
20
|
+
in_atom.atom_char, f'"{in_atom.atom_char}"'
|
|
21
|
+
)
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
_function_call_str = utils.get_function_call_str_fun(_get_function_name, "call ", "()")
|
|
@@ -32,9 +32,7 @@ _body_to_str = utils.get_body_to_str("\n", " ", _call_function_or_atom, "
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
def _merge_to_full_function(in_function_name: str, in_function_body: str) -> str:
|
|
35
|
-
body_str = ""
|
|
36
|
-
if in_function_body:
|
|
37
|
-
body_str = in_function_body + "\n"
|
|
35
|
+
body_str = in_function_body + "\n" if in_function_body else ""
|
|
38
36
|
return f""" subroutine {in_function_name}()
|
|
39
37
|
{body_str} end subroutine {in_function_name}
|
|
40
38
|
"""
|
|
@@ -52,12 +50,12 @@ def _main_call_to_code(in_initial_call: core.InitialCall, **kwargs) -> str:
|
|
|
52
50
|
|
|
53
51
|
|
|
54
52
|
def _join_to_final(main_call: str, function_definitions: list[str], **_kwargs) -> str:
|
|
55
|
-
main_call_str = ""
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
main_call_str = "\n " + main_call if main_call else ""
|
|
54
|
+
contains_str = (
|
|
55
|
+
"\ncontains\n" + "\n".join(function_definitions)
|
|
56
|
+
if function_definitions
|
|
57
|
+
else "\n"
|
|
58
|
+
)
|
|
61
59
|
return f"""program main
|
|
62
60
|
implicit none{main_call_str}{contains_str}end program main
|
|
63
61
|
"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|