FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/src/lpython/python_serialization.cpp at main · ekMartian/lpython · GitHub
ekMartian
/
lpython
Public
forked from
lcompilers/lpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lpython
/
src
/
lpython
/
python_serialization.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (39 loc) · 1.04 KB
Breadcrumbs
lpython
/
src
/
lpython
/
python_serialization.cpp
Copy path
File metadata and controls
48 lines (39 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
include
<
string
>
#
include
<
libasr/config.h
>
#
include
<
lpython/python_serialization.h
>
#
include
<
libasr/bwriter.h
>
#
include
<
libasr/string_utils.h
>
namespace
LCompilers
::LPython {
class
ASTDeserializationVisitor
:
#
ifdef
WITH_LFORTRAN_BINARY_MODFILES
public BinaryReader,
#
else
public TextReader,
#
endif
public
AST
::DeserializationBaseVisitor<ASTDeserializationVisitor>
{
public:
ASTDeserializationVisitor
(Allocator &al,
const
std::string &s) :
#
ifdef
WITH_LFORTRAN_BINARY_MODFILES
BinaryReader
(s),
#
else
TextReader
(s),
#
endif
DeserializationBaseVisitor
(al,
true
,
0
) {}
bool
read_bool
() {
uint8_t
b =
read_int8
();
return
(b ==
1
);
}
char
*
read_cstring
() {
std::string s =
read_string
();
LCompilers::Str cs;
cs.
from_str_view
(s);
char
* p = cs.
c_str
(al);
return
p;
}
};
AST
::
ast_t
*
deserialize_ast
(Allocator &al,
const
std::string &s) {
ASTDeserializationVisitor
v
(al, s);
return
v.
deserialize_node
();
}
}
//
namespace LCompilers::LPython
Back
|
FazBrowse Home
|
New Git URL