compiler: escapes quote on literals
parent
949dfc59fd
commit
af60f9ead4
|
@ -752,7 +752,8 @@ fn (s mut Scanner) ident_char() string {
|
|||
s.error('invalid character literal (more than one character: $len)')
|
||||
}
|
||||
}
|
||||
return c
|
||||
// Escapes a `'` character
|
||||
return if c == '\'' { '\\' + c } else { c }
|
||||
}
|
||||
|
||||
fn (s mut Scanner) peek() Token {
|
||||
|
|
|
@ -418,3 +418,8 @@ fn test_for_loop_two() {
|
|||
assert c == s[i]
|
||||
}
|
||||
}
|
||||
|
||||
fn test_quote() {
|
||||
a := `'`
|
||||
assert a.str() == '\''
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue