Skip to content

Reorganize location and visibility of functions in oq3_parser #166

@jlapeyre

Description

@jlapeyre

/// `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 pub or pub(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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Looking for assigneeLooking to contribute? Browse these.tech debtPay down some tech debt

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions