Skip to content

FileReader

FileReader(filename, preprocess=False, defines={}, message_handler=None)

Bases: MessageHandler

Read file line by line with error reporting and preprocessor.

PARAMETER DESCRIPTION
filename

file to read

TYPE: str

preprocess

whether to run preprocessor

TYPE: bool DEFAULT: False

defines

dictionary with preprocessor defines

TYPE: dict DEFAULT: {}

message_handler

message handler to use for error reporting

TYPE: MessageHandler | None DEFAULT: None

get_line()

Get next line from file, or None if at end of file.

RETURNS DESCRIPTION
str | None

next line from file, or None if at end of file