Skip to content

Commit

Permalink
Merge pull request #1 from virendrakabra14/branch1
Browse files Browse the repository at this point in the history
modified asdl_cpp
  • Loading branch information
virendrakabra14 committed Mar 31, 2023
2 parents 2383718 + 5b782f2 commit 69ebf5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libasr/ASR.asdl
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ expr
| TupleCompare(expr left, cmpop op, expr right, ttype type, expr? value)

| StringConstant(string s, ttype type)
| BytesConstant(string s, ttype type)
| StringConcat(expr left, expr right, ttype type, expr? value)
| StringRepeat(expr left, expr right, ttype type, expr? value)
| StringLen(expr arg, ttype type, expr? value)
Expand Down
5 changes: 5 additions & 0 deletions src/libasr/asdl_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ def visitConstructor(self, cons, base, extra_attributes):
seq = ""
self.emit("%s m_%s;%s" % (type_, f.name, seq), 2)
args.append("%s a_%s" % (type_, f.name))

if cons.name == "ConstantBytes" and f.name == "value":
lines.append("*(a_%s+(strlen(a_%s)-1)) = '\\0';" % (f.name, f.name))
lines.append("a_%s += 2;" % (f.name))

lines.append("n->m_%s = a_%s;" % (f.name, f.name))
if f.name in ["global_scope", "symtab"]:
lines.append("a_%s->asr_owner = (asr_t*)n;" % (f.name))
Expand Down

0 comments on commit 69ebf5c

Please sign in to comment.