utf8

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 0 Imported by: 6

README

go-utf8

Go Report Card License MIT Go Doc

Install

go get -u github.com/danielgatis/go-utf8

And then import the package in your code:

import "github.com/danielgatis/go-utf8"
Example

Please look at: examples/parserlog/main.go

License

Copyright (c) 2024-present Daniel Gatis

Licensed under MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action = byte

Action represents a action type

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser represents a state machine

func New

func New(performer Performer) *Parser

New returns a new parser

func (*Parser) Advance

func (p *Parser) Advance(b byte)

Advance advances the state machine

func (*Parser) Codepoint

func (p *Parser) Codepoint() rune

Codepoint returns a codepoint

func (*Parser) State

func (p *Parser) State() State

State returns the current state

func (*Parser) StateName

func (p *Parser) StateName() string

StateName returns the current state name

type Performer

type Performer interface {
	// CodePoint is called when a codepoint is emitted.
	CodePoint(r rune)

	// InvalidSequence is called when an invalid sequence is found.
	InvalidSequece()
}

Performer is an interface for parsing.

type State

type State = byte

State represents a state type

Directories

Path Synopsis
examples
parserlog command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL