token

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

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

Token contains a slice of runes representing the raw value and value in lowercase form.

This is used for the

func Append

func Append(t Token, o Token) Token

Append appends all of o to t

func AppendRune

func AppendRune(t Token, r rune) Token

AppendRune append the rune to the current token.

func FromRunes

func FromRunes(value []rune) Token

func FromString

func FromString[T ~string](value T) Token

func (Token) IsNumber

func (t Token) IsNumber(additionalRules ...map[rune]func(index int, r rune, val []rune) bool) bool

IsNumber reports true if the Token is considered a valid number based on the following rules:

- If the Token is composed only of numbers

- If the Token is prefixed with any of the following: + - . v V # and followed by a number

- Numbers may only be seperated by a single '.' and '.' may be the first rune or proceeded by a number, '+', or '-'

- A single 'e' or 'E' may only be used in the exponent portion of a number

- 'e' or 'E' may be followed

- ',' must be preceded by a number and followed by a number

- if additionalRules is not nil and the rune is present in the map, the result of the provided func overrides the rules above

func (Token) Len

func (t Token) Len() int

Len returns the number of runes in the Part.

func (Token) Lower

func (t Token) Lower() string

func (Token) LowerFirst

func (t Token) LowerFirst() string

func (Token) Split

func (t Token) Split() []Token

Split returns the current token split into a slice of Tokens for each rune in the list.

func (Token) String

func (t Token) String() string

func (Token) Upper

func (t Token) Upper() string

func (Token) UpperFirst

func (t Token) UpperFirst() string

func (Token) UpperFirstLowerRest

func (t Token) UpperFirstLowerRest() string

func (Token) Value

func (t Token) Value() string

Jump to

Keyboard shortcuts

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