text

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Indentation string       `@('\n' (' '|'\t')+)`
	Identifiers []Identifier `@@+`
}

type Identifier

type Identifier struct {
	Name      string `@('-'|Let|Num)+`
	Separator string `@(',' ' ')?`
}

type Text

type Text struct {
	Arguments []Argument `(@@|`
	// contains filtered or unexported fields
}

Text is both used as the grammar and the tree representation of the abstract syntactic structure of a doc string.

func Parse

func Parse(doc string) (Text, error)

Parse returns the AST of the given text.

func (*Text) Identifiers

func (t *Text) Identifiers(name string) (identifiers []string)

Identifiers returns all identifiers of an argument if any of them match the given value.

func (*Text) IsValidIdentifier

func (t *Text) IsValidIdentifier(name string) bool

IsValidIdentifier returns true if the given value is a valid identifier of an argument or false otherwise.

Jump to

Keyboard shortcuts

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