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§
- Source
File - Source
String - 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§
- inner_
print_ compiler_ errors - Print compiler errors. Diagnostics include text take from
source
. The fileinfo_file_path
is only used for printing error messages. In particular, it does not need to correspond to an existing file. In caseinfo_file_path
is indeed the source file, thensource
is read before calling this function. - parse_
source_ file - Read source from
file_path
and parse to the syntactic AST. Parse and store included files recursively. - parse_
source_ string - Read source from
file_path
and parse to the syntactic AST. Parse and store included files recursively. - print_
compiler_ errors - report_
error