feat: scanner added

This commit is contained in:
2026-02-11 20:28:29 -05:00
parent aca197ef51
commit b3f9f08c62
6 changed files with 136 additions and 183 deletions

View File

@@ -18,18 +18,6 @@ type Token[T Type] struct {
Value string // The value of the token.
}
// New creates a Token of the given type at the given column.
// The token's value is derived from its type's Name method.
func New[T Type](typ T, column int) *Token[T] {
return &Token[T]{Type: typ, Column: column, Value: typ.Name()}
}
// NewAtom creates a Token of the given type with a custom value at the given
// column.
func NewAtom[T Type](typ T, name string, column int) *Token[T] {
return &Token[T]{Type: typ, Column: column, Value: name}
}
// Name returns the type of the Token, as a string.
func (t Token[T]) Name() string {
return t.Type.Name()