fix a wrong "0 character in a string literal" error
parent
7b0e378947
commit
63ec3c0486
|
@ -698,8 +698,12 @@ fn (s mut Scanner) ident_string() string {
|
||||||
}
|
}
|
||||||
// Don't allow \0
|
// Don't allow \0
|
||||||
if c == `0` && s.pos > 2 && s.text[s.pos - 1] == slash {
|
if c == `0` && s.pos > 2 && s.text[s.pos - 1] == slash {
|
||||||
|
if s.pos < s.text.len - 1 && s.text[s.pos+1].is_digit() {
|
||||||
|
|
||||||
|
} else {
|
||||||
s.error('0 character in a string literal')
|
s.error('0 character in a string literal')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Don't allow \x00
|
// Don't allow \x00
|
||||||
if c == `0` && s.pos > 5 && s.expect('\\x0', s.pos - 3) {
|
if c == `0` && s.pos > 5 && s.expect('\\x0', s.pos - 3) {
|
||||||
s.error('0 character in a string literal')
|
s.error('0 character in a string literal')
|
||||||
|
|
Loading…
Reference in New Issue