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):
125125
126126 def _consume_literal (self ):
127127 start = self ._position
128- lexeme = self ._consume_until ('`' )
129- lexeme = lexeme .replace ('\\ `' , '`' )
128+ lexeme = self ._consume_until ('`' ).replace ('\\ `' , '`' )
130129 try :
131130 # Assume it is valid JSON and attempt to parse.
132131 parsed_json = loads (lexeme )
@@ -160,7 +159,7 @@ def _consume_quoted_identifier(self):
160159
161160 def _consume_raw_string_literal (self ):
162161 start = self ._position
163- lexeme = self ._consume_until ("'" )
162+ lexeme = self ._consume_until ("'" ). replace ( " \\ '" , "'" )
164163 token_len = self ._position - start
165164 return {'type' : 'literal' , 'value' : lexeme ,
166165 'start' : start , 'end' : token_len }
Original file line number Diff line number Diff line change 179179 "comment" : " Do not interpret escaped unicode." ,
180180 "expression" : " '\\ u03a6'" ,
181181 "result" : " \\ u03a6"
182+ },
183+ {
184+ "comment" : " Can escape the single quote" ,
185+ "expression" : " 'foo\\ 'bar'" ,
186+ "result" : " foo'bar"
182187 }
183188 ]
184189 }
You can’t perform that action at this time.
0 commit comments