// ReadRune reads a rune backward
185367
func (r *ReverseReader) ReadRune() (ru rune, size int, err error) {
	var rb [4]byte
	n, err := r.Read(rb[:])
	ru, size = utf8.DecodeLastRune(rb[:n])
	if err != nil {
		return
	}
	r.offset += int64(n - size)
	r.rs.Seek(r.offset, os.SEEK_SET)
	if ru == utf8.RuneError {
		return ru, size, fmt.Errorf("RuneError")
	}
	return
}
236037
func (s *Statement) LitRune(v rune) *Statement {
	t := token{
		typ:     literalRuneToken,
		content: v,
	}
	*s = append(*s, t)
	return s
}
589432
func (s *scanner) scanRbrack(r rune) bool {
	if s.mode&scanRbrack == 0 {
		return false
	}
	return r == '}'
}
243591
func (s *Scanner) Peek() rune {
	r, _, _ := s.r.ReadRune()
	if r != eof {
		_ = s.r.UnreadRune()
	}

	return r
}
513826
func (b *Reader) ReadRune() (c rune, size int, err error) {
read:
	c, size, status := b.decode(b.buf[b.r:b.w])

	if status == NO_ROOM && b.err == nil {
		b.fill()
		goto read
	}

	if status == STATE_ONLY {
		b.r += size
		goto read
	}

	if b.r == b.w {
		return 0, 0, b.err
	}

	if status == NO_ROOM {
		c = 0xfffd
		size = b.w - b.r
		status = INVALID_CHAR
	}

	b.r += size
	return c, size, nil
}
624631
func (p *Parser) peek() rune {
	r := p.next()
	p.backup()
	return r
}
1071239
func escapeKey(r rune, reader *bufio.Reader) rune {
	switch r {
	case 'b':
		r = MetaBackward
	case 'f':
		r = MetaForward
	case 'd':
		r = MetaDelete
	case CharTranspose:
		r = MetaTranspose
	case CharBackspace:
		r = MetaBackspace
	case 'O':
		d, _, _ := reader.ReadRune()
		switch d {
		case 'H':
			r = CharLineStart
		case 'F':
			r = CharLineEnd
		default:
			reader.UnreadRune()
		}
	case CharEsc:

	}
	return r
}
509598
func (l *pageLexer) peek() rune {
	r := l.next()
	l.backup()
	return r
}
825855
func ScanString(r io.RuneScanner) (string, error) {
	ending, _, err := r.ReadRune()
	if err != nil {
		return "", errBadString
	}

	var buf bytes.Buffer
	for {
		ch0, _, err := r.ReadRune()
		if ch0 == ending {
			return buf.String(), nil
		} else if err != nil || ch0 == '\n' {
			return buf.String(), errBadString
		} else if ch0 == '\\' {
			// If the next character is an escape then write the escaped char.
			// If it's not a valid escape then return an error.
			ch1, _, _ := r.ReadRune()
			if ch1 == 'n' {
				_, _ = buf.WriteRune('\n')
			} else if ch1 == '\\' {
				_, _ = buf.WriteRune('\\')
			} else if ch1 == '"' {
				_, _ = buf.WriteRune('"')
			} else if ch1 == '\'' {
				_, _ = buf.WriteRune('\'')
			} else {
				return string(ch0) + string(ch1), errBadEscape
			}
		} else {
			_, _ = buf.WriteRune(ch0)
		}
	}
}
980411
func (z *Tokenizer) readRawOrRCDATA() {
	if z.rawTag == "script" {
		z.readScript()
		z.textIsRaw = true
		z.rawTag = ""
		return
	}
loop:
	for {
		c := z.readByte()
		if z.err != nil {
			break loop
		}
		if c != '<' {
			continue loop
		}
		c = z.readByte()
		if z.err != nil {
			break loop
		}
		if c != '/' {
			continue loop
		}
		if z.readRawEndTag() || z.err != nil {
			break loop
		}
	}
	z.data.end = z.raw.end
	// A textarea's or title's RCDATA can contain escaped entities.
	z.textIsRaw = z.rawTag != "textarea" && z.rawTag != "title"
	z.rawTag = ""
}
797638
func (g *Gui) SetRune(x, y int, ch rune, fgColor, bgColor Attribute) error {
	if x < 0 || y < 0 || x >= g.maxX || y >= g.maxY {
		return errors.New("invalid point")
	}
	termbox.SetCell(x, y, ch, termbox.Attribute(fgColor), termbox.Attribute(bgColor))
	return nil
}
1172134
func (sc *scanner) peekRune() rune {
	if len(sc.rest) == 0 {
		return 0
	}

	// fast path: ASCII
	if b := sc.rest[0]; b < utf8.RuneSelf {
		if b == '\r' {
			return '\n'
		}
		return rune(b)
	}

	r, _ := utf8.DecodeRune(sc.rest)
	return r
}
1353200
func (l *Lexer) peekRunePast(skip int) rune {
	if l.pos+skip+1 > len(l.input) {
		return rune(0)
	}

	for ; skip < len(l.input)-l.pos; skip++ {
		r, ri := utf8.DecodeRuneInString(l.input[l.pos+skip:])
		if ri != 1 {
			skip += (ri - 1)
		}
		if !unicode.IsSpace(r) {
			return r
		}
	}
	return rune(0)
}
1269146
func (p *Parser) peekRune() rune {
	r, _, _ := p.s.s.r.ReadRune()
	if r != eof {
		_ = p.s.s.r.UnreadRune()
	}

	return r
}
1139370
func ToASCII(r rune) rune {
	a, ok := UnicodeToASCII[r]
	if ok {
		return a
	}
	return r
}
1267832
func (r *Reader) readRune() (rune, error) {
	r1, _, err := r.r.ReadRune()

	// Handle \r\n here.  We make the simplifying assumption that
	// anytime \r is followed by \n that it can be folded to \n.
	// We will not detect files which contain both \r\n and bare \n.
	if r1 == '\r' {
		r1, _, err = r.r.ReadRune()
		if err == nil {
			if r1 != '\n' {
				r.r.UnreadRune()
				r1 = '\r'
			}
		}
	}
	r.column++
	return r1, err
}
806084
func (s *Scanner) peek() rune {
	if s.i >= len(s.b) {
		return eof
	}
	ch, _ := utf8.DecodeRune(s.b[s.i:])
	return ch
}