Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove obsolete function for parsing measure expression #174

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions crates/oq3_parser/src/grammar/expressions/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,13 @@ pub(crate) fn block_expr(p: &mut Parser<'_>) -> CompletedMarker {
m.complete(p, BLOCK_EXPR)
}

// FIXME: This idiom for handling "measure" does not occur
// in the original r-a crates. Need to refactor to avoid
// starting a new Marker.
// test return_expr
// fn foo() {
// return;
// return 92;
// }
fn return_expr(p: &mut Parser<'_>) -> CompletedMarker {
assert!(p.at(T![return]));
let m = p.start();
p.bump(T![return]);
p.bump_any(); // return
// parse possible returned expression
if p.at_ts(EXPR_FIRST) {
expr(p);
} else if p.at(T![measure]) {
let m1 = p.start();
expressions::items::measure_(p, m1);
}
m.complete(p, RETURN_EXPR)
}
Expand Down
19 changes: 0 additions & 19 deletions crates/oq3_parser/src/grammar/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,25 +212,6 @@ fn reset_stmt(p: &mut Parser<'_>, m: Marker) {
m.complete(p, RESET);
}

// FIXME: this has underscore, so should be private.
// We should be able to refactor to keep this private.
pub(crate) fn measure_(p: &mut Parser<'_>, m: Marker) {
p.bump(T![measure]);
match p.current() {
IDENT | HARDWAREIDENT => {
let m1 = p.start();
params::arg_gate_call_qubit(p, m1);
}
_ => {
p.error("expecting qubit(s) to measure");
m.abandon(p);
return;
}
}
p.expect(T![;]);
m.complete(p, MEASURE);
}

fn break_(p: &mut Parser<'_>, m: Marker) {
p.bump(T![break]);
p.expect(SEMICOLON);
Expand Down
Loading