diff --git a/lib/parser/compound_types.rb b/lib/parser/compound_types.rb index fb99789..2367dfa 100644 --- a/lib/parser/compound_types.rb +++ b/lib/parser/compound_types.rb @@ -5,15 +5,15 @@ module Parser rule(:array_constant) do left_bracket >> - ( ((operator_expression|r_value).as(:array_element) >> space? >> - (comma >> space? >> (operator_expression|r_value).as(:array_element)).repeat(0)).repeat(0,1)).as(:array_constant) >> + ( (r_value.as(:array_element) >> space? >> + (comma >> space? >> r_value.as(:array_element)).repeat(0)).repeat(0,1)).as(:array_constant) >> space? >> right_bracket end - rule(:hash_pair) { basic_type.as(:hash_key) >> association >> (operator_expression|r_value).as(:hash_value) } - rule(:hash_constant) { left_brace >> ((hash_pair.as(:hash_pair) >> - (comma >> space? >> hash_pair.as(:hash_pair)).repeat(0)).repeat(0,1)).as(:hash_constant)>> + rule(:hash_pair) { basic_type.as(:hash_key) >> association >> r_value.as(:hash_value) } + rule(:hash_constant) { left_brace >> ((hash_pair.as(:hash_pair) >> + (comma >> space? >> hash_pair.as(:hash_pair)).repeat(0)).repeat(0,1)).as(:hash_constant)>> space? >> right_brace } end -end \ No newline at end of file +end diff --git a/test/cases/array_constant/array_list.tst b/test/cases/array_constant/array_list.tst index 03eacd4..10fa31e 100644 --- a/test/cases/array_constant/array_list.tst +++ b/test/cases/array_constant/array_list.tst @@ -1,6 +1,5 @@ [42, foo] -- -- -- -s(:expressions, - s(:array, - s(:int, 42), - s(:name, :foo))) +s(:array, + s(:int, 42), + s(:name, :foo)) diff --git a/test/cases/array_constant/array_ops.tst b/test/cases/array_constant/array_ops.tst index d13a50b..7b90e95 100644 --- a/test/cases/array_constant/array_ops.tst +++ b/test/cases/array_constant/array_ops.tst @@ -1,11 +1,10 @@ [ 3 + 4 , foo(22) ] -- -- -- -s(:expressions, - s(:array, - s(:operator, "+", - s(:int, 3), - s(:int, 4)), - s(:call, - s(:name, :foo), - s(:arguments, - s(:int, 22))))) +s(:array, + s(:operator_value, :+, + s(:int, 3), + s(:int, 4)), + s(:call, + s(:name, :foo), + s(:arguments, + s(:int, 22)))) diff --git a/test/cases/array_constant/one_array.tst b/test/cases/array_constant/one_array.tst index f34df93..2271d2c 100644 --- a/test/cases/array_constant/one_array.tst +++ b/test/cases/array_constant/one_array.tst @@ -1,5 +1,4 @@ [42] -- -- -- -s(:expressions, - s(:array, - s(:int, 42))) +s(:array, + s(:int, 42)) diff --git a/test/cases/hash_constant/hash.tst b/test/cases/hash_constant/hash.tst index a4ec578..75f4e39 100644 --- a/test/cases/hash_constant/hash.tst +++ b/test/cases/hash_constant/hash.tst @@ -1,7 +1,6 @@ { foo => 33 } -- -- -- -s(:expressions, - s(:hash, - s(:assoc, - s(:name, :foo), - s(:int, 33)))) +s(:hash, + s(:assoc, + s(:name, :foo), + s(:int, 33))) diff --git a/test/cases/hash_constant/hash2.tst b/test/cases/hash_constant/hash2.tst index faee8f5..d6781fb 100644 --- a/test/cases/hash_constant/hash2.tst +++ b/test/cases/hash_constant/hash2.tst @@ -1,7 +1,6 @@ { foo => true } -- -- -- -s(:expressions, - s(:hash, - s(:assoc, - s(:name, :foo), - s(:true)))) +s(:hash, + s(:assoc, + s(:name, :foo), + s(:true))) diff --git a/test/cases/hash_constant/hash_list.tst b/test/cases/hash_constant/hash_list.tst index 1bd0270..b77db50 100644 --- a/test/cases/hash_constant/hash_list.tst +++ b/test/cases/hash_constant/hash_list.tst @@ -1,10 +1,9 @@ {foo => 33 , bar => 42} -- -- -- -s(:expressions, - s(:hash, - s(:assoc, - s(:name, :foo), - s(:int, 33)), - s(:assoc, - s(:name, :bar), - s(:int, 42)))) +s(:hash, + s(:assoc, + s(:name, :foo), + s(:int, 33)), + s(:assoc, + s(:name, :bar), + s(:int, 42)))