Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
895a8413
Commit
895a8413
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add json module
parent
2b11d166
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
rt/include/python/json.hpp
rt/include/python/json.hpp
+22
-0
trans/stdlib/json.py
trans/stdlib/json.py
+7
-0
No files found.
rt/include/python/json.hpp
0 → 100644
View file @
895a8413
//
// Created by Tom on 04/07/2023.
//
#ifndef TYPON_JSON_HPP
#define TYPON_JSON_HPP
#include "builtins.hpp"
namespace
py_json
{
struct
json_t
{
template
<
typename
T
>
typon
::
Task
<
void
>
dump
(
const
T
&
x
,
PyFile
&
fp
)
{
std
::
stringstream
ss
;
repr_to
(
x
,
ss
);
co_await
fp
.
write
(
ss
.
str
());
}
}
all
;
auto
&
get_all
()
{
return
all
;
}
}
// namespace py_json
#endif // TYPON_JSON_HPP
trans/stdlib/json.py
0 → 100644
View file @
895a8413
# coding: utf-8
from
typing
import
TypeVar
T
=
TypeVar
(
"T"
)
def
dump
(
obj
:
T
,
fp
:
file
)
->
Task
[
str
]:
...
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment