textual

package
v0.0.0-...-1fee6d4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2014 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package textual provides parsing for telnet-like protocols.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	Prefix             string //Prefix to remove
	Suffix             string //Suffix to remove
	OpenBrackets       bool   //Whether or not to open enclosures by removing the bracket characters
	Brackets           []byte //The characters to treat as brackets
	ArgumentSeparators []byte //The characters to treat as separators between arguments and therefore split the text by
	Trim               bool   //Whether or not to remove heading and trailing whitespaces.
}

A parser can be configured to remove a prefix, a suffix, heading and trailing whitespaces, split the text in arguments using separators, detect escaped characters by recognizing "brackets" (enclosures), and remove said brackets from the argument.

func (*Parser) Parse

func (p *Parser) Parse(s string) Statement

Parses the input string and outputs a Statement.

type Statement

type Statement struct {
	Raw       string   //The raw input string
	Name      string   //The first argument (#0), which is usually the name of the command
	Arguments []string //The full list of arguments
}

The object storing the result of the parse operation.

Jump to

Keyboard shortcuts

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