Skip to content

Commit

Permalink
printer: fix printing of strings containing special characters
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLydike committed Jan 18, 2023
1 parent e63d6d4 commit 856339e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xdsl/printer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import json
from dataclasses import dataclass, field
from enum import Enum
from frozenlist import FrozenList
Expand Down Expand Up @@ -296,7 +297,7 @@ def print_paramattr_parameters(
self.print(">")

def print_string_literal(self, string: str):
self.print(f'"{string}"')
self.print(json.dumps(string))

def print_attribute(self, attribute: Attribute) -> None:
if isinstance(attribute, UnitAttr):
Expand Down

0 comments on commit 856339e

Please sign in to comment.