Skip to content

Commit

Permalink
Prefer v0/v1 names for variable bytes/int type names in DSL v2
Browse files Browse the repository at this point in the history
These make more sense, given that these are the names used in the
official grammar (fixed-bytes, signed-integer-type,
unsigned-integer-type) and "XXXKeyword" name implies a single atom and
not a more complex rule (e.g. looking at the `fixed` definition...).

I think we should revert the accidental name change in v2 and later
decide if we want to change these.
  • Loading branch information
Xanewok committed Nov 16, 2023
1 parent 3e4d2b6 commit c986ba8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions crates/solidity/inputs/language/src/definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ codegen_language_macros::compile!(Language(
)]
),
Keyword(
name = BytesKeyword,
name = FixedBytesType,
identifier = Identifier,
definitions = [KeywordDefinition(
value = Sequence([
Expand Down Expand Up @@ -703,7 +703,7 @@ codegen_language_macros::compile!(Language(
)]
),
Keyword(
name = FixedKeyword,
name = SignedFixedType,
identifier = Identifier,
definitions = [
KeywordDefinition(value = Atom("fixed")),
Expand Down Expand Up @@ -1079,7 +1079,7 @@ codegen_language_macros::compile!(Language(
definitions = [KeywordDefinition(value = Atom("internal"))]
),
Keyword(
name = IntKeyword,
name = SignedIntegerType,
identifier = Identifier,
definitions = [KeywordDefinition(
value = Sequence([
Expand Down Expand Up @@ -1412,7 +1412,7 @@ codegen_language_macros::compile!(Language(
[KeywordDefinition(enabled = Never, value = Atom("typeof"))]
),
Keyword(
name = UfixedKeyword,
name = UnsignedFixedType,
identifier = Identifier,
definitions = [
KeywordDefinition(value = Atom("ufixed")),
Expand Down Expand Up @@ -1690,7 +1690,7 @@ codegen_language_macros::compile!(Language(
]
),
Keyword(
name = UintKeyword,
name = UnsignedIntegerType,
identifier = Identifier,
definitions = [KeywordDefinition(
value = Sequence([
Expand Down Expand Up @@ -2817,16 +2817,19 @@ codegen_language_macros::compile!(Language(
EnumVariant(name = String, reference = StringKeyword),
EnumVariant(name = Address, reference = AddressType),
EnumVariant(name = Payable, reference = PayableKeyword),
EnumVariant(name = ByteArray, reference = BytesKeyword),
EnumVariant(name = SignedInteger, reference = IntKeyword),
EnumVariant(name = UnsignedInteger, reference = UintKeyword),
EnumVariant(name = ByteArray, reference = FixedBytesType),
EnumVariant(name = SignedInteger, reference = SignedIntegerType),
EnumVariant(
name = UnsignedInteger,
reference = UnsignedIntegerType
),
EnumVariant(
name = SignedFixedPointNumber,
reference = FixedKeyword
reference = SignedFixedType
),
EnumVariant(
name = UnsignedFixedPointNumber,
reference = UfixedKeyword
reference = UnsignedFixedType
)
]
),
Expand Down Expand Up @@ -4396,7 +4399,7 @@ codegen_language_macros::compile!(Language(
[KeywordDefinition(enabled = Never, value = Atom("byte"))]
),
Keyword(
name = YulBytesKeyword,
name = YulFixedBytesType,
identifier = YulIdentifier,
definitions = [KeywordDefinition(
enabled = Never,
Expand Down Expand Up @@ -5453,7 +5456,7 @@ codegen_language_macros::compile!(Language(
)]
),
Keyword(
name = YulUfixedKeyword,
name = YulUnsignedFixedType,
identifier = YulIdentifier,
definitions = [
KeywordDefinition(
Expand Down
2 changes: 1 addition & 1 deletion crates/solidity/testing/solc/src/keywords/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl TestCase {

fn should_test_item(item: &str) -> bool {
match item {
"FixedKeyword" | "UfixedKeyword" | "YulUfixedKeyword" | "YulFixedKeyword" => {
"SignedFixedType" | "UnsignedFixedType" | "YulUnsignedFixedType" | "YulUnsignedFixedType" => {
println!("WARNING: skipping '{item}' by default, as it generates thousands of variations. Enable manually if needed.");
return false;
}
Expand Down

0 comments on commit c986ba8

Please sign in to comment.