Runtime

This module contains class of stream object used to iterate over input.

exception pseudo.stream.EndOfFile

Exception indicating that parsing ends.

class pseudo.stream.Stream(input: str)

Stream is an object used to iterate over input. It is a little bit similar to queue.

- input

List of lines of code.

- line

Number of current line. Counting from 1

- col

Number of current column. Counting from 1

eof() → bool

Returns true if next line is end of file and next char is end of line.

eol() → bool

Returns true if next char is end of line.

get_current_line()

Returns current line

next() → str

Move cursor to next column and return char from this postion.

next_line()

Move cursor to next line.

peek(size: int = 0) → Union[str, pseudo.type.base.EOL]

Returns next char without moving cursor. If next char does not exists it returns EOL instance.

Parameters:size (-) – Size of shift, default 0.
throw(error: str)

Used to display error messages with line number. It stops the execution.