lang

package
v0.0.0-...-7ecc845 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MAX_ALIAS_DEPTH = 8

Variables

This section is empty.

Functions

func CheckCommand

func CheckCommand(name string) bool

func Compile

func Compile(expressions []Expression) ([]utils.CommandInput, error)

func Scan

func Scan(content string) ([]utils.CommandInput, error)

func StringTilChar

func StringTilChar(content []rune, i int, startCond func(c []rune, i int) bool, endCond func(c []rune, i int) bool) ([]rune, int)

Types

type Expression

type Expression struct {
	Type    ExpressionType
	Content string
}

func Parse

func Parse(tokens []Token) ([]Expression, error)

type ExpressionType

type ExpressionType int64
const (
	COMMAND ExpressionType = iota
	ARGUMENT
)

type Token

type Token struct {
	Type  TokenType
	Lexme string
}

func FindAlias

func FindAlias(name string) ([]Token, error)

func Lex

func Lex(contentStr string) []Token

func LexDoubleQuoteString

func LexDoubleQuoteString(tokens []Token, content []rune, i int) ([]Token, int, bool)

func LexGraveString

func LexGraveString(tokens []Token, content []rune, i int) ([]Token, int, bool)

func LexIdentifier

func LexIdentifier(tokens []Token, content []rune, i int) ([]Token, int, bool)

func LexPipe

func LexPipe(tokens []Token, content []rune, i int) ([]Token, int, bool)

func LexSingleQuoteString

func LexSingleQuoteString(tokens []Token, content []rune, i int) ([]Token, int, bool)

func LexTripleDoubleQuoteString

func LexTripleDoubleQuoteString(tokens []Token, content []rune, i int) ([]Token, int, bool)

type TokenType

type TokenType int64
const (
	IDENTIFIER TokenType = iota
	SEPARATOR
	EOF
)

Jump to

Keyboard shortcuts

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