parser: add initial Parser emitting non-whitespace tokens
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package parser
|
||||
|
||||
//go:generate go run golang.org/x/tools/cmd/stringer -type=TokenType
|
||||
|
||||
// A TokenType is a type of Token
|
||||
type TokenType uint
|
||||
|
||||
const (
|
||||
// TokenUnknown represents a Token that hasn't been identified
|
||||
TokenUnknown TokenType = iota
|
||||
// TokenSectionStart indicates the opening marker of a section declaration.
|
||||
// The left squared bracket.
|
||||
TokenSectionStart
|
||||
// TokenSectionEnd indicates the closing marker of a section declaration.
|
||||
// The right squared bracket.
|
||||
TokenSectionEnd
|
||||
// TokenSectionName represents the section name between the squared brackets
|
||||
TokenSectionName
|
||||
// TokenSectionSubname represents a secondary name in the section represented
|
||||
// between quotes after the section name.
|
||||
// e.g.
|
||||
// [section_name "section_subname"]
|
||||
TokenSectionSubname
|
||||
// TokenComment represents a comment, including the initial ';' or '#' until
|
||||
// the end of the line.
|
||||
TokenComment
|
||||
// TokenFieldKey represents a field name in a `key = value` entry
|
||||
TokenFieldKey
|
||||
// TokenFieldValue represents a field value in a `key = value` entry
|
||||
TokenFieldValue
|
||||
)
|
||||
Reference in New Issue
Block a user