improve invalid character errorrs

pull/3011/head
Alexander Medvednikov 2019-12-08 12:57:40 +03:00
parent 8b0de95c0a
commit 6ec626c5e9
1 changed files with 2 additions and 4 deletions

View File

@ -645,9 +645,6 @@ fn (s mut Scanner) scan() ScanRes {
} }
} }
mut msg := 'invalid character `${c.str()}`' mut msg := 'invalid character `${c.str()}`'
if c == `"` {
msg += ', use \' to denote strings'
}
s.error(msg) s.error(msg)
return s.end_of_file() return s.end_of_file()
} }
@ -763,7 +760,8 @@ fn (s mut Scanner) ident_char() string {
if len != 1 { if len != 1 {
u := c.ustring() u := c.ustring()
if u.len != 1 { if u.len != 1 {
s.error('invalid character literal (more than one character: $len)') s.error('invalid character literal (more than one character)\n' +
'use quotes for strings, backticks for characters')
} }
} }
if c == '\\`' { if c == '\\`' {