fix Windows line ending bug
parent
9b0bb2f72c
commit
cc77d8cdd2
|
@ -2109,16 +2109,6 @@ fn (p mut Parser) char_expr() {
|
|||
p.next()
|
||||
}
|
||||
|
||||
fn format_str(str string) string {
|
||||
str = str.replace('"', '\\"')
|
||||
$if windows {
|
||||
str = str.replace('\r\n', '\\n')
|
||||
}
|
||||
$else {
|
||||
str = str.replace('\n', '\\n')
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
fn (p mut Parser) typ_to_fmt(typ string) string {
|
||||
t := p.table.find_type(typ)
|
||||
|
@ -2143,6 +2133,15 @@ fn (p mut Parser) typ_to_fmt(typ string) string {
|
|||
return ''
|
||||
}
|
||||
|
||||
fn format_str(str string) string {
|
||||
str = str.replace('"', '\\"')
|
||||
$if windows {
|
||||
str = str.replace('\r\n', '\\n')
|
||||
}
|
||||
str = str.replace('\n', '\\n')
|
||||
return str
|
||||
}
|
||||
|
||||
fn (p mut Parser) string_expr() {
|
||||
// println('STRING EXPR')
|
||||
str := p.lit
|
||||
|
@ -2156,7 +2155,7 @@ fn (p mut Parser) string_expr() {
|
|||
p.gen('"$f"')
|
||||
}
|
||||
else {
|
||||
p.gen('tos2("$f")')// TODO dont call strlen here
|
||||
p.gen('tos2("$f")')
|
||||
}
|
||||
p.next()
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue