parse

package
v0.1.33 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const LoopBreak = 1000

We have an infinite parsing loop somewhere, if we break it we get parsing errors in the test data we have....Meaning we depend on a 'return true' that should be a 'false' Just quit after 1000(?) loops, until we get a good handle on this. Stuff is fast enough, that you don't notice and you get a nice error.

Variables

This section is empty.

Functions

func Aitem

func Aitem(b *rd.Builder) (ok bool)

func Aitems

func Aitems(b *rd.Builder) (ok bool)

func ArgList

func ArgList(b *rd.Builder) (ok bool)

func Body

func Body(b *rd.Builder) (ok bool)

func BodyBody

func BodyBody(b *rd.Builder) (ok bool)

func BodySelections

func BodySelections(b *rd.Builder) (ok bool)

func Bundle

func Bundle(b *rd.Builder) (ok bool)

func BundleBody

func BundleBody(b *rd.Builder) (ok bool)

func ClassGuardPromises

func ClassGuardPromises(b *rd.Builder) (ok bool)

func ClassGuardSelections

func ClassGuardSelections(b *rd.Builder) (ok bool)

func ClassPromises

func ClassPromises(b *rd.Builder) (ok bool)

func Comment

func Comment(b *rd.Builder) (ok bool)

func Comments

func Comments(b *rd.Builder) (ok bool)

func Constraint

func Constraint(b *rd.Builder) (ok bool)

func Equal

func Equal(a rd.Token, t token.T) bool

func EqualType

func EqualType(a rd.Token, tt chroma.TokenType) bool

func FatArrow

func FatArrow(b *rd.Builder) (ok bool)

func Fmt

func Fmt(b *rd.Builder, a string, i int)

func Function

func Function(b *rd.Builder) (ok bool)

func GaItem

func GaItem(b *rd.Builder) (ok bool)

func GaItems

func GaItems(b *rd.Builder) (ok bool)

func GiveArgList

func GiveArgList(b *rd.Builder) (ok bool)

func Lex

func Lex(specification string) ([]rd.Token, error)

func List

func List(b *rd.Builder) (ok bool)

func Litem

func Litem(b *rd.Builder) (ok bool)

func Litems

func Litems(b *rd.Builder) (ok bool)

func Macro

func Macro(b *rd.Builder) (ok bool)

func Match

func Match(b *rd.Builder, t token.T) bool

Match matches the next token type to tt. If OK the token is added to the tree.

func MatchDiscard

func MatchDiscard(b *rd.Builder, t token.T) bool

MatchDiscard matches the next token type to tt. If OK the token is not added to the tree, but discarded.

func MatchType

func MatchType(b *rd.Builder, tt chroma.TokenType) bool

MatchType matches the next token type to tt. If OK the token is added to the tree.

func NakedVar

func NakedVar(b *rd.Builder) (ok bool)

func NamespaceFunction added in v0.1.27

func NamespaceFunction(b *rd.Builder) (ok bool)

NamespaceFunction parses the (relative?) new syntax "default:function", this is lexed as: KeywordDeclaration Punctuation(:) NameFunction. This functions check for that. It adds a Function to the AST.

func Peek

func Peek(b *rd.Builder, t token.T) bool

Peek will peek the next token.

func PeekClassGuard

func PeekClassGuard(b *rd.Builder) (ok bool)

PeekClassGuard checks for a classguard by peeking the next 2 tokens.

func PeekPromiseGuard

func PeekPromiseGuard(b *rd.Builder) (ok bool)

PeekPromiseGuard checks for a classguard by peeking the next 2 tokens.

func Print

func Print(w io.Writer, tree *rd.Tree)

Print pretty prints the CFengine AST in tree.

func Promise

func Promise(b *rd.Builder) (ok bool)

func PromiseConstraints

func PromiseConstraints(b *rd.Builder) (ok bool)

func PromiseGuard

func PromiseGuard(b *rd.Builder) (ok bool)

func Promisee

func Promisee(b *rd.Builder) (ok bool)

func Promises

func Promises(b *rd.Builder) (ok bool)

func Qstring

func Qstring(b *rd.Builder) (ok bool)

func Rval

func Rval(b *rd.Builder) (ok bool)

func Selection

func Selection(b *rd.Builder) (ok bool)

func Specification

func Specification(b *rd.Builder) (ok bool)

func ThinArrow

func ThinArrow(b *rd.Builder) (ok bool)

func WalkFunc

func WalkFunc(tree *rd.Tree, f TreeVisitorFunc)

WalkFunc is like Walk but accepts just a callback function.

Types

type Printer

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

Printer used for some housekeeping during printing.

type TreeVisitor

type TreeVisitor interface {
	Visit(tree *rd.Tree, entering bool) WalkStatus
}

TreeVisitor is a callback to be called when traversing the syntax tree. Called twice for every node: once with entering=true when the branch is first visited, then with entering=false after all the children are done.

type TreeVisitorFunc

type TreeVisitorFunc func(tree *rd.Tree, entering bool) WalkStatus

TreeVisitorFunc casts a function to match TreeVisitor interface.

func (TreeVisitorFunc) Visit

func (f TreeVisitorFunc) Visit(tree *rd.Tree, entering bool) WalkStatus

Visit calls visitor function.

type WalkStatus

type WalkStatus int
const (
	// GoToNext is the default traversal of every node.
	GoToNext WalkStatus = iota
	// SkipChildren tells walker to skip all children of current node.
	SkipChildren
	// Terminate tells walker to terminate the traversal.
	Terminate
)

func Walk

func Walk(tree *rd.Tree, visitor TreeVisitor) WalkStatus

Walk traverses tree recursively.

Jump to

Keyboard shortcuts

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