parser

package
v0.0.0-...-e081c89 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package parser is a faster murex parser for real time context hints

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSafeCmds

func GetSafeCmds() []string

GetSafeCmds returns a slice of the safeCmds

func ReadSafeCmds

func ReadSafeCmds() (interface{}, error)

ReadSafeCmds returns an interface{} of the safeCmds. This is only intended to be used by `config.Properties.GoFunc.Read()`

func WriteSafeCmds

func WriteSafeCmds(v interface{}) error

WriteSafeCmds takes a JSON-encoded string and writes it to the safeCmds slice. This is only intended to be used by `config.Properties.GoFunc.Write()`

Types

type ParsedTokens

type ParsedTokens struct {
	Source        []rune
	LastCharacter rune
	Loc           int
	VarLoc        int
	VarBrace      bool
	VarSigil      string
	Escaped       bool
	Comment       bool
	CommentMsg    string

	QuoteSingle   bool
	QuoteDouble   bool
	QuoteBrace    int
	NestedBlock   int
	SquareBracket bool
	AngledBracket bool
	ExpectFunc    bool
	ExpectParam   bool

	LastFuncName  string
	FuncName      string
	Parameters    []string
	Unsafe        bool // if the pipeline is estimated to be safe enough to dynamically preview
	LastFlowToken int
	PipeToken     PipeToken
	// contains filtered or unexported fields
}

ParsedTokens is a struct that returns a tokenized version of the selected command

func Parse

func Parse(block []rune, pos int) (pt ParsedTokens, syntaxHighlighted string)

Parse a single line of code and return the tokens for a selected command

type PipeToken

type PipeToken int

PipeToken stores an integer value for the pipe token used in a pipeline

const (
	PipeTokenNone     PipeToken = 0    // No pipe token
	PipeTokenPosix    PipeToken = iota // `|`  (POSIX style pipe)
	PipeTokenArrow                     // `->` (murex style pipe)
	PipeTokenGeneric                   // `=>` (reformat to generic)
	PipeTokenRedirect                  // `?`  (STDERR redirected to STDOUT and vice versa)
	PipeTokenAppend                    // `>>` (append STDOUT to a file)
)

These are different pipe tokens

func (PipeToken) String

func (i PipeToken) String() string

Jump to

Keyboard shortcuts

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