Documentation ¶
Index ¶
- Constants
- func Angle(value abs.Value) abs.AngleLike
- func Binary(value abs.Value) abs.BinaryLike
- func Boolean(value abs.Value) abs.BooleanLike
- func Bytecode(value abs.Value) abs.BytecodeLike
- func Catalog(source string) abs.CatalogLike
- func CatalogWithContext(associations Associations, context abs.ContextLike) abs.ComponentLike
- func Character(value abs.Value) abs.CharacterLike
- func Component(value abs.Value) abs.ComponentLike
- func ComponentWithContext(value abs.Value, context abs.ContextLike) abs.ComponentLike
- func Context(value abs.Value) abs.ContextLike
- func Continuum(first abs.Value, extent abs.Extent, last abs.Value, context abs.ContextLike) abs.ComponentLike
- func Duration(value abs.Value) abs.DurationLike
- func FormatComponent(component abs.ComponentLike) string
- func FormatComponentWithIndentation(component abs.ComponentLike, indentation int) string
- func FormatDocument(component abs.ComponentLike) []byte
- func FormatEntity(entity abs.Entity) string
- func FormatEntityWithIndentation(entity abs.Entity, indentation int) string
- func Formatter(indentation int) *formatter
- func Integer(value abs.Value) abs.IntegerLike
- func Interval(first abs.Value, extent abs.Extent, last abs.Value, context abs.ContextLike) abs.ComponentLike
- func List(source string) abs.ListLike
- func ListWithContext(values Values, context abs.ContextLike) abs.ComponentLike
- func Moment(value abs.Value) abs.MomentLike
- func Moniker(value abs.Value) abs.MonikerLike
- func Narrative(value abs.Value) abs.NarrativeLike
- func NewTag() abs.TagLike
- func NextVersion(current abs.VersionLike) abs.VersionLike
- func Number(value abs.Value) abs.NumberLike
- func ParseComponent(source string) abs.ComponentLike
- func ParseContext(source string) abs.ContextLike
- func ParseDocument(document []byte) abs.ComponentLike
- func ParseEntity(source string) abs.Entity
- func Parser(source []byte) *parser
- func Pattern(value abs.Value) abs.PatternLike
- func Percentage(value abs.Value) abs.PercentageLike
- func Probability(value abs.Value) abs.ProbabilityLike
- func Queue(source string) abs.QueueLike
- func QueueWithContext(capacity int, context abs.ContextLike) abs.ComponentLike
- func Quote(value abs.Value) abs.QuoteLike
- func Real(value abs.Value) abs.RealLike
- func Resource(value abs.Value) abs.ResourceLike
- func ScanTokens(source []byte, tokens chan Token) *scanner
- func Set(source string) abs.SetLike
- func SetWithContext(values Values, context abs.ContextLike) abs.ComponentLike
- func Spectrum(first abs.Value, extent abs.Extent, last abs.Value, context abs.ContextLike) abs.ComponentLike
- func Stack(source string) abs.StackLike
- func StackWithContext(capacity int, context abs.ContextLike) abs.ComponentLike
- func Symbol(value abs.Value) abs.SymbolLike
- func Tag(value abs.Value) abs.TagLike
- func Version(value abs.Value) abs.VersionLike
- type Associations
- type Token
- type TokenType
- type Values
Constants ¶
const EOL = "\n"
The POSIX standard end-of-line character.
Variables ¶
This section is empty.
Functions ¶
func Binary ¶
func Binary(value abs.Value) abs.BinaryLike
This constructor returns a new binary string initialized with the specified value.
func Boolean ¶
func Boolean(value abs.Value) abs.BooleanLike
This constructor returns a new boolean element initialized with the specified value.
func Bytecode ¶
func Bytecode(value abs.Value) abs.BytecodeLike
This constructor returns a new bytecode string initialized with the specified value.
func Catalog ¶
func Catalog(source string) abs.CatalogLike
This function parses a catalog from a source string.
func CatalogWithContext ¶
func CatalogWithContext(associations Associations, context abs.ContextLike) abs.ComponentLike
This constructor returns a new catalog component initialized with the specified associations and parameterized with the specified context.
func Character ¶ added in v2.1.0
func Character(value abs.Value) abs.CharacterLike
This constructor returns a new rune endpoint with the specified value.
func Component ¶
func Component(value abs.Value) abs.ComponentLike
This constructor returns a new component initialized with the specified value.
func ComponentWithContext ¶
func ComponentWithContext(value abs.Value, context abs.ContextLike) abs.ComponentLike
This constructor returns a new component initialized with the specified value and context.
func Context ¶
func Context(value abs.Value) abs.ContextLike
This constructor returns a new context initialized with the specified value.
func Continuum ¶
func Continuum(first abs.Value, extent abs.Extent, last abs.Value, context abs.ContextLike) abs.ComponentLike
This constructor returns a new continuous range with the specified endpoints.
func Duration ¶
func Duration(value abs.Value) abs.DurationLike
This constructor returns a new duration element initialized with the specified value.
func FormatComponent ¶
func FormatComponent(component abs.ComponentLike) string
This function returns a canonical BDN string for the specified component.
func FormatComponentWithIndentation ¶
func FormatComponentWithIndentation(component abs.ComponentLike, indentation int) string
This function returns a canonical BDN string for the specified component using the specified indentation.
func FormatDocument ¶
func FormatDocument(component abs.ComponentLike) []byte
This function returns a canonical BDN bytes for the specified component including the POSIX standard trailing EOL.
func FormatEntity ¶
This function returns a canonical BDN string for the specified entity.
func FormatEntityWithIndentation ¶
This function returns a canonical BDN string for the specified entity using the specified indentation.
func Formatter ¶
func Formatter(indentation int) *formatter
This constructor creates a new formatter using the specified indentation.
func Integer ¶
func Integer(value abs.Value) abs.IntegerLike
This constructor returns a new integer endpoint with the specified value.
func Interval ¶
func Interval(first abs.Value, extent abs.Extent, last abs.Value, context abs.ContextLike) abs.ComponentLike
This constructor returns a new continuous range with the specified endpoints. This constructor returns a new discrete range with the specified endpoints.
func ListWithContext ¶
func ListWithContext(values Values, context abs.ContextLike) abs.ComponentLike
This constructor returns a new list component initialized with the specified associations and parameterized with the specified context.
func Moment ¶
func Moment(value abs.Value) abs.MomentLike
This constructor returns a new moment element initialized with the specified value.
func Moniker ¶
func Moniker(value abs.Value) abs.MonikerLike
This constructor returns a new moniker string initialized with the specified value.
func Narrative ¶
func Narrative(value abs.Value) abs.NarrativeLike
This constructor returns a new narrative string initialized with the specified value.
func NextVersion ¶
func NextVersion(current abs.VersionLike) abs.VersionLike
This constructor returns the next version string for the specified version.
func Number ¶
func Number(value abs.Value) abs.NumberLike
This constructor returns a new number element initialized with the specified value.
func ParseComponent ¶
func ParseComponent(source string) abs.ComponentLike
This function parses a source string rather than the bytes from a BDN document file. It is useful when parsing strings within source code.
func ParseContext ¶
func ParseContext(source string) abs.ContextLike
This function parses an entity from a source string.
func ParseDocument ¶
func ParseDocument(document []byte) abs.ComponentLike
This function parses the specified Bali Document Notation™ (BDN) source bytes retrieved from a POSIX compliant file and returns the corresponding abstract syntax tree as defined in the language specification:
https://github.com/bali-nebula/bali-nebula/wiki/Language-Specification
All parser rules in the specification are shown in lowerCamelCase and scanner tokens shown in UPPERCASE.
A POSIX compliant file must end with a EOL character before the EOF marker.
func ParseEntity ¶
This function parses an entity from a source string.
func Parser ¶
func Parser(source []byte) *parser
This constructor creates a new parser using the specified byte array.
func Pattern ¶
func Pattern(value abs.Value) abs.PatternLike
This constructor returns a new pattern element initialized with the specified value.
func Percentage ¶
func Percentage(value abs.Value) abs.PercentageLike
This constructor returns a new percentage element initialized with the specified value.
func Probability ¶
func Probability(value abs.Value) abs.ProbabilityLike
This constructor returns a new probability element initialized with the specified value.
func QueueWithContext ¶
func QueueWithContext(capacity int, context abs.ContextLike) abs.ComponentLike
This constructor returns a new queue component with the specified capacity and parameterized with the specified context.
func Resource ¶
func Resource(value abs.Value) abs.ResourceLike
This constructor returns a new resource element initialized with the specified value.
func ScanTokens ¶ added in v2.1.0
This function creates a new scanner initialized with the specified array of bytes. The scanner will automatically generating tokens that match the corresponding regular expressions.
func SetWithContext ¶
func SetWithContext(values Values, context abs.ContextLike) abs.ComponentLike
This constructor returns a new set component initialized with the specified associations and parameterized with the specified context.
func Spectrum ¶
func Spectrum(first abs.Value, extent abs.Extent, last abs.Value, context abs.ContextLike) abs.ComponentLike
This constructor returns a new lexical range with the specified endpoints.
func StackWithContext ¶
func StackWithContext(capacity int, context abs.ContextLike) abs.ComponentLike
This constructor returns a new stack component with the specified capacity and parameterized with the specified context.
func Symbol ¶
func Symbol(value abs.Value) abs.SymbolLike
This constructor returns a new symbol element initialized with the specified value.
Types ¶
type Associations ¶
type Associations [][2]any
type Token ¶
type Token struct { Type TokenType Value string Line int // The line number of the token in the input string. Position int // The position in the line of the first rune of the token. }
This type defines the structure and methods for each token returned by the scanner.
type TokenType ¶
type TokenType string
This string type is used as a type identifier for each token.
const ( TokenANGLE TokenType = "ANGLE" TokenBINARY TokenType = "BINARY" TokenBOOLEAN TokenType = "BOOLEAN" TokenBYTECODE TokenType = "BYTECODE" TokenCOMMENT TokenType = "COMMENT" TokenDELIMITER TokenType = "DELIMITER" TokenDURATION TokenType = "DURATION" TokenEOL TokenType = "EOL" TokenEOF TokenType = "EOF" TokenERROR TokenType = "ERROR" TokenIDENTIFIER TokenType = "IDENTIFIER" TokenINTRINSIC TokenType = "INTRINSIC" TokenKEYWORD TokenType = "KEYWORD" TokenMOMENT TokenType = "MOMENT" TokenMONIKER TokenType = "MONIKER" TokenNARRATIVE TokenType = "NARRATIVE" TokenNOTE TokenType = "NOTE" TokenNUMBER TokenType = "NUMBER" TokenPATTERN TokenType = "PATTERN" TokenPERCENTAGE TokenType = "PERCENTAGE" TokenPROBABILITY TokenType = "PROBABILITY" TokenQUOTE TokenType = "QUOTE" TokenRESOURCE TokenType = "RESOURCE" TokenSYMBOL TokenType = "SYMBOL" TokenTAG TokenType = "TAG" TokenVERSION TokenType = "VERSION" TokenWHITESPACE TokenType = "WHITESPACE" )
This enumeration defines all possible token types including the error token.