pip_services3_expressions.io package

Submodules

Module contents

class pip_services3_expressions.io.IScanner

Bases: abc.ABC

Defines scanner that can read and unread characters and count lines. This scanner is used by tokenizers to process input streams.

column() → int

Gets the column in the current line

Returns

The column in the current line in the stream

line() → int

Gets the current line number

Returns

The current line number in the stream

peek() → int

Returns the character from the top of the stream without moving the stream pointer.

Returns

A character from the top of the stream or -1 if stream is empty.

peek_column() → int

Gets the next character column number

Returns

The next character column number in the stream

peek_line() → int

Gets the next character line number

Returns

The next character line number in the stream

read() → int

Reads character from the top of the stream.

Returns

A read character or -1 if stream processed to the end.

reset()

Resets scanner to the initial position

unread()

Puts the one character back into the stream stream.

Returns

A character to be pushed back.

unread_many(count: int)

Pushes the specified number of characters to the top of the stream.

Parameters

count – A number of characters to be pushed back.

class pip_services3_expressions.io.StringScanner(content: str)

Bases: pip_services3_expressions.io.IScanner.IScanner

Scan characters in a string that allows tokenizers to look ahead through stream to perform lexical analysis.

Eof: int = -1
column() → int

Gets the column in the current line

Returns

The column in the current line in the stream

is_column(char_at: int) → bool

Checks if the current character represents a column

Parameters

char_at – the current character

Returns

true if the current character is a column, or false otherwise.

is_line(char_before: int, char_at: int, char_after: int) → bool

Checks if the current character represents a new line

Parameters
  • char_before – the character before the current one

  • char_at – the current character

  • char_after – the character after the current one

Returns

true if the current character is a new line, or false otherwise.

line() → int

Gets the current line number

Returns

The current line number in the stream

peek() → int

Returns the character from the top of the stream without moving the stream pointer.

Returns

A character from the top of the stream or -1 if stream is empty.

peek_column() → int

Gets the next character column number

Returns

The next character column number in the stream

peek_line() → int

Gets the next character line number

Returns

The next character line number in the stream

read() → int

Reads character from the top of the stream. A read character or -1 if stream processed to the end.

reset()

Resets scanner to the initial position

unread()

Puts the one character back into the stream stream.

Returns

A character to be pushed back.

unread_many(count: int)

Pushes the specified number of characters to the top of the stream.

Parameters

count – A number of characters to be pushed back.