Crate oq3_source_file

source ·
Expand description

Management of source files for OpenQASM 3 parsing and semantic analysis. The main struct here is SourceFile which contains the path to a source file and the AST produced by the parser. It also contains a Vec<SourceFile> representing source files that are included via include. Nested includes are handled naturally this way.

report_error formats error messages using the external crate ariadne.

Structs§

  • Structure for managing parsing QASM from a string with no associated source file. fake_file_path contains something like “no file” and is present in order to make it easier to avoid duplicating code supporing QASM read from source files.

Traits§

Functions§

  • Print compiler errors. Diagnostics include text take from source. The file info_file_path is only used for printing error messages. In particular, it does not need to correspond to an existing file. In case info_file_path is indeed the source file, then source is read before calling this function.
  • Read source from file_path and parse to the syntactic AST. Parse and store included files recursively.
  • Read source from file_path and parse to the syntactic AST. Parse and store included files recursively.