position

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package position implements a data structure for storing source code positions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Position

type Position struct {
	Filename string // Source filename in which this token appears.
	Line     int    // Line in the source for this token.
	Startcol int    // Starting and ending columns in the source for this token.
	Endcol   int
}

A Position is the location in the source program that a token appears. It can specify a single character in the pinput, in which case the start and end columns are the same, or a span of sequential characters on one line.

func Merge

func Merge(a, b *Position) *Position

MergePosition returns the union of two positions such that the result contains both inputs.

func (Position) String

func (p Position) String() string

String formats a position to be useful for printing messages associated with this position, e.g. compiler errors.

Jump to

Keyboard shortcuts

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