package ctxio

import "git.sr.ht/~bouncepaw/mycomarkup/v5/parser/ctxio"

Package ctxio provides input and output operations on the input buffer in mycocontext.Context.

Index

Functions

func EatUntilSpace

func EatUntilSpace(ctx mycocontext.Context) (line string)

EatUntilSpace reads characters until it encounters a non-space character. The read characters are returned. No errors are reported even if there are any, be bold.

func IsEof

func IsEof(ctx mycocontext.Context) bool

IsEof is true if there is nothing left to read in the input. It does not handle the case when all next characters are \r, which are never returned by NextRune, thus making this function lie.

Be not afraid because everyone lies. Not a good idea to trust a //function// anyway.

func NextByte

func NextByte(ctx mycocontext.Context) (b byte, eof bool)

NextByte returns the next byte in the inputFrom. The CR byte (\r) is never returned, if there is a CR in the inputFrom, the byte after it is returned. If there is no next byte, the NL byte (\n) is returned and eof is true.

func NextLine

func NextLine(ctx mycocontext.Context) (line string, done bool)

NextLine returns the text in the inputFrom up to the next newline. The characters are gotten using nextByte.

func NextRune

func NextRune(ctx mycocontext.Context) (r rune, eof bool)

NextRune is like NextByte, but for runes.

func UnreadRune

func UnreadRune(ctx mycocontext.Context)

UnreadRune unreads the previous rune. Pray so it doesn't throw any errors, because they are ignored.

Source Files

ctxio.go

Version
v5.6.0 (latest)
Published
Nov 29, 2023
Platform
linux/amd64
Imports
2 packages
Last checked
1 day ago

Tools for package owners.