parser

package
v0.0.0-...-e76ba11 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapitalizeTransformer

type CapitalizeTransformer struct{}

type LiteralOp

type LiteralOp struct {
	Value string
}

type Message

type Message struct {
	Ops []any
}

func Parse

func Parse(input string) (*Message, error)

func (Message) Raw

func (m Message) Raw() string

type OpPluralCaseType

type OpPluralCaseType int
const (
	OpPluralCaseTypeRange OpPluralCaseType = iota
	OpPluralCaseTypeExact
	OpPluralCaseOther
)

type PluralCase

type PluralCase struct {
	Type OpPluralCaseType
	A    int
	B    int

	// Ops is a list of operations that should be applied if the case is true.
	// This can be a list of LiteralOp and PluralCountOp.
	Ops []any
}

func (PluralCase) Match

func (c PluralCase) Match(count int) bool

type PluralCountOp

type PluralCountOp struct{}

type PluralTransformer

type PluralTransformer struct {
	Cases []PluralCase
	Other []any
}

type ReplaceTransformer

type ReplaceTransformer struct{}

type ReplacementOp

type ReplacementOp struct {
	Key          string
	Transformers []any
}

type Token

type Token struct {
	TokenType tokenType
	Data      string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳