FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/src/lpython/pickle.cpp at main · Ayush-Devs/lpython · GitHub
Ayush-Devs
/
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
/
pickle.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
65 lines (55 loc) · 1.48 KB
Breadcrumbs
lpython
/
src
/
lpython
/
pickle.cpp
Copy path
File metadata and controls
65 lines (55 loc) · 1.48 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
include
<
string
>
#
include
<
lpython/pickle.h
>
#
include
<
lpython/bigint.h
>
#
include
<
lpython/python_ast.h
>
#
include
<
libasr/asr_utils.h
>
#
include
<
libasr/string_utils.h
>
#
include
<
libasr/location.h
>
#
include
<
libasr/pass/intrinsic_function_registry.h
>
#
include
<
libasr/pass/intrinsic_array_function_registry.h
>
namespace
LCompilers
::LPython {
/*
********************* AST Pickle ******************
*/
class
PickleVisitor
:
public
AST
::PickleBaseVisitor<PickleVisitor>
{
public:
std::string
get_str
() {
return
s;
}
};
std::string
pickle_python
(
AST
::
ast_t
&ast,
bool
colors,
bool
indent) {
PickleVisitor v;
v.
use_colors
= colors;
v.
indent
= indent;
v.
visit_ast
(ast);
return
v.
get_str
();
}
/*
********************* AST Pickle Tree ******************
*/
class
ASTTreeVisitor
:
public
AST
::TreeBaseVisitor<ASTTreeVisitor>
{
public:
std::string
get_str
() {
return
s;
}
};
std::string
pickle_tree_python
(
AST
::
ast_t
&ast,
bool
colors) {
ASTTreeVisitor v;
v.
use_colors
= colors;
v.
visit_ast
(ast);
return
v.
get_str
();
}
/*
********************* AST Pickle Json ******************
*/
class
ASTJsonVisitor
:
public LPython::
AST
::JsonBaseVisitor<ASTJsonVisitor>
{
public:
using
LPython::
AST
::JsonBaseVisitor<ASTJsonVisitor>::JsonBaseVisitor;
std::string
get_str
() {
return
s;
}
};
std::string
pickle_json
(LPython::
AST
::
ast_t
&ast, LocationManager &lm) {
ASTJsonVisitor
v
(lm);
v.
visit_ast
(ast);
return
v.
get_str
();
}
}
Back
|
FazBrowse Home
|
New Git URL