meta

package
v3.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2019 License: MIT Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Meta

type Meta struct {
	// Pos is the source position.
	Pos Position
	// LastPos is the last source position.
	// Currently it is set when the parsed element type is message, enum, oneof, rpc or service.
	LastPos Position
}

Meta represents a meta information about the parsed element.

func NewMeta

func NewMeta(fromPos scanner.Position) Meta

NewMeta creates a new Meta from scanner.Position.

func NewMetaWithLastPos added in v1.2.0

func NewMetaWithLastPos(
	fromPos scanner.Position,
	fromLastPos scanner.Position,
) Meta

NewMetaWithLastPos creates a new Meta with LastPos from scanner.Position.

type Position

type Position struct {
	// Filename is a name of file, if any
	Filename string
	// Offset is a byte offset, starting at 0
	Offset int
	// Line is a line number, starting at 1
	Line int
	// Column is a column number, starting at 1 (character count per line)
	Column int
}

Position represents a source position.

func NewPosition

func NewPosition(from scanner.Position) Position

NewPosition creates a new Position from scanner.Position.

func (Position) String

func (pos Position) String() string

String stringify the position.

Jump to

Keyboard shortcuts

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