token

package
v0.0.0-...-3a9de2f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package token defines all the token kinds defined in the Protocol Buffers language version 3.

You can find the specification of the language in https://developers.google.com/protocol-buffers/docs/reference/proto3-spec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind identifies all possible token kinds.

const (
	Illegal Kind = iota
	EOF
	Comment

	Identifier

	DecimalLiteral
	FloatLiteral
	HexLiteral
	OctalLiteral

	StringLiteral

	False
	True

	Enum
	Import
	Map
	Message
	Oneof
	Option
	Package
	Public
	Repeated
	Reserved
	Returns
	RPC
	Service
	Stream
	Syntax
	To
	Weak

	Bytes
	Double
	Float

	Bool
	Fixed32
	Fixed64
	Int32
	Int64
	Sfixed32
	Sfixed64
	Sint32
	Sint64
	String
	Uint32
	Uint64

	Dot          // .
	Equals       // =
	Minus        // -
	Plus         // +
	Comma        // ,
	Semicolon    // ;
	OpenParen    // (
	CloseParen   // )
	OpenBrace    // {
	CloseBrace   // }
	OpenBracket  // [
	CloseBracket // ]
	OpenAngled   // <
	CloseAngled  // >

)

func Keyword

func Keyword(s string) Kind

Keyword returns the Kind corresponding to the given text if it's a keyword. Otherwise it returns Illegal.

func Punctuation

func Punctuation(s string) Kind

Type returns the Kind corresponding to the given text if it's a piece of punctuation. Otherwise it returns Illegal.

func Type

func Type(s string) Kind

Type returns the Kind corresponding to the given text if it's a type. Otherwise it returns Illegal.

func (Kind) Is

func (k Kind) Is(kind Kind) bool

Is returns true if the given kind is equal to the receiver of the method.

func (Kind) IsConstant

func (k Kind) IsConstant() bool

IsConstant returns true only if the given Kind is a constant.

func (Kind) IsKeyType

func (k Kind) IsKeyType() bool

IsKeyType returns true only if the given Kind is a valid map key type.

func (Kind) IsKeyword

func (k Kind) IsKeyword() bool

IsKeyword returns true only if the given Kind is a keyword.

func (Kind) IsNumber

func (k Kind) IsNumber() bool

IsNumber returns true only if the given Kind is a number.

func (Kind) IsType

func (k Kind) IsType() bool

IsType returns true only if the given Kind is a type.

func (Kind) String

func (k Kind) String() string

Jump to

Keyboard shortcuts

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