parent
							
								
									008ce8fc65
								
							
						
					
					
						commit
						0b96cd50e1
					
				| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					vlib/v/checker/tests/string_escape_u_err_a.vv:2:15: error: `\u` incomplete unicode character value
 | 
				
			||||||
 | 
					    1 | fn main() {
 | 
				
			||||||
 | 
					    2 |     println('\u')
 | 
				
			||||||
 | 
					      |               ^
 | 
				
			||||||
 | 
					    3 | }
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					fn main() {
 | 
				
			||||||
 | 
					    println('\u')
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					vlib/v/checker/tests/string_escape_u_err_b.vv:2:15: error: `\u` incomplete unicode character value
 | 
				
			||||||
 | 
					    1 | fn main() {
 | 
				
			||||||
 | 
					    2 |     println('\u345')
 | 
				
			||||||
 | 
					      |               ^
 | 
				
			||||||
 | 
					    3 | }
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,3 @@
 | 
				
			||||||
 | 
					fn main() {
 | 
				
			||||||
 | 
					    println('\u345')
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1039,12 +1039,20 @@ fn (mut s Scanner) ident_string() string {
 | 
				
			||||||
				s.error(r'cannot use `\x00` (NULL character) in the string literal')
 | 
									s.error(r'cannot use `\x00` (NULL character) in the string literal')
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							// Escape `\x` `\u`
 | 
				
			||||||
 | 
							if prevc == slash && !is_raw && !is_cstr && s.count_symbol_before(s.pos - 2, slash) % 2 == 0 {
 | 
				
			||||||
			// Escape `\x`
 | 
								// Escape `\x`
 | 
				
			||||||
		if prevc == slash &&
 | 
								if c == `x` && (s.text[s.pos + 1] == s.quote || !s.text[s.pos + 1].is_hex_digit()) {
 | 
				
			||||||
			c == `x` && s.count_symbol_before(s.pos - 2, slash) % 2 == 0 && !is_raw && !is_cstr &&
 | 
					 | 
				
			||||||
			(s.text[s.pos + 1] == s.quote || !s.text[s.pos + 1].is_hex_digit()) {
 | 
					 | 
				
			||||||
				s.error(r'`\x` used with no following hex digits')
 | 
									s.error(r'`\x` used with no following hex digits')
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								// Escape `\u`
 | 
				
			||||||
 | 
								if c == `u` && (s.text[s.pos + 1] == s.quote ||
 | 
				
			||||||
 | 
									s.text[s.pos + 2] == s.quote || s.text[s.pos + 3] == s.quote || s.text[s.pos + 4] == s.quote ||
 | 
				
			||||||
 | 
									!s.text[s.pos + 1].is_hex_digit() || !s.text[s.pos + 2].is_hex_digit() || !s.text[s.pos + 3].is_hex_digit() ||
 | 
				
			||||||
 | 
									!s.text[s.pos + 4].is_hex_digit()) {
 | 
				
			||||||
 | 
									s.error(r'`\u` incomplete unicode character value')
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		// ${var} (ignore in vfmt mode) (skip \$)
 | 
							// ${var} (ignore in vfmt mode) (skip \$)
 | 
				
			||||||
		if prevc == `$` && c == `{` && !is_raw && s.count_symbol_before(s.pos - 2, slash) % 2 == 0 {
 | 
							if prevc == `$` && c == `{` && !is_raw && s.count_symbol_before(s.pos - 2, slash) % 2 == 0 {
 | 
				
			||||||
			s.is_inside_string = true
 | 
								s.is_inside_string = true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue