lexer

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package lexer contains FlagTokenizer which parses args/actions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlagTokenizer

type FlagTokenizer struct {
	BooleanFlags sets.TinySet[string]
	Tokenized    map[string]string
	Actions      []string
}

FlagTokenizer holds the names of the boolean flags and uses them the tokenize the input args into args and actions. Actions are args that are not flags.

After calling FlagTokenizer.TokenizeFlags the Tokenized and Action fields will be initialized.

func NewFlagTokenizer

func NewFlagTokenizer(booleanFlags ...string) *FlagTokenizer

NewFlagTokenizer creates a new FlagTokenizer from a list of boolean flag names

func (*FlagTokenizer) TokenizeFlags

func (ft *FlagTokenizer) TokenizeFlags(args []string)

TokenizeFlags sorts the args into flags and actions, without parsing the values.

Jump to

Keyboard shortcuts

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