asciiscan

package
v0.0.0-...-16767da Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

package asciiscan is used to parse plaintext files into structured data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsumeProperty

func ConsumeProperty(s string) (string, string)

It's common for properties to be specified as "foo : bar". Parse them out.

func IsProperty

func IsProperty(s string) bool

Check to see if the line looks like a property (contains a colon character).

Types

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func New

func New(filename string) (*Scanner, error)

func (*Scanner) Bufio

func (s *Scanner) Bufio() *bufio.Scanner

func (*Scanner) Close

func (s *Scanner) Close() error

func (*Scanner) ConsumeBool

func (s *Scanner) ConsumeBool() (bool, error)

func (*Scanner) ConsumeBoolPtr

func (s *Scanner) ConsumeBoolPtr(to *bool) error

func (*Scanner) ConsumeBoolPtrs

func (s *Scanner) ConsumeBoolPtrs(ptrs ...*bool) error

func (*Scanner) ConsumeInt

func (s *Scanner) ConsumeInt() (int, error)

func (*Scanner) ConsumeIntPtr

func (s *Scanner) ConsumeIntPtr(to *int) error

func (*Scanner) ConsumeIntPtrs

func (s *Scanner) ConsumeIntPtrs(ptrs ...*int) error

func (*Scanner) ConsumeProperty

func (s *Scanner) ConsumeProperty() (string, string, error)

func (*Scanner) ConsumeString

func (s *Scanner) ConsumeString() (string, error)

func (*Scanner) ConsumeStringList

func (s *Scanner) ConsumeStringList(skip ...string) ([]string, error)

Reads a list of non-property lines, skipping any that match the given strings

func (*Scanner) PeekProperty

func (s *Scanner) PeekProperty() (bool, error)

Checks if the next line might be a property, without reading it

Jump to

Keyboard shortcuts

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