Skip to content

Commit

Permalink
Merge branch 'main' into for-merge-prepare-packaging
Browse files Browse the repository at this point in the history
* Fix merge conflicts.
* Minor clean up
  • Loading branch information
jlapeyre committed Jan 13, 2024
2 parents 40e96f2 + dbea116 commit f1dec63
Show file tree
Hide file tree
Showing 85 changed files with 94 additions and 42 deletions.
12 changes: 0 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
target/
/Cargo.lock
dev_docs/diagrams
crates/oq3_syntax/examples/oq3_source
crates/oq3_syntax/examples/hideold
organization.md
parser_design.md
restorenodes.sh
restorgenerated.sh
crates/parser/src/syntax_kind/_syntax_kind_enum.rs
crates/oq3_syntax/src/ast/generated/_new_nodes.rs
crates/oq3_syntax/src/ast/generated/_new_tokens.rs
.venv/
.venvs/
.env/
.envs/
.ackrc
15 changes: 0 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,3 @@ oq3_syntax = { path = "crates/oq3_syntax", version = "0.0.1" }
oq3_semantics = { path = "crates/oq3_semantics", version = "0.0.1" }
oq3_sourcegen = { path = "crates/oq3_sourcegen", version = "0.0.1" }
oq3_source_file = { path = "crates/oq3_source_file", version = "0.0.1" }

# non-local crates
limit = { version = "0.0.188", package = "ra_ap_limit" }
stdx = { version = "0.0.188", package = "ra_ap_stdx"}
triomphe = { version = "0.1.8", default-features = false, features = ["std"] }
smallvec = { version = "1.10.0", features = [
"const_new",
"union",
"const_generics",
] }
smol_str = "0.2.0"
nohash-hasher = "0.2.0"
text-size = "1.1.0"
# can't upgrade due to dashmap depending on 0.12.3 currently
hashbrown = { version = "0.12.3", features = ["inline-more"], default-features = false }
1 change: 1 addition & 0 deletions codegen_scripts/cleangenerated.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/env sh

# Copyright contributors to the openqasm-parser project
# SPDX-License-Identifier: Apache-2.0

# Remove backups of generated code.
# Also remove the temporary file that generated code is written to.
Expand Down
1 change: 1 addition & 0 deletions codegen_scripts/cpgenerated.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/env sh

# Copyright contributors to the openqasm-parser project
# SPDX-License-Identifier: Apache-2.0

# For generated.rs
# Copy the generated code from the temporary files to which it is written
Expand Down
1 change: 1 addition & 0 deletions codegen_scripts/cpnodes.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/env sh

# Copyright contributors to the openqasm-parser project
# SPDX-License-Identifier: Apache-2.0

# For nodes.rs
# Copy the generated code from the temporary files to which it is written
Expand Down
1 change: 1 addition & 0 deletions codegen_scripts/mk_nodes.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/env sh

# Copyright contributors to the openqasm-parser project
# SPDX-License-Identifier: Apache-2.0

# See mkgenerated.sh

Expand Down
1 change: 1 addition & 0 deletions codegen_scripts/mk_syntax_kinds.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/env sh

# Copyright contributors to the openqasm-parser project
# SPDX-License-Identifier: Apache-2.0

# See mkgenerated.sh

Expand Down
1 change: 1 addition & 0 deletions codegen_scripts/mk_syntax_tokens.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/env sh

# Copyright contributors to the openqasm-parser project
# SPDX-License-Identifier: Apache-2.0

# See mkgenerated.sh

Expand Down
1 change: 1 addition & 0 deletions codegen_scripts/mkgenerated.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/env sh

# Copyright contributors to the openqasm-parser project
# SPDX-License-Identifier: Apache-2.0

# This is not how r-a does generation.
# But I find a boot strapping problem.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_lexer/src/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use std::str::Chars;

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_lexer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Low-level OpenQASM3 lexer.
//!
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_lexer/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use super::*;

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_lexer/src/unescape.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Utilities for validating string and char literals and turning them into
//! values they represent.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_lexer/src/unescape/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use super::*;

Expand Down
5 changes: 1 addition & 4 deletions crates/oq3_parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ keywords.workspace = true
categories.workspace = true
repository.workspace = true

# Added this explicit target just so I could disable the doc tests (GJL Sept 2023)
[lib]
name = "oq3_parser"
doctest = false

[dependencies]
oq3_lexer.workspace = true
drop_bomb = "0.1.5"

limit.workspace = true
limit = { version = "0.0.188", package = "ra_ap_limit" }

[dev-dependencies]
expect-test = "1.4.0"
1 change: 1 addition & 0 deletions crates/oq3_parser/src/event.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! This module provides a way to construct a `File`.
//! It is intended to be completely decoupled from the
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/grammar.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! This is the actual "grammar" of the OpenQASM 3 language.
//!
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/grammar/expressions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

pub mod atom;

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/grammar/expressions/atom.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use super::*;

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/grammar/items.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use super::*;
use crate::grammar::expressions::expr_block_contents;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/grammar/params.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use super::*;

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/input.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! See [`Input`].

Expand Down
3 changes: 2 additions & 1 deletion crates/oq3_parser/src/lexed_str.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Lexing `&str` into a sequence of OpenQASM 3 tokens.
//!
//! Note that `str` does *not* refer to a string in the target language.
//! Note that strictly speaking the parser in this crate is not required to work
//! on tokens which originated from text. Macros, eg, can synthesize tokens out
//! of thin air. So, ideally, oq3_lexer should be an orthogonal crate. It is however
//! convenient to include a text-based oq3_lexer here!
//! convenient to include a text-based lexer here!
//!
//! Note that these tokens, unlike the tokens we feed into the parser, do
//! include info about comments and whitespace.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Parser for OpenQASM 3

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/output.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! See [`Output`]

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! See [`Parser`].

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/shortcuts.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Shortcuts that span lexer/parser abstraction.
//!
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/syntax_kind.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Defines [`SyntaxKind`] -- a fieldless enum of all possible syntactic
//! constructs of the OpenQASM 3 language.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/syntax_kind/syntax_kind_enum.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Generated by `sourcegen_ast`, do not edit by hand.

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_parser/src/token_set.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! A bit-set of `SyntaxKind`s.

Expand Down
2 changes: 1 addition & 1 deletion crates/oq3_semantics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ doctest = false

[dependencies]
oq3_source_file.workspace = true
oq3_syntax.workspace = true
hashbrown = { version = "0.14" }
rowan = "0.15.11"
oq3_syntax.workspace = true
boolenum = "0.1"

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/examples/semdemo.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use clap::{Parser, Subcommand};
use std::fs;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/asg.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

// The definition of the abstract semantic graph (ASG) as well as the API for using it.
// Construction of this typed ASG from syntactic AST is in string_to_semantic.rs.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/context.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use crate::asg;
use crate::semantic_error::SemanticErrorKind::*;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/display.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

// Unused at the moment.
// This intent here is to print something like source code.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/initialize_ast.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use crate::asg;
use crate::symbols;
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! Abstract Semantic Graph (ASG)
//! This crate implements an abstract semantic graph (ASG) for the OpenQASM 3 language.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/semantic_error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

// This is copied and modified from rust-analyzer syntax_error.rs
use oq3_source_file;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/symbols.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

// Defines data structures and api for symbols, scope, and symbol tables.

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/syntax_to_semantics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

// Build the ASG defined in asg.rs from the syntactic AST
// constructed in the crate oq3_syntax.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

// Defines the data structures representing the types used to annotate types of expressions in
// the typed ASG.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

/// Return the name of the type of a value.
pub fn type_name_of<T>(_: T) -> &'static str {
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/src/validate.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use crate::asg::{Expr, Program, Stmt, TExpr};
use crate::symbols::{SymbolIdResult, SymbolTable};
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/tests/ast_tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use oq3_semantics;
use oq3_semantics::asg;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/tests/from_string_tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use oq3_semantics::asg;
use oq3_semantics::semantic_error::SemanticErrorList;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/tests/symbol_tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use oq3_semantics::symbols;
use oq3_semantics::types;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_semantics/tests/types_test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use oq3_semantics::types;

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_source_file/src/api.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

// It might be nice to put these functions in lib.rs.
// But they are also used in this crate, so we put them here.
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_source_file/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! 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
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_source_file/src/source_file.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

use oq3_syntax::ast as synast; // Syntactic AST
use oq3_syntax::Parse;
Expand Down
1 change: 1 addition & 0 deletions crates/oq3_sourcegen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright contributors to the openqasm-parser project
// SPDX-License-Identifier: Apache-2.0

//! This was copied from an external crate. It would be better to use the
//! external crate. But it has a bug-- a hard coded path that requires the
Expand Down
Loading

0 comments on commit f1dec63

Please sign in to comment.