parser

package
v0.0.0-...-97dcd37 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 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, macros Macros) (*expr.ParsedExpr, *common.Errors)

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

func ParseText

func ParseText(text string) (*expr.ParsedExpr, *common.Errors)

ParseText converts a text input into a parsed expression, if valid, as well as a list of syntax errors encountered.

By default all macros are enabled. For customization of the input data or for customization of the macro set see Parse.

Note: syntax errors may produce parse trees of unusual shape which could in segfaults at parse-time. While the code attempts to account for all such cases, it is possible a few still remain. These should be fixed by adding a repro case to the parser_test.go and appropriate defensive coding within the parser.

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

func (*Macro) GetIsInstanceStyle

func (m *Macro) GetIsInstanceStyle() bool

func (*Macro) GetName

func (m *Macro) GetName() string

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