arx.io

arx.io

Source: packages/arx/src/arx/io.py

title: Module for handling the IO used by the compiler.

Classes

ArxBuffer

title: ArxBuffer gathers function for handle the system buffer.
attributes:
  buffer:
    type: str
  position:
    type: int

Methods

clean(self) -> None
title: Clean the buffer content.
write(self, text: str) -> None
title: Write the given text to the buffer.
parameters:
  text:
    type: str
read(self) -> str
title: Read the buffer content.
returns:
  type: str

ArxIO

title: Arx class for Input and Output operations.
attributes:
  INPUT_FROM_STDIN:
    type: bool
  INPUT_FILE:
    type: str
  EOF:
    type: int
  buffer:
    type: ArxBuffer

Methods

get_char(cls) -> str
title: Get a char from the buffer or from the default input.
returns:
  type: str
  description: A char from the buffer.
file_to_buffer(cls, filename: str) -> None
title: Copy the file content to the buffer.
parameters:
  filename:
    type: str
    description: The name of the file to be copied to the buffer.
string_to_buffer(cls, value: str) -> None
title: Copy the given string to the buffer.
parameters:
  value:
    type: str
    description: The string to be copied to the buffer.
load_input_to_buffer(cls) -> None
title: Load the content file or the standard input to the buffer.

ArxFile

title: ArxFile gathers function to handle files.

Methods

create_tmp_file(content: str) -> str
title: Create a temporary file with the given content.
parameters:
  content:
    type: str
    description: The content of the temporary file.
returns:
  type: str
  description: The name of the created temporary file.
delete_file(filename: str) -> int
title: Delete the specified file.
parameters:
  filename:
    type: str
    description: The name of the file to be deleted.
returns:
  type: int
  description: Returns 0 on success, or -1 on failure.