32 lines
774 B
Go
32 lines
774 B
Go
package tokenize_test
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
tokenize "git.makaay.nl/mauricem/go-parsekit/tokenize"
|
|
)
|
|
|
|
func ExampleToken_String() {
|
|
fmt.Println(tokenize.Token{Type: "Name", Value: "Peter Pan"})
|
|
|
|
fmt.Println(tokenize.Token{Type: "Gender", Value: 'm'})
|
|
|
|
fmt.Println(tokenize.Token{Type: "CanFly", Value: true})
|
|
|
|
fmt.Println(tokenize.Token{Type: "Friends", Value: []tokenize.Token{
|
|
{Type: "Name", Value: "Tinkerbell"},
|
|
{Type: "Name", Value: "Tootles"},
|
|
{Type: "Name", Value: "Slightly"},
|
|
{Type: "Name", Value: "Nibs"},
|
|
}})
|
|
|
|
fmt.Println(tokenize.Token{Type: "FirstMovieYear", Value: 1924})
|
|
|
|
// Output:
|
|
// Name("Peter Pan")
|
|
// Gender('m')
|
|
// CanFly(true)
|
|
// Friends[Name("Tinkerbell") Name("Tootles") Name("Slightly") Name("Nibs")]
|
|
// FirstMovieYear((int)1924)
|
|
}
|