Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-concurrency
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
Xavier Thompson
typon-concurrency
Commits
2b11d166
Commit
2b11d166
authored
Jul 07, 2023
by
Tom Niget
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce _ps custom literal for PyStr
parent
825661d3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
rt/include/python/builtins/str.hpp
rt/include/python/builtins/str.hpp
+4
-0
trans/transpiler/phases/emit_cpp/expr.py
trans/transpiler/phases/emit_cpp/expr.py
+1
-1
No files found.
rt/include/python/builtins/str.hpp
View file @
2b11d166
...
...
@@ -35,6 +35,10 @@ public:
}
};
inline
constexpr
PyStr
operator
""
_ps
(
const
char
*
s
,
size_t
len
)
noexcept
{
return
PyStr
(
s
,
len
);
}
PyStr
PyBytes
::
decode
(
const
std
::
string
&
encoding
)
const
{
return
PyStr
(
this
->
begin
(),
this
->
end
());
}
...
...
trans/transpiler/phases/emit_cpp/expr.py
View file @
2b11d166
...
...
@@ -61,7 +61,7 @@ class ExpressionVisitor(NodeVisitor):
def
visit_Constant
(
self
,
node
:
ast
.
Constant
)
->
Iterable
[
str
]:
if
isinstance
(
node
.
value
,
str
):
# TODO: escape sequences
yield
f"
\
"
{
repr
(
node
.
value
)[
1
:
-
1
]
}\
"
s"
yield
f"
\
"
{
repr
(
node
.
value
)[
1
:
-
1
]
}\
"
_p
s"
elif
isinstance
(
node
.
value
,
bool
):
yield
str
(
node
.
value
).
lower
()
elif
isinstance
(
node
.
value
,
int
):
...
...
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