Skip to content

Commit

Permalink
Rename crate directories for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Jan 11, 2024
1 parent 94e03c3 commit ad75fca
Show file tree
Hide file tree
Showing 51 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ edition = "2021"
license = "Apache-2.0"
authors = ["OpenQASM3 parser team"]
readme = "README.md"
keywords = ["QASM", "OpenQASM3", "parser"]
keywords = ["QASM", "openqasm3", "parser"]
categories = ["parser-implementations"]
repository = "https://github.com/Qiskit/openqasm3_parser"

[workspace.dependencies]
# local crates
oq3_lexer = { path = "crates/lexer", version = "0.0.1" }
oq3_parser = { path = "crates/parser", version = "0.0.1" }
oq3_lexer = { path = "crates/oq3_lexer", version = "0.0.1" }
oq3_parser = { path = "crates/oq3_parser", version = "0.0.1" }
oq3_syntax = { path = "crates/oq3_syntax", version = "0.0.1" }
oq3_semantics = { path = "crates/semantics", version = "0.0.1" }
oq3_sourcegen = { path = "crates/sourcegen", version = "0.0.1" }
oq3_source_file = { path = "crates/source_file", 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" }
Expand Down
4 changes: 2 additions & 2 deletions codegen_scripts/cleangenerated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# are not touched by this script.

cd ..
rm crates/parser/src/syntax_kind/_syntax_kind_enum.rs
rm crates/parser/src/syntax_kind/syntax_kind_enum.rs.~*
rm crates/oq3_parser/src/syntax_kind/_syntax_kind_enum.rs
rm crates/oq3_parser/src/syntax_kind/syntax_kind_enum.rs.~*

rm crates/oq3_syntax/src/ast/generated/_new_nodes.rs
rm crates/oq3_syntax/src/ast/generated/nodes.rs.~*
Expand Down
2 changes: 1 addition & 1 deletion codegen_scripts/cpgenerated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# Copy the generated code from the temporary files to which it is written
# to it's final location where it will be compiled into the library.

cd .. && cp -a --backup=t crates/parser/src/syntax_kind/_syntax_kind_enum.rs crates/parser/src/syntax_kind/syntax_kind_enum.rs
cd .. && cp -a --backup=t crates/oq3_parser/src/syntax_kind/_syntax_kind_enum.rs crates/oq3_parser/src/syntax_kind/syntax_kind_enum.rs

8 changes: 4 additions & 4 deletions codegen_scripts/mkgenerated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
# This should be enough for codegen.

# But you still need to add the things to the parser grammar
# 4 You might need to update crates/parser/src/grammar/expressions/atom.rs
# Or crates/parser/src/grammar/items.rs (eg. for `gate`)
# 4 You might need to update crates/oq3_parser/src/grammar/expressions/atom.rs
# Or crates/oq3_parser/src/grammar/items.rs (eg. for `gate`)
# Or other grammar files

# Generated files are not given their final names in order not to clobber exisiting generated code
# Here are the temporary filenames and the final filenames
# You have to copy them manually.
# crates/oq3_syntax/src/ast/generated/_new_tokens.rs --> tokens.rs
# crates/oq3_syntax/src/ast/generated/_new_nodes.rs --> nodes.rs
# crates/parser/src/syntax_kind/_generated.rs --> generated.rs
# crates/oq3_parser/src/syntax_kind/_generated.rs --> generated.rs

# Update: Running this script now seems robust. Originally all codegen was done
# by a single test. I split it into two tests and run each of them twice.
Expand All @@ -41,6 +41,6 @@
# Don't know why, but code gen will fail otherwise.

cd ..
rustfmt crates/parser/src/syntax_kind/_syntax_kind_enum.rs
rustfmt crates/oq3_parser/src/syntax_kind/_syntax_kind_enum.rs
rustfmt crates/oq3_syntax/src/ast/generated/_new_nodes.rs
rustfmt crates/oq3_syntax/src/ast/generated/_new_tokens.rs
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/oq3_syntax/src/tests/sourcegen_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn our_project_root() -> PathBuf {
fn write_syntax_kinds_enum() {
let syntax_kinds = generate_syntax_kinds(KINDS_SRC);
let syntax_kinds_file =
our_project_root().join("crates/parser/src/syntax_kind/_syntax_kind_enum.rs");
our_project_root().join("crates/oq3_parser/src/syntax_kind/_syntax_kind_enum.rs");
oq3_sourcegen::ensure_file_contents(syntax_kinds_file.as_path(), &syntax_kinds);
}

Expand Down

0 comments on commit ad75fca

Please sign in to comment.