parser

package
v0.0.0-...-bd88044 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package parser declares an expression parser with support for macro expansion.

Index

Constants

This section is empty.

Variables

View Source
var AllMacros = []Macro{

	{
		// contains filtered or unexported fields
	},

	{
		// contains filtered or unexported fields
	},

	{
		// contains filtered or unexported fields
	},

	{
		// contains filtered or unexported fields
	},

	{
		// contains filtered or unexported fields
	},

	{
		// contains filtered or unexported fields
	},

	{
		// contains filtered or unexported fields
	},
}

AllMacros includes the list of all spec-supported macros.

View Source
var NoMacros = []Macro{}

NoMacros list.

Functions

func Parse

func Parse(source common.Source) (*exprpb.ParsedExpr, *common.Errors)

Parse converts a source input a parsed expression. This function calls ParseWithMacros with AllMacros.

func ParseWithMacros

func ParseWithMacros(source common.Source, macros Macros) (*exprpb.ParsedExpr, *common.Errors)

ParseWithMacros converts a source input and macros set to a parsed expression.

Types

type Macro

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

Macro type which declares the function name and arg count expected for the macro, as well as a macro expansion function.

func (*Macro) GetArgCount

func (m *Macro) GetArgCount() int

GetArgCount returns the number of arguments the macro expects.

func (*Macro) GetIsInstanceStyle

func (m *Macro) GetIsInstanceStyle() bool

GetIsInstanceStyle returns whether the macro is "instance" (reciever) style.

func (*Macro) GetName

func (m *Macro) GetName() string

GetName returns the macro's name (i.e. the function whose syntax it mimics).

type Macros

type Macros []Macro

Macros type alias for a collection of Macros.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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