token

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CharDash                 rune = '-'
	CharWhitespace                = ' '
	CharTab                       = '\t'
	CharCommentStarter            = '#'
	CharNewline                   = '\n'
	CharColon                     = ':'
	CharPipe                      = '|'
	CharComma                     = ','
	CharGreaterThan               = '>'
	CharQuestionMark              = '?'
	CharExclamationMark           = '!'
	CharAmpersand                 = '&'
	CharAsterisk                  = '*'
	CharSingleQuote               = '\''
	CharDoubleQuote               = '"'
	CharPeriod                    = '.'
	CharOpeningSquareBracket      = '['
	CharClosingSquareBracket      = ']'
	CharOpeningCurlyBrace         = '{'
	CharClosingCurlyBrace         = '}'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	// contains filtered or unexported fields
}

Location represent the Location of the Token within the document

func (Location) String

func (l Location) String() string

type Token

type Token struct {
	Type     Type
	Value    string
	Position Location
}

func New

func New(typ Type, value string, line, column int) Token

func (Token) String

func (t Token) String() string

type Type

type Type int8
const (
	TypeUnknown Type = iota
	// TypeData could refer to a key or value of any data type
	TypeData
	TypeColon
	TypeDocumentStart
	TypeDocumentEnd

	// TypeIndentation indicates Type is an indentation.
	// An indentation is zero or more spaces preceding a newline rune
	TypeIndentation
	TypeNewline
	TypePipe
	TypeComma
	TypeGreaterThan
	TypeQuestionMark
	TypeExclamationMark
	TypeAmpersand
	TypeAsterisk
	TypeComment
	TypeOpeningSquareBracket
	TypeClosingSquareBracket
	TypeOpeningCurlyBrace
	TypeClosingCurlyBrace
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL