Skip to content

Commit

Permalink
TDL syntax updates (amazon-ion#845)
Browse files Browse the repository at this point in the history
* Switches macro invocation syntax to `(.name)`
* Switches variable expansion syntax to `(%name)`
* Renames `void` macro to `none`
* update ion-tests
* removes tests from the 1.1 skip list
  • Loading branch information
zslayton authored Oct 24, 2024
1 parent ec13464 commit f1f4435
Show file tree
Hide file tree
Showing 16 changed files with 455 additions and 333 deletions.
2 changes: 1 addition & 1 deletion ion-tests
Submodule ion-tests updated 26 files
+7 −7 conformance/README.md
+16 −0 conformance/core/empty_document.ion
+4 −4 conformance/eexp/basic_system_macros.ion
+152 −0 conformance/ion_encoding/module/macro/cardinality/invoke_cardinality_ee.ion
+145 −0 conformance/ion_encoding/module/macro/cardinality/invoke_cardinality_tl.ion
+2 −2 conformance/ion_encoding/module/macro/trivial/invoke_ee.ion
+1 −1 conformance/ion_encoding/module/macro_table.ion
+3 −3 conformance/ivm.ion
+418 −0 conformance/types/integer.ion
+0 −12 iontestdata/good/symbolsThatAreSubstringsOfKeywords.ion
+45 −0 iontestdata_1_1/good/equivs/macros/none.ion
+0 −45 iontestdata_1_1/good/equivs/macros/void.ion
+3 −3 iontestdata_1_1/good/macros/README.md
+1 −1 iontestdata_1_1/good/macros/none.ion
+25 −0 iontestdata_1_1/good/macros/none_invoked_deeply_nested.ion
+6 −0 iontestdata_1_1/good/macros/none_invoked_in_list.ion
+5 −0 iontestdata_1_1/good/macros/none_invoked_in_sexp.ion
+6 −0 iontestdata_1_1/good/macros/none_invoked_in_struct.ion
+4 −0 iontestdata_1_1/good/macros/none_invoked_in_struct_field.ion
+2 −0 iontestdata_1_1/good/macros/none_invoked_in_values_macro.ion
+0 −25 iontestdata_1_1/good/macros/void_invoked_deeply_nested.ion
+0 −6 iontestdata_1_1/good/macros/void_invoked_in_list.ion
+0 −5 iontestdata_1_1/good/macros/void_invoked_in_sexp.ion
+0 −6 iontestdata_1_1/good/macros/void_invoked_in_struct.ion
+0 −4 iontestdata_1_1/good/macros/void_invoked_in_struct_field.ion
+0 −2 iontestdata_1_1/good/macros/void_invoked_in_values_macro.ion
10 changes: 5 additions & 5 deletions src/lazy/binary/raw/v1_1/immutable_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ mod tests {
fn read_eexp_with_one_arg() -> IonResult<()> {
let macro_source = r#"
(macro greet (name)
(make_string "Hello, " name "!")
(.make_string "Hello, " name "!")
)
"#;

Expand Down Expand Up @@ -1313,7 +1313,7 @@ mod tests {
fn read_eexp_with_two_args() -> IonResult<()> {
let macro_source = r#"
(macro greet (name day)
(make_string "Hello, " name "! Have a pleasant " day ".")
(.make_string "Hello, " name "! Have a pleasant " day ".")
)
"#;

Expand Down Expand Up @@ -1451,7 +1451,7 @@ mod tests {
#[test]
fn read_eexp_with_star_parameter_arg_group_nested_eexp() -> IonResult<()> {
let macro_source = r#"
(macro wrap_in_list (values*) ["first", values, "last"])
(macro wrap_in_list (values*) ["first", (%values), "last"])
"#;

let expected_text = r#"
Expand Down Expand Up @@ -1494,7 +1494,7 @@ mod tests {
#[test]
fn read_length_prefixed_eexp_with_star_parameter_arg_group_nested_eexp() -> IonResult<()> {
let macro_source = r#"
(macro wrap_in_list (values*) ["first", values, "last"])
(macro wrap_in_list (values*) ["first", (%values), "last"])
"#;

let expected_text = r#"
Expand Down Expand Up @@ -1579,7 +1579,7 @@ mod tests {
#[test]
fn read_length_prefixed_eexp_with_star_parameter_empty() -> IonResult<()> {
let macro_source = r#"
(macro wrap_in_list (values*) ["first", values, "last"])
(macro wrap_in_list (values*) ["first", (%values), "last"])
"#;

let expected_text = r#"
Expand Down
2 changes: 1 addition & 1 deletion src/lazy/binary/raw/v1_1/struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ mod tests {
(symbol_table $ion_encoding)
(macro_table
$ion_encoding
(macro greet (name) (make_string "hello, " name))
(macro greet (name) (.make_string "hello, " (%name)))
)
)
"#,
Expand Down
200 changes: 138 additions & 62 deletions src/lazy/expanded/compiler.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lazy/expanded/e_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl<'top, D: Decoder> EExpression<'top, D> {
// Initialize a `MacroExpansionKind` with the state necessary to evaluate the requested
// macro.
let expansion_kind = match invoked_macro.kind() {
MacroKind::Void => MacroExpansionKind::Void,
MacroKind::None => MacroExpansionKind::None,
MacroKind::ExprGroup => {
MacroExpansionKind::ExprGroup(ExprGroupExpansion::new(arguments))
}
Expand Down
Loading

0 comments on commit f1f4435

Please sign in to comment.