parser

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: GPL-3.0 Imports: 9 Imported by: 1

Documentation

Overview

Package config provides set of utilities for configuration parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeErr

func NodeErr(node Node, f string, args ...interface{}) error

Types

type Node

type Node struct {
	// Name is the first string at node's line.
	Name string
	// Args are any strings placed after the node name.
	Args []string

	// Children slice contains all children blocks if node is a block. Can be nil.
	Children []Node

	// Snippet indicates whether current parsed node is a snippet. Always false
	// for all nodes returned from Read because snippets are expanded before it
	// returns.
	Snippet bool

	// Macro indicates whether current parsed node is a macro. Always false
	// for all nodes returned from Read because macros are expanded before it
	// returns.
	Macro bool

	// File is the name of node's source file.
	File string

	// Line is the line number where the directive is located in the source file. For
	// blocks this is the line where "block header" (name + args) resides.
	Line int
}

Node struct describes a parsed configurtion block or a simple directive.

name arg0 arg1 {
 children0
 children1
}

func Read

func Read(r io.Reader, location string) (nodes []Node, err error)

Jump to

Keyboard shortcuts

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