Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 161 for readRune (0.24 sec)

  1. src/cmd/vendor/golang.org/x/mod/modfile/read.go

    		if i >= len(in.remaining) || in.remaining[i] != prefix[i] {
    			return false
    		}
    	}
    	return true
    }
    
    // readRune consumes and returns the next rune in the input.
    func (in *input) readRune() int {
    	if len(in.remaining) == 0 {
    		in.Error("internal lexer error: readRune at EOF")
    	}
    	r, size := utf8.DecodeRune(in.remaining)
    	in.remaining = in.remaining[size:]
    	if r == '\n' {
    		in.pos.Line++
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  2. src/strings/reader.go

    func (r *Reader) UnreadByte() error {
    	if r.i <= 0 {
    		return errors.New("strings.Reader.UnreadByte: at beginning of string")
    	}
    	r.prevRune = -1
    	r.i--
    	return nil
    }
    
    // ReadRune implements the [io.RuneReader] interface.
    func (r *Reader) ReadRune() (ch rune, size int, err error) {
    	if r.i >= int64(len(r.s)) {
    		r.prevRune = -1
    		return 0, 0, io.EOF
    	}
    	r.prevRune = int(r.i)
    	if c := r.s[r.i]; c < utf8.RuneSelf {
    		r.i++
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 13 17:10:31 UTC 2023
    - 3.9K bytes
    - Viewed (0)
  3. src/fmt/scan.go

    type ScanState interface {
    	// ReadRune reads the next rune (Unicode code point) from the input.
    	// If invoked during Scanln, Fscanln, or Sscanln, ReadRune() will
    	// return EOF after returning the first '\n' or when reading beyond
    	// the specified width.
    	ReadRune() (r rune, size int, err error)
    	// UnreadRune causes the next call to ReadRune to return the same rune.
    	UnreadRune() error
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:56:20 UTC 2024
    - 31.9K bytes
    - Viewed (0)
  4. src/strings/reader_test.go

    	}
    	if r.Size() != 3 {
    		t.Errorf("Size = %d; want 3", r.Size())
    	}
    }
    
    func TestReaderReset(t *testing.T) {
    	r := strings.NewReader("世界")
    	if _, _, err := r.ReadRune(); err != nil {
    		t.Errorf("ReadRune: unexpected error: %v", err)
    	}
    
    	const want = "abcdef"
    	r.Reset(want)
    	if err := r.UnreadRune(); err == nil {
    		t.Errorf("UnreadRune: expected error, got nil")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 5.9K bytes
    - Viewed (0)
  5. src/bufio/bufio_test.go

    	}
    }
    
    func TestUnreadRuneAtEOF(t *testing.T) {
    	// UnreadRune/ReadRune should error at EOF (was a bug; used to panic)
    	r := NewReader(strings.NewReader("x"))
    	r.ReadRune()
    	r.ReadRune()
    	r.UnreadRune()
    	_, _, err := r.ReadRune()
    	if err == nil {
    		t.Error("expected error at EOF")
    	} else if err != io.EOF {
    		t.Error("expected EOF; got", err)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 10 18:56:01 UTC 2023
    - 51.5K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods/doc.go

    // signature for that interface.
    //
    // Checked method names include:
    //
    //	Format GobEncode GobDecode MarshalJSON MarshalXML
    //	Peek ReadByte ReadFrom ReadRune Scan Seek
    //	UnmarshalJSON UnreadByte UnreadRune WriteByte
    //	WriteTo
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 09 01:28:01 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  7. src/bytes/buffer_test.go

    		t.Fatal("UnreadRune at EOF: got no error")
    	}
    	if _, _, err := buf.ReadRune(); err == nil {
    		t.Fatal("ReadRune at EOF: got no error")
    	}
    	if err := buf.UnreadRune(); err == nil {
    		t.Fatal("UnreadRune after ReadRune at EOF: got no error")
    	}
    
    	// check not at EOF
    	buf.Write(b)
    	for r := rune(0); r < NRune; r++ {
    		r1, size, _ := buf.ReadRune()
    		if err := buf.UnreadRune(); err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 13:31:36 UTC 2024
    - 18.6K bytes
    - Viewed (0)
  8. src/io/io.go

    }
    
    // RuneReader is the interface that wraps the ReadRune method.
    //
    // ReadRune reads a single encoded Unicode character
    // and returns the rune and its size in bytes. If no character is
    // available, err will be set.
    type RuneReader interface {
    	ReadRune() (r rune, size int, err error)
    }
    
    // RuneScanner is the interface that adds the UnreadRune method to the
    // basic ReadRune method.
    //
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 15 17:34:10 UTC 2024
    - 21.6K bytes
    - Viewed (0)
  9. src/bufio/bufio.go

    // of the line. The returned buffer is only valid until the next call to
    // ReadLine. ReadLine either returns a non-nil line or it returns an error,
    // never both.
    //
    // The text returned from ReadLine does not include the line end ("\r\n" or "\n").
    // No indication or error is given if the input ends without a final line end.
    // Calling [Reader.UnreadByte] after ReadLine will always unread the last byte read
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 12 14:39:08 UTC 2023
    - 21.8K bytes
    - Viewed (0)
  10. src/fmt/doc.go

    when there is no space between input values.  If the reader
    provided to [Fscan] implements ReadRune, that method will be used
    to read characters.  If the reader also implements UnreadRune,
    that method will be used to save the character and successive
    calls will not lose data.  To attach ReadRune and UnreadRune
    methods to a reader without that capability, use
    [bufio.NewReader].
    */
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 21:56:20 UTC 2024
    - 14.6K bytes
    - Viewed (0)
Back to top