mirror of
https://github.com/lloeki/rebel.git
synced 2025-12-06 01:54:40 +01:00
Properly handle backslash escaping
This commit is contained in:
parent
a0f1153407
commit
86ce2b65ff
2 changed files with 25 additions and 11 deletions
|
|
@ -292,7 +292,10 @@ module Rebel
|
|||
end
|
||||
|
||||
def escape_str(str)
|
||||
str.gsub(@string_quote, @escaped_string_quote)
|
||||
str.dup.tap do |s|
|
||||
s.gsub!('\\') { @escaped_string_backslash } if @escaped_string_backslash
|
||||
s.gsub!(@string_quote) { @escaped_string_quote }
|
||||
end
|
||||
end
|
||||
|
||||
def value(v)
|
||||
|
|
@ -390,6 +393,7 @@ module Rebel
|
|||
@identifier_quote = options[:identifier_quote] || '"'
|
||||
@string_quote = options[:string_quote] || "'"
|
||||
@escaped_string_quote = options[:escaped_string_quote] || "''"
|
||||
@escaped_string_backslash = options[:escaped_string_backslash]
|
||||
@true_literal = options[:true_literal] || 'TRUE'
|
||||
@false_literal = options[:false_literal] || 'FALSE'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue