safetoken

package
v0.10.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package safetoken provides wrappers around methods in go/token, that return errors rather than panicking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InRange

func InRange(tf *token.File, pos token.Pos) bool

InRange reports whether the given position is in the given token.File.

func Offset

func Offset(tf *token.File, pos token.Pos) (int, error)

Offset returns tok.Offset(pos), but first checks that the pos is in range for the given file.

func Pos

func Pos(tf *token.File, offset int) (token.Pos, error)

Pos returns tok.Pos(offset), but first checks that the offset is valid for the given file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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