projects
/
openpower-isa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
59be6c8
)
oppc/code: support string literals
author
Dmitry Selyutin
<ghostmansd@gmail.com>
Sun, 14 Jan 2024 18:23:43 +0000
(21:23 +0300)
committer
Dmitry Selyutin
<ghostmansd@gmail.com>
Tue, 16 Jan 2024 19:10:07 +0000
(22:10 +0300)
src/openpower/oppc/pc_code.py
patch
|
blob
|
history
diff --git
a/src/openpower/oppc/pc_code.py
b/src/openpower/oppc/pc_code.py
index 107099fac84ad2302a5673f3346d8bfeafeef52e..4a2b4f759d84b2b88acf2c3e4469f3b24a7d01b3 100644
(file)
--- a/
src/openpower/oppc/pc_code.py
+++ b/
src/openpower/oppc/pc_code.py
@@
-279,6
+279,12
@@
class CodeVisitor(pc_util.Visitor):
}[node.__class__]
self[node].emit(stmt=op)
+ @pc_util.Hook(pc_ast.StringLiteral)
+ def StringLiteral(self, node):
+ yield node
+ escaped = repr(str(node))[1:-1]
+ self[node].emit(stmt=f"\"{escaped}\"")
+
@pc_util.Hook(pc_ast.BinLiteral, pc_ast.DecLiteral, pc_ast.HexLiteral)
def Integer(self, node):
yield node