func handleEscapedRune(x *Lexer) stateFn {
	// Escaping the EOF isn't cool.
	ch := x.next()
	if ch == eof {
		return x.error("unterminated sequence")
	}
	if !isEscapeAble(ch) {
		return x.errorf("invalid character after escape: %#U", ch)
	}

	// Both the \x and \u escapes should be followed by a specific number
	// of unicode characters (2 and 4 respectively).
	switch ch {
	case 'x':
		// '\x' HEX_DIGIT HEX_DIGIT
		if !bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) {
			x.backup()
			return x.errorf("invalid character as part of hex escape: %#U", x.peek())
		}
	case 'u':
		// '\u' HEX_DIGIT_QUARTET
		if !bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) ||
			!bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) {
			return unicodeEscapeError(x)
		}
	case 'U':
		// '\U000'  HEX_DIGIT_QUARTET HEX_DIGIT or
		// '\U0010' HEX_DIGIT_QUARTET
		if x.next() != '0' || x.next() != '0' {
			return unicodeEscapeError(x)
		}
		switch next := x.next(); next {
		case '0':
			// Eat the hex digit that is expected to be a 0 in the other case.
			if !bytes.ContainsRune([]byte(hexDigits), x.next()) {
				return unicodeEscapeError(x)
			}
		case '1':
			if x.next() != '0' {
				return unicodeEscapeError(x)
			}
		default:
			return unicodeEscapeError(x)
		}
		if !bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) ||
			!bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) {
			return unicodeEscapeError(x)
		}
	}

	// If the file is from Windows then the escape character may be
	// trying to escape both /r and /n.
	if pk := x.peek(); ch == '\r' && pk == '\n' {
		x.next()
	}
	return nil
}
// handleEscapedRune checks the character after an escape character '\' within
// a string.  If the escaped character is not valid, e.g. EOF, then an error
// stateFn is returned.
handleEscapedRune checks the character after an escape character '\' within
a string.  If the escaped character is not valid, e.g. EOF, then an error
stateFn is returned.
// handleEscapedRune checks the character after an escape character ' \ ' within // a string . If the escaped character is not valid e . g . EOF then an error // stateFn is returned .
func handleEscapedRune(x *Lexer) stateFn {
	ch := x.next()
	if ch == eof {
		return x.error("unterminated sequence")
	}
	if !isEscapeAble(ch) {
		return x.errorf("invalid character after escape: %#U", ch)
	}
	switch ch {
	case 'x':
		if !bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) {
			x.backup()
			return x.errorf("invalid character as part of hex escape: %#U", x.peek())
		}
	case 'u':
		if !bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) ||
			!bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) {
			return unicodeEscapeError(x)
		}
	case 'U':
		if x.next() != '0' || x.next() != '0' {
			return unicodeEscapeError(x)
		}
		switch next := x.next(); next {
		case '0':
			if !bytes.ContainsRune([]byte(hexDigits), x.next()) {
				return unicodeEscapeError(x)
			}
		case '1':
			if x.next() != '0' {
				return unicodeEscapeError(x)
			}
		default:
			return unicodeEscapeError(x)
		}
		if !bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) ||
			!bytes.ContainsRune([]byte(hexDigits), x.next()) || !bytes.ContainsRune([]byte(hexDigits), x.next()) {
			return unicodeEscapeError(x)
		}
	}
	if pk := x.peek(); ch == '\r' && pk == '\n' {
		x.next()
	}
	return nil
}
func handleEscapedRune ( x * Lexer ) stateFn { ch := x . next ( ) if ch == eof { return x . error ( " " ) } if ! isEscapeAble ( ch ) { return x . errorf ( " " , ch ) } switch ch { case 'x' : if ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) || ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) { x . backup ( ) return x . errorf ( " " , x . peek ( ) ) } case 'u' : if ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) || ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) || ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) || ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) { return unicodeEscapeError ( x ) } case 'U' : if x . next ( ) != '0' || x . next ( ) != '0' { return unicodeEscapeError ( x ) } switch next := x . next ( ) ; next { case '0' : if ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) { return unicodeEscapeError ( x ) } case '1' : if x . next ( ) != '0' { return unicodeEscapeError ( x ) } default : return unicodeEscapeError ( x ) } if ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) || ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) || ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) || ! bytes . ContainsRune ( [ ] byte ( hexDigits ) , x . next ( ) ) { return unicodeEscapeError ( x ) } } if pk := x . peek ( ) ; ch == '\r' && pk == '\n' { x . next ( ) } return nil }
handleEscapedRune checks the character after an escape character '\' within
a string.
handleEscapedRune checks the character after an escape character ' \ ' within a string .
// Escaping the EOF isn't cool. // Both the \x and \u escapes should be followed by a specific number // of unicode characters (2 and 4 respectively). // '\x' HEX_DIGIT HEX_DIGIT // '\u' HEX_DIGIT_QUARTET // '\U000'  HEX_DIGIT_QUARTET HEX_DIGIT or // '\U0010' HEX_DIGIT_QUARTET // Eat the hex digit that is expected to be a 0 in the other case. // If the file is from Windows then the escape character may be // trying to escape both /r and /n.