asts

package
v0.0.0-...-5e192c7 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Packages asts contains utilities for constructing and manipulating ASTs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BraceText

func BraceText(depth int, ss ...interface{}) *ast.ParsedText

BraceTextExpr returns parsed text delimited by braces. Uses the following strategies to convert each string into a text expression:

  • If the string is all whitespace, convert to ast.TextSpace.
  • If the string begins and ends with '$', convert to ast.TextMath.
  • If the string begins with '{' and ends with '}', convert to brace text recursively by removing the braces and splitting on space.
  • If the string is ',', convert to ast.TextComma.
  • If the string begins with '\' and has an alphabetical char, convert to command ast.TextMacro.
  • Otherwise, convert to ast.Text.

func BraceTextExpr

func BraceTextExpr(depth int, ss ...ast.Expr) *ast.ParsedText

BraceTextExpr return parsed text delimited by braces.

func Comma

func Comma() *ast.TextComma

func Concat

func Concat(x, y ast.Expr) ast.Expr

func Escaped

func Escaped(c rune) *ast.TextEscaped

func ExprString

func ExprString(x ast.Expr) string

func Ident

func Ident(s string) ast.Expr

func Macro

func Macro(name string, params ...interface{}) *ast.TextMacro

func Math

func Math(x string) *ast.TextMath

func NBSP

func NBSP() *ast.TextNBSP

func ParseAny

func ParseAny(s interface{}) ast.Expr

ParseAny converts s into an ast.Expr or panics.

func ParseStringExpr

func ParseStringExpr(depth int, s string) ast.Expr

func QuotedText

func QuotedText(depth int, ss ...string) *ast.ParsedText

QuotedText returns parsed text delimited by braces. Uses the following strategies to convert each string into a text expression:

  • If the string is all whitespace, convert to ast.TextSpace.
  • If the string begins and ends with '$', convert to ast.TextMath.
  • If the string begins with '{' and ends with '}', convert to brace text recursively by removing the braces and splitting on space.
  • If the string is ',', convert to ast.TextComma.
  • Otherwise, convert to ast.Text.

func QuotedTextExpr

func QuotedTextExpr(depth int, ss ...ast.Expr) *ast.ParsedText

QuotedTextExpr return parsed text delimited by quotes.

func Space

func Space() *ast.TextSpace

func Text

func Text(s string) *ast.Text

func UnparsedBraceText

func UnparsedBraceText(s string) *ast.UnparsedText

func UnparsedText

func UnparsedText(s string) ast.Expr

func WithBibKeys

func WithBibKeys(ts ...string) func(decl *ast.BibDecl)

func WithBibTags

func WithBibTags(key string, val ast.Expr, rest ...interface{}) func(decl *ast.BibDecl)

func WithBibType

func WithBibType(s string) func(decl *ast.BibDecl)

Types

This section is empty.

Jump to

Keyboard shortcuts

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