-
Notifications
You must be signed in to change notification settings - Fork 15
Description
openqasm3_parser/crates/oq3_parser/src/parser.rs
Lines 18 to 26 in dac0d7a
| /// `Parser` struct provides the low-level API for | |
| /// navigating through the stream of tokens and | |
| /// constructing the parse tree. The actual parsing | |
| /// happens in the [`grammar`](super::grammar) module. | |
| /// | |
| /// However, the result of this `Parser` is not a real | |
| /// tree, but rather a flat stream of events of the form | |
| /// "start expression, consume number literal, | |
| /// finish expression". See `Event` docs for more. |
The "actual parsing" mentioned above is spread out among these files in this directory and subdirectory:
https://github.com/Qiskit/openqasm3_parser/tree/main/crates/oq3_parser/src/grammar
I have not audited this recently, but these files should probably be reorganized.
A couple of examples:
-
There may a be a function that is called only from one file. In some cases it would be better to move this function from its current location to the file with the call sites, and make its visibility more restricted by removing
puborpub(crate). -
No intentional order determines where the functions appear in the file. Some thought should be put into this and the functions (and data) should be reordered so that the code is easier to read and understand.