style: renamed token index to column
This commit is contained in:
@@ -14,33 +14,33 @@ const (
|
||||
|
||||
// A representation of a token in source code.
|
||||
type Token struct {
|
||||
Index int // Where the token begins in the source text.
|
||||
Type Type // What type the token is.
|
||||
Value string // The value of the token.
|
||||
Column int // Where the token begins in the source text.
|
||||
Type Type // What type the token is.
|
||||
Value string // The value of the token.
|
||||
}
|
||||
|
||||
func NewOpenParen(index int) *Token {
|
||||
return &Token{Type: OpenParen, Index: index, Value: "("}
|
||||
func NewOpenParen(column int) *Token {
|
||||
return &Token{Type: OpenParen, Column: column, Value: "("}
|
||||
}
|
||||
|
||||
func NewCloseParen(index int) *Token {
|
||||
return &Token{Type: CloseParen, Index: index, Value: ")"}
|
||||
func NewCloseParen(column int) *Token {
|
||||
return &Token{Type: CloseParen, Column: column, Value: ")"}
|
||||
}
|
||||
|
||||
func NewDot(index int) *Token {
|
||||
return &Token{Type: Dot, Index: index, Value: "."}
|
||||
func NewDot(column int) *Token {
|
||||
return &Token{Type: Dot, Column: column, Value: "."}
|
||||
}
|
||||
|
||||
func NewSlash(index int) *Token {
|
||||
return &Token{Type: Slash, Index: index, Value: "\\"}
|
||||
func NewSlash(column int) *Token {
|
||||
return &Token{Type: Slash, Column: column, Value: "\\"}
|
||||
}
|
||||
|
||||
func NewAtom(name string, index int) *Token {
|
||||
return &Token{Type: Atom, Index: index, Value: name}
|
||||
func NewAtom(name string, column int) *Token {
|
||||
return &Token{Type: Atom, Column: column, Value: name}
|
||||
}
|
||||
|
||||
func NewNewline(index int) *Token {
|
||||
return &Token{Type: Newline, Index: index, Value: "\\n"}
|
||||
func NewNewline(column int) *Token {
|
||||
return &Token{Type: Newline, Column: column, Value: "\\n"}
|
||||
}
|
||||
|
||||
func Name(typ Type) string {
|
||||
|
||||
Reference in New Issue
Block a user