Skip to content

Commit

Permalink
Merge pull request #240 from ricosjp/syn-2.x.x
Browse files Browse the repository at this point in the history
Update syn
  • Loading branch information
ytanimura authored Mar 25, 2023
2 parents 2126752 + 484f159 commit d7f93bf
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 40 deletions.
11 changes: 6 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ In addition to original Keep-a-Changelog, we use following rules:
## Unreleased

### Added
- Deserialize `LOGICAL` and `BOOLEAN` by `.T.`, `.F.`, and `.U.` notations.
- Deserialize `LOGICAL` and `BOOLEAN` by `.T.`, `.F.`, and `.U.` notations. https://github.com/ricosjp/ruststep/pull/231

### Changed
- Remove `field` attr from enumerations.
- Recursive `get_owned` for select type without boxed variant.
- Remove `field` attr from enumerations. https://github.com/ricosjp/ruststep/pull/233
- Recursive `get_owned` for select type without boxed variant. https://github.com/ricosjp/ruststep/pull/234

### Fixed
- Deseialize `Option::Some`.
- Recursive implementation of `ruststep::tables::EntityTable::{get_owned, owned_iter}` for select types.
- Deseialize `Option::Some`. https://github.com/ricosjp/ruststep/pull/232
- Recursive implementation of `ruststep::tables::EntityTable::{get_owned, owned_iter}` for select types. https://github.com/ricosjp/ruststep/pull/230

### Internal
- `cargo upgrade --workspace` https://github.com/ricosjp/ruststep/pull/240

## 0.3.0 - 2022-06-14

Expand Down
8 changes: 4 additions & 4 deletions espr-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ categories = ["science", "development-tools"]
proc-macro = true

[dependencies]
quote = "1.0.17"
proc-macro2 = "1.0.37"
syn = { version = "1.0.91", features = ["full", "extra-traits"] }
quote = "1.0.26"
proc-macro2 = "1.0.53"
syn = { version = "2.0.9", features = ["full", "extra-traits"] }

[dependencies.espr]
version = "0.3.0"
Expand All @@ -27,5 +27,5 @@ path = "../espr"
[dev-dependencies]
ruststep = { version = "0.3.0", path = "../ruststep" }
ruststep-derive = { version = "0.3.0", path = "../ruststep-derive" }
serde = "1.0.136"
serde = "1.0.158"
derive-new = "0.5.9"
18 changes: 9 additions & 9 deletions espr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ categories = ["science", "development-tools"]

[dependencies]
# For parser
nom = "7.1.1"
nom = "7.1.3"

# For Rust code generation
syn = "1.0.91"
quote = "1.0.17"
proc-macro2 = "1.0.37"
syn = "2.0.9"
quote = "1.0.26"
proc-macro2 = "1.0.53"

# Utilities
Inflector = "0.11.4"
derive_more = "0.99.17"
itertools = "0.10.3"
itertools = "0.10.5"
maplit = "1.0.2"
thiserror = "1.0.30"
thiserror = "1.0.40"
structopt = "0.3.26"
check_keyword = "0.1.1"
katexit = "0.1.2"
check_keyword = "0.2.0"
katexit = "0.1.4"

[dev-dependencies]
insta = "1.14.0"
insta = "1.29.0"
maplit = "1.0.2"
13 changes: 8 additions & 5 deletions espr/src/codegen/rust/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl From<EntityAttribute> for Field {
fn from(attr: EntityAttribute) -> Self {
let EntityAttribute { name, ty, optional } = attr;

let name = format_ident!("{}", name.to_safe());
let name = format_ident!("{}", name.into_safe());
let attributes = if use_place_holder(&ty) {
vec![parse_quote! { #[holder(use_place_holder)] }]
} else {
Expand Down Expand Up @@ -83,14 +83,14 @@ impl Entity {

/// Field identifier
fn field_ident(&self) -> syn::Ident {
format_ident!("{}", self.name.to_safe())
format_ident!("{}", self.name.as_str().into_safe())
}

/// Generate declaration of `XxxAny` enum
fn generate_any_enum(&self, tokens: &mut TokenStream) {
let any = self.any_ident();

let mut fields = vec![format_ident!("{}", self.name.to_safe())];
let mut fields = vec![format_ident!("{}", self.name.as_str().into_safe())];
let mut variants = vec![format_ident!("{}", self.name.to_pascal_case())];
let mut constraints = vec![format_ident!("{}", self.name.to_pascal_case())];

Expand All @@ -99,7 +99,7 @@ impl Entity {
TypeRef::Entity {
name, is_supertype, ..
} => {
fields.push(format_ident!("{}", name.to_safe()));
fields.push(format_ident!("{}", name.as_str().into_safe()));
variants.push(format_ident!("{}", name.to_pascal_case()));
if *is_supertype {
constraints.push(format_ident!("{}Any", name.to_pascal_case()));
Expand Down Expand Up @@ -216,7 +216,10 @@ impl Entity {
let (name, ty) = match ty {
TypeRef::Named { name, .. } | TypeRef::Entity { name, .. } => {
let ty = format_ident!("{}", name.to_pascal_case());
(format_ident!("{}", name.to_safe()), parse_quote! { #ty })
(
format_ident!("{}", name.as_str().into_safe()),
parse_quote! { #ty },
)
}
_ => unreachable!(),
};
Expand Down
4 changes: 2 additions & 2 deletions espr/src/codegen/rust/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ impl Schema {
.collect();
let holder_name: Vec<_> = entities
.iter()
.map(|e| format_ident!("{}", e.name.to_safe()))
.map(|e| format_ident!("{}", e.name.as_str().into_safe()))
.chain(
type_decls
.clone()
.map(|e| format_ident!("{}", e.id().to_safe())),
.map(|e| format_ident!("{}", e.id().into_safe())),
)
.collect();
let holders_name: Vec<_> = entities
Expand Down
14 changes: 7 additions & 7 deletions ruststep-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ categories = ["science", "development-tools"]
proc-macro = true

[dependencies]
quote = "1.0.17"
proc-macro2 = "1.0.37"
syn = { version = "1.0.91", features = ["full", "extra-traits"] }
proc-macro-crate = "1.1.3"
quote = "1.0.26"
proc-macro2 = "1.0.53"
syn = { version = "2.0.9", features = ["full", "extra-traits"] }
proc-macro-crate = "1.2.1"
Inflector = "0.11.4"
proc-macro-error = "1.0.4"

[dev-dependencies]
serde = "1.0.136"
trybuild = "1.0.59"
insta = "1.14.0"
serde = "1.0.158"
trybuild = "1.0.80"
insta = "1.29.0"

[dev-dependencies.ruststep]
path = "../ruststep"
Expand Down
4 changes: 2 additions & 2 deletions ruststep-derive/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn ruststep_crate() -> syn::Path {
arguments: syn::PathArguments::None,
});
syn::Path {
leading_colon: Some(syn::token::Colon2::default()),
leading_colon: Some(syn::token::PathSep::default()),
segments,
}
}
Expand All @@ -75,7 +75,7 @@ pub fn ruststep_crate() -> syn::Path {
arguments: syn::PathArguments::None,
});
syn::Path {
leading_colon: Some(syn::token::Colon2::default()),
leading_colon: Some(syn::token::PathSep::default()),
segments,
}
}
Expand Down
2 changes: 1 addition & 1 deletion ruststep-derive/src/holder_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl HolderAttr {

for attr in attrs {
// Only read `#[holder(...)]`
if let Some(ident) = attr.path.get_ident() {
if let Some(ident) = attr.meta.path().get_ident() {
if ident != "holder" {
continue;
}
Expand Down
10 changes: 5 additions & 5 deletions ruststep/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ ap203 = []
[dependencies]
derive_more = "0.99.17"
derive-new = "0.5.9"
nom = "7.1.1"
serde = { version = "1.0.136", features = ["derive"] }
thiserror = "1.0.30"
nom = "7.1.3"
serde = { version = "1.0.158", features = ["derive"] }
thiserror = "1.0.40"
Inflector = "0.11.4"
itertools = "0.10.3"
itertools = "0.10.5"

[dependencies.ruststep-derive]
path = "../ruststep-derive"
version = "0.3.0"

[dev-dependencies]
anyhow = "1.0.56"
anyhow = "1.0.70"
maplit = "1.0.2"

[dev-dependencies.espr-derive]
Expand Down

0 comments on commit d7f93bf

Please sign in to comment.