File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,7 @@ def _consume_until(self, delimiter):
125
125
126
126
def _consume_literal (self ):
127
127
start = self ._position
128
- lexeme = self ._consume_until ('`' )
129
- lexeme = lexeme .replace ('\\ `' , '`' )
128
+ lexeme = self ._consume_until ('`' ).replace ('\\ `' , '`' )
130
129
try :
131
130
# Assume it is valid JSON and attempt to parse.
132
131
parsed_json = loads (lexeme )
@@ -160,7 +159,7 @@ def _consume_quoted_identifier(self):
160
159
161
160
def _consume_raw_string_literal (self ):
162
161
start = self ._position
163
- lexeme = self ._consume_until ("'" )
162
+ lexeme = self ._consume_until ("'" ). replace ( " \\ '" , "'" )
164
163
token_len = self ._position - start
165
164
return {'type' : 'literal' , 'value' : lexeme ,
166
165
'start' : start , 'end' : token_len }
Original file line number Diff line number Diff line change 179
179
"comment" : " Do not interpret escaped unicode." ,
180
180
"expression" : " '\\ u03a6'" ,
181
181
"result" : " \\ u03a6"
182
+ },
183
+ {
184
+ "comment" : " Can escape the single quote" ,
185
+ "expression" : " 'foo\\ 'bar'" ,
186
+ "result" : " foo'bar"
182
187
}
183
188
]
184
189
}
You can’t perform that action at this time.
0 commit comments