package main
import (
"fmt"
"reflect"
)
type TokenType string
type Token struct {
Type TokenType
Literal string
}
const (
ILLEGAL = "ILLEGAL"
EOF = "EOF"
//Identifiers + Literals
IDENT = "IDENT" //ADD, foorbar, X ,Y ...
INT = "INT" //1,2,3,4...,N
//Operators
ASSIGN = "="
PLUS = "+"
//Delimiters
COMMA = ","
SEMICOLON = ";"
LPAREN = "("
RPAREN = ")"
LBRACE = "{"
RBRACE = "}"
//Keywords
FUNCTION = "FUNCTION"
LET = "LET"
)
func main(){
structure:=Token{
Type: ILLEGAL,
}
fmt.Println(reflect.TypeOf(structure.Type),structure)
}
Can you explain me How ILLEGAL (string) convert to TokenType type ? And when and Where does this automated process repeat? Slicer?Array? Map?
Thank you