parser

package
v0.0.0-...-8229079 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2016 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package gsm provides a parser for asterisk configuration files

The abstract syntax tree is basic, and made to accomodate the urgent need to parse the dongle configuration file and also as a means to see if scanning is done well will the scanner.

TODO(gernest) rewrite the AST and move it into a separate package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintAst

func PrintAst(dst io.Writer, src *Ast)

Types

type Ast

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

Ast is an abstract syntax tree for a scanneruration object. The scanneruration format should be section based( or you can say namespacing).

func (*Ast) LoadJSON

func (a *Ast) LoadJSON(src []byte) error

LoadJSON loads AST from json src

func (*Ast) Section

func (a *Ast) Section(name string) (*NodeSection, error)

Section returns the section named name or an error if the section is not found in the Ast

func (*Ast) ToJSON

func (a *Ast) ToJSON(dst io.Writer) error

ToJSON marhalls *Ast to a json string and writes the result to dst

type NodeSection

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

NodeSection represent a section in the scanneruration object. Sections are name spaces that contains scannerurations definitions under them.

func (*NodeSection) Get

func (n *NodeSection) Get(key string) (string, error)

Get access the key definition and returns its value or an error if the key is not part of the section.

type Parser

type Parser struct {
	Ast *Ast
	// contains filtered or unexported fields
}

Parser is a Parser for scanneruration files. It supports utf-8 encoded scanneruration files.

Only modem scanneruration files are supported for the momment.

func NewParser

func NewParser(src io.Reader) (*Parser, error)

NewParser returns a new Parser that parses input from src. The returned Parser supports gsm modem scanneruration format only.

func (*Parser) Parse

func (p *Parser) Parse() (*Ast, error)

Parse parses the scanned input and return its *Ast or arror if any.

Jump to

Keyboard shortcuts

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