files

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package files provides minor support for dealing with files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CppToHeader

func CppToHeader(path string) (string, error)

SwapHeaderCpp swaps between .cc/.cpp into .h

func DirExists

func DirExists(path string) (bool, error)

DirExists check whether the directory exists and is a directory (not another type of file).

func StatFile

func StatFile(path string) (fs.FileInfo, error)

StatFile returns the file info of the file if it can be done. If the file does not exists, the returned file info will be nil.

func WriteToFile

func WriteToFile(path string, r io.Reader) error

Types

type LoadedFile

type LoadedFile struct {
	Path  string
	Data  []byte
	Lines []string
}

LoadedFile represents a single gochart source file loaded in memory.

func LoadFileFromData

func LoadFileFromData(data []byte) (*LoadedFile, error)

func LoadFileFromPath

func LoadFileFromPath(path string) (*LoadedFile, error)

LoadFileFromPath reads the contents of a file from path and caches it in convenient ways so that the rest of the compiler can benefit from it.

type LoadedFilePosition

type LoadedFilePosition struct {
	File *LoadedFile
	Line int
	Char int
}

LoadedFilePosition represents a character position within a loaded file.

func (*LoadedFilePosition) Render

func (lfp *LoadedFilePosition) Render(header, msg, footer string, contextSize int) string

Render prints the position pointed, with an possible message associated with it. The printing is "clang error style". |contextSize| is how many lines around the position to print (in each direction).

Jump to

Keyboard shortcuts

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