src.elv.shsrc.elv.sh/pkg/parse/cmpd Index | Files

package cmpd

import "src.elv.sh/pkg/parse/cmpd"

Package cmpd contains utilities for working with compound nodes.

Index

Functions

func Lambda

func Lambda(n *parse.Compound) (*parse.Primary, bool)

Lambda returns a lambda primary node and true if that's the only child of the compound node. Otherwise it returns nil and false.

func Primary

func Primary(n *parse.Compound) (*parse.Primary, bool)

Primary returns a primary node and true if that's the only child of the compound node. Otherwise it returns nil and false.

func Shape

func Shape(n *parse.Compound) string

Shape describes the shape of the compound node.

func StringLiteral

func StringLiteral(n *parse.Compound) (string, bool)

StringLiteral returns the value of a string literal and true if that's the only child of the compound node. Otherwise it returns "" and false.

func StringLiteralOrError

func StringLiteralOrError(n *parse.Compound, what string) (string, error)

StringLiteralOrError is like StringLiteral, but returns an error suitable as a compiler error when StringLiteral would return false.

Source Files

cmpd.go

Version
v0.21.0 (latest)
Published
Aug 13, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
6 hours ago

Tools for package owners.