Symbols - craterdog/go-component-framework GitHub Wiki

Overview

A symbol element represents the name of a variable rather than its value. Each symbol has the following string format:

$symbol: '$' identifier*
$identifier: LETTER (LETTER | DIGIT | '-')*

The source of this format is Bali Document Notation™ (Bali) defined here.

UML Diagram

A Quick Example

To whet your appetite, here is some short example code that demonstrates the use of symbol strings.

package main

import (
	fmt "fmt"
	fra "github.com/craterdog/go-component-framework/v7"
)

func main() {
	// Create a new symbol string using the module level constructor shortcut.
	var symbol = fra.SymbolFromString(`$file-name`)
	fmt.Println(symbol.AsString())
	fmt.Println()

	// Iterate through the characters that make up the symbol.
	var iterator = symbol.GetIterator()
	for iterator.HasNext() {
		var character = iterator.GetNext()
		fmt.Println(character)
	}
}

Try it out in the Go Playground...