action

package
v0.0.0-...-8ffb5d3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package action parses action from text.

A action consists of <%, optional whitespace, a action name, zero or more arguments, optional whitespace and a %>.

A action name consists of a letter followed by zero or more letters, digits, hyphens or colons.

An argument consists of whitespace, an argument name, and an optional argument value specification.

An argument name consists of a letter or _, followed by zero or more letters, digits, _, ., :, or -.

An argument value specification consists of optional whitespace, an optional + charecter, a = character, optional whitespace, and an argument value.

An argument value consists of an unquoted argument value, a single-quoted argument value,or a double-quoted argument value.

An unquoted argument value is a nonempty string of characters not including whitespace, ", ', `, =, or any character in an action delimiter.

A single-quoted argument value consists of ', zero or more characters not including ', and a final '.

A double-quoted argument value consists of ", zero or more characters not including ", and a final ".

Argument values are unescaped using HTML rules.

Index

Constants

View Source
const TextAction = "__text__"

Variables

This section is empty.

Functions

func Parse

func Parse(input []byte, fpath string) ([]*Action, *LocationContext, error)

func ParseFile

func ParseFile(fpath string) ([]*Action, *LocationContext, error)

Types

type Action

type Action struct {
	Name string
	Args map[string]Value
	Text []byte // set for TextAction
	// contains filtered or unexported fields
}

func (*Action) Location

func (a *Action) Location(lc *LocationContext) string

type LocationContext

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

type Value

type Value struct {
	Text string
	// contains filtered or unexported fields
}

func (Value) Location

func (v Value) Location(lc *LocationContext) string

Jump to

Keyboard shortcuts

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