-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for writing SExpression in code generation (#107)
* Modifies `AbstractDataType::Sequence` to store sequence type (sexp or list) and element type * Adds changes for using a `SequenceType` enum in `AbstractDataType::Sequence` * Adds `element_type()` and `sequence_type()` methods on `AbstractDataType` to get element type and sequence type details * Renames and modifies `verify_abstract_data_type_consistency` to `verify_and_update_abstract_data_type` * `JavaLanguage` and `RustLanguage` updated `target_type` to return generic type for `List` and `SExp` * Adds `wrapper_class` in `JavaLanguage` to be sued within `ArrayList` * Adds template to generate `SerdeResult` in Rust * Adds template file changes for SExp support * Modifies class and struct template to add check for sequence type in write_to API * Adds new test and ISL files for SExp support * Adds changes to Java setter tests
- Loading branch information
Showing
24 changed files
with
436 additions
and
94 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
code-gen-projects/input/bad/nested_struct/mismatched_sequence_type.ion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// nested struct with mismatched sequence type | ||
{ | ||
A: "hello", | ||
B: 12, | ||
C: { | ||
D: false, | ||
E: (1 2 3) // expected list | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
B: 12, | ||
C: { | ||
D: 1e0, // expected type: bool | ||
E: [1, 2, 3] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
{ | ||
A: "hello", | ||
B: 12, | ||
C: [1, 2, 3], | ||
C: (1 2 3), | ||
D: 10e2 | ||
} | ||
|
7 changes: 7 additions & 0 deletions
7
code-gen-projects/input/bad/struct_with_fields/mismatched_sequence_type.ion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// simple struct with type mismatched sequence type | ||
{ | ||
A: "hello", | ||
B: 12, | ||
C: ["foo", "bar", "baz"], // expected sexp | ||
D: 10e2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
{ | ||
A: "hello", | ||
B: false, // expected field type: int | ||
C: ["foo", "bar", "baz"], | ||
C: ("foo" "bar" "baz"), | ||
D: 10e2 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
B: 12, | ||
C: { | ||
D: false, | ||
E: [1, 2, 3] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
A: "hello", | ||
C: { | ||
D: false, | ||
E: [1, 2, 3] | ||
} | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
code-gen-projects/input/good/struct_with_fields/empty_values.ion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// struct with empty list, empty string and zeros | ||
{ | ||
C: [], | ||
C: (), | ||
A: "", | ||
B: 0, | ||
D: 0e0, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
{ | ||
A: "hello", | ||
B: 12, | ||
C: ["foo", "bar", "baz"], | ||
C: ("foo" "bar" "baz"), | ||
D: 10e2 | ||
} |
2 changes: 1 addition & 1 deletion
2
code-gen-projects/input/good/struct_with_fields/valid_unordered_fields.ion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
// struct with unordered fields | ||
{ | ||
C: ["foo", "bar", "baz"], | ||
C: ("foo" "bar" "baz"), | ||
A: "hello", | ||
B: 12, | ||
D: 10e2, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ type::{ | |
B: int, | ||
C: { | ||
fields: { | ||
D: bool | ||
D: bool, | ||
E: { type: list, element: int } | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.