Documentation
¶
Index ¶
Constants ¶
View Source
const ( SymCmdStart = '*' SymCmdSep = '|' SymEscapeSeq = '^' SymArgStart = ':' SymArgSep = ',' SymArgDoubleQuote = '"' SymArgSingleQuote = '\'' SymAdvArgStart = '?' SymAdvArgSep = '&' SymAdvArgEq = '=' SymJSONStart = '{' SymJSONEnd = '}' SymJSONEscapeSeq = '\\' SymJSONString = '"' SymInputMacroEscapeSeq = '\\' SymInputMacroExtStart = '{' SymInputMacroExtEnd = '}' SymExpressionStart = '[' SymExpressionEnd = ']' TokExpStart = "\uE000" TokExprEnd = "\uE001" )
Variables ¶
View Source
var ( ErrUnexpectedEOF = errors.New("unexpected end of file") ErrInvalidCmdName = errors.New("invalid characters in command name") ErrInvalidAdvArgName = errors.New("invalid characters in advanced arg name") ErrEmptyCmdName = errors.New("command name is empty") ErrEmptyZapScript = errors.New("script is empty") ErrUnmatchedQuote = errors.New("unmatched quote") ErrInvalidJSON = errors.New("invalid JSON argument") ErrUnmatchedInputMacroExt = errors.New("unmatched input macro extension") ErrUnmatchedExpression = errors.New("unmatched expression") ErrBadExpressionReturn = errors.New("expression return type not supported") )
Functions ¶
This section is empty.
Types ¶
type ArgExprEnv ¶
type ArgExprEnv struct {
ActiveMedia ExprEnvActiveMedia `expr:"active_media"`
Device ExprEnvDevice `expr:"device"`
LastScanned ExprEnvLastScanned `expr:"last_scanned"`
Platform string `expr:"platform"`
Version string `expr:"version"`
ScanMode string `expr:"scan_mode"`
MediaPlaying bool `expr:"media_playing"`
}
type CustomLauncherExprEnv ¶
type CustomLauncherExprEnv struct {
Platform string `expr:"platform"`
Version string `expr:"version"`
Device ExprEnvDevice `expr:"device"`
MediaPath string `expr:"media_path"`
}
type ExprEnvActiveMedia ¶
type ExprEnvDevice ¶
type ExprEnvLastScanned ¶
type PostArgPart ¶
type PostArgPart struct {
Value string
Type PostArgPartType
}
type PostArgPartType ¶
type PostArgPartType int
const ( ArgPartTypeUnknown PostArgPartType = iota ArgPartTypeString ArgPartTypeExpression )
type ScriptReader ¶
type ScriptReader struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(value string) *ScriptReader
func (*ScriptReader) EvalExpressions ¶
func (sr *ScriptReader) EvalExpressions(exprEnv any) (string, error)
func (*ScriptReader) ParseExpressions ¶
func (sr *ScriptReader) ParseExpressions() (string, error)
ParseExpressions parses and converts expressions in the input string from [[...]] formatted expression fields to internal expression token delimiters, to be evaluated by the EvalExpressions function. This function ONLY parses expression symbols and escape sequences, no other ZapScript syntax.
func (*ScriptReader) ParseScript ¶
func (sr *ScriptReader) ParseScript() (Script, error)
Click to show internal directories.
Click to hide internal directories.