token

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SWIFT_ALPHA        = EOF + iota + 1 // 'A' - 'Z'
	SWIFT_CHARACTER                     // 'A' - 'Z', '0' - '9'
	SWIFT_DECIMAL                       // '0' - '9', ','
	SWIFT_NUMERIC                       // '0' - '9'
	SWIFT_ALPHANUMERIC                  // all characters from charset
	SWIFT_DATASET_START
	SWIFT_TAG_SEPARATOR
	SWIFT_TAG
	SWIFT_MESSAGE_SEPARATOR
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

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

A Iterator iterates over a slice of Tokens

func (*Iterator) Backup

func (t *Iterator) Backup()

Backup moves the iterator one position back.

func (*Iterator) HasNext

func (t *Iterator) HasNext() bool

HasNext returns true if there are tokens less to emit, false otherwise.

func (*Iterator) Next

func (t *Iterator) Next() Token

Next returns the next Token within the iterator. If there are no more tokens it will return an EOF Token signalling that the iterator has reached the last element.

type Lexer added in v0.1.4

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

A Lexer is a HBCI data element lexer based on an input string

func NewLexer added in v0.1.4

func NewLexer(name string, input []byte) *Lexer

NewLexer creates a new scanner for the input string.

func (*Lexer) HasNext added in v0.1.4

func (l *Lexer) HasNext() bool

HasNext returns true if there are tokens left, false if EOF has reached

func (*Lexer) Next added in v0.1.4

func (l *Lexer) Next() Token

Next returns the next item from the input.

func (*Lexer) SetEntryPoint added in v0.1.4

func (l *Lexer) SetEntryPoint(entryPoint LexerStateFn)

SetEntryPoint sets the initial state of the lexer. The lexer will reset itself to use the new entryPoint properly

type LexerStateFn added in v0.1.4

type LexerStateFn func(*Lexer) LexerStateFn

LexerStateFn represents a state function for the lexer.

type SwiftLexer

type SwiftLexer struct {
	*Lexer
}

A SwiftLexer parses the given input and emits SWIFT tokens

func NewSwiftLexer

func NewSwiftLexer(name string, input []byte) *SwiftLexer

NewSwiftLexer returns a SwiftLexer ready for parsing the given input string

type Token

type Token interface {
	Type() Type
	Value() []byte
	String() string
	Pos() int
	IsSyntaxSymbol() bool
}

Token represents a HBCI token.

func New

func New(typ Type, val []byte, pos int) Token

New creates a Token with the given type, value and position

type Type

type Type int

Type identifies the type of lex tokens.

const (
	ILLEGAL Type = iota // An illegal/unknown character
	ERROR               // error occurred;

	DATA_ELEMENT_SEPARATOR       // Datenelement (DE)-Trennzeichen
	GROUP_DATA_ELEMENT_SEPARATOR // Gruppendatenelement (GD)-Trennzeichen
	SEGMENT_END_MARKER           // Segmentende-Zeichen
	BINARY_DATA_LENGTH           // Binärdaten Länge
	BINARY_DATA                  // Binärdaten
	BINARY_DATA_MARKER           // Binärdatenkennzeichen
	ALPHA_NUMERIC                // an
	TEXT                         // txt
	DTAUS_CHARSET                // dta
	NUMERIC                      // num: 0-9 without leading 0
	DIGIT                        // dig: 0-9 with optional leading 0
	FLOAT                        // float
	YES_NO                       // jn
	DATE                         // dat
	VIRTUAL_DATE                 // vdat
	TIME                         // tim
	IDENTIFICATION               // id
	COUNTRY_CODE                 // ctr: ISO 3166-1 numeric
	CURRENCY                     // cur: ISO 4217
	VALUE                        // wrt
	EOF
)

func (Type) String

func (t Type) String() string

type Types

type Types []Type

Types implements the sort.Sort interface

func (Types) Len

func (t Types) Len() int

func (Types) Less

func (t Types) Less(i, j int) bool

func (Types) Swap

func (t Types) Swap(i, j int)

Jump to

Keyboard shortcuts

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