source

package
v0.2.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package source provides facilities to represent text documents as a sequence of lines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringLines

func StringLines(lines []Line) []string

StringLines returns the supplied lines as a sequence of strings.

Types

type Line

type Line struct {
	// Bytes returns the line byte inc. any trailing end-of-line markers
	Bytes []byte
	// Range returns range of the line bytes inc. any trailing end-of-line markers
	// The range will span across two lines in most cases
	// (other than last line without trailing new line)
	Range hcl.Range
}

Line represents a line of source code. Each line is associated with an HCL range that includes the filename, start and end positions.

func MakeSourceLines

func MakeSourceLines(filename string, s []byte) []Line

MakeSourceLines returns the lines in the supplied text. The returned lines will have one more extra line than the source for insertion use.

Jump to

Keyboard shortcuts

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