linescanner

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: BSL-1.0 Imports: 1 Imported by: 0

README

linescanner

GoDoc

About

This package provides functions to scan lines of property files. It is published on https://github.com/vbsw/misc/properties/linescanner.

References

Documentation

Overview

Package linescanner provides functions to scan lines of property files.

Index

Constants

View Source
const (
	// LUndefined denotes initial state, i.e. nothing has been parsed.
	LUndefined = 0
	// LEmpty denotes empty line or a line with whitespace, only.
	LEmpty = 1
	// LProperty denotes line with property.
	LProperty = 2
	// LPropertyNext denotes line with property and continuation of property value on next line.
	LPropertyNext = 3
	// LPropertyCont denotes line with continuation of property value from previous line.
	LPropertyCont = 4
	// LPropertyContNext denotes line with continuation of property value from previous line and its continuation on next line.
	LPropertyContNext = 5
	// LComment denotes comment line.
	LComment = 6
	// LUnknownFormat denotes line with something that can not be interpreted.
	LUnknownFormat = 7
)

Line types.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineScanner

type LineScanner struct {
	LineType  int
	PropBegin int
	PropEnd   int
	ValBegin  int
	ValEnd    int
}

LineScanner holds line type and indices for property name and property value.

func (*LineScanner) PropertyName

func (scanner *LineScanner) PropertyName(bytes, buffer []byte) []byte

PropertyName returns property name as string.

func (*LineScanner) PropertyValue

func (scanner *LineScanner) PropertyValue(bytes, buffer []byte) []byte

PropertyValue returns property value as string.

func (*LineScanner) ScanLine

func (scanner *LineScanner) ScanLine(bytes []byte, offset int) int

ScanLine processes one line searching for property name and property value. Result is written to LineScanner fields. Returns offset of next line.

func (*LineScanner) Set

func (scanner *LineScanner) Set(lineType, propBegin, propEnd, valBegin, valEnd int)

Set assignes values to LineScanner fields.

Jump to

Keyboard shortcuts

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