Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbkolb2008-03-04 15:20:36 +0000
committerbkolb2008-03-04 15:20:36 +0000
commit8a991f25bd196a70571bc98f4d49b20a0ad72448 (patch)
tree199905ec0be0e3cbfee1fafccddacdb9e1403a71
parent6789a19a05b93102fdff11e5373b80e56e8b85c6 (diff)
downloadorg.eclipse.xpand-8a991f25bd196a70571bc98f4d49b20a0ad72448.tar.gz
org.eclipse.xpand-8a991f25bd196a70571bc98f4d49b20a0ad72448.tar.xz
org.eclipse.xpand-8a991f25bd196a70571bc98f4d49b20a0ad72448.zip
initial
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/.classpath7
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/.project28
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.core.prefs256
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.ui.prefs5
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/build.properties4
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/Activator.java43
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/BackendTypeConverter.java48
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/SyntaxConstants.java26
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendBackendFacade.java78
-rw-r--r--plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendFrontendASTConverter.java428
12 files changed, 939 insertions, 0 deletions
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/.classpath b/plugins/org.eclipse.xtend.middleend.xpand3/.classpath
new file mode 100644
index 00000000..751c8f2e
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/.project b/plugins/org.eclipse.xtend.middleend.xpand3/.project
new file mode 100644
index 00000000..cfccba40
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.xtend.middleend.xpand3</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..002d59fc
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,256 @@
+#Mon Mar 03 16:27:21 CET 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..d9081e02
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,5 @@
+#Tue Mar 04 16:19:49 CET 2008
+eclipse.preferences.version=1
+formatter_profile=_oAW
+formatter_settings_version=11
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * &lt;copyright&gt; \r\n *\r\n * Copyright (c) 2002-2007 Kolbware and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\: \r\n * Kolbware, Bernd Kolb - Initial API and implementation\r\n *\r\n * &lt;/copyright&gt;\r\n *\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Bernd Kolb\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.pde.core.prefs b/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 00000000..f8d01187
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Mon Mar 03 16:06:53 CET 2008
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/META-INF/MANIFEST.MF b/plugins/org.eclipse.xtend.middleend.xpand3/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..de0fcf61
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Xpand3 Plug-in
+Bundle-SymbolicName: org.eclipse.xtend.middleend.xpand3
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.xtend.middleend.internal.xpand3.Activator
+Import-Package: org.osgi.framework;version="1.3.0"
+Eclipse-LazyStart: true
+Require-Bundle: org.eclipse.emf.mwe.core,
+ org.apache.commons.logging,
+ org.eclipse.xpand3,
+ org.eclipse.xtend.backend
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/build.properties b/plugins/org.eclipse.xtend.middleend.xpand3/build.properties
new file mode 100644
index 00000000..34d2e4d2
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/Activator.java b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/Activator.java
new file mode 100644
index 00000000..b0904429
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/Activator.java
@@ -0,0 +1,43 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2007 Kolbware and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kolbware, Bernd Kolb - Initial API and implementation
+ *
+ * </copyright>
+ *
+ */
+package org.eclipse.xtend.middleend.internal.xpand3;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Bernd Kolb
+ *
+ */
+public class Activator implements BundleActivator {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ }
+
+}
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/BackendTypeConverter.java b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/BackendTypeConverter.java
new file mode 100644
index 00000000..1ff44383
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/BackendTypeConverter.java
@@ -0,0 +1,48 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2007 Kolbware and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kolbware, Bernd Kolb - Initial API and implementation
+ *
+ * </copyright>
+ *
+ */
+package org.eclipse.xtend.middleend.internal.xpand3;
+
+import org.eclipse.xpand3.Identifier;
+import org.eclipse.xtend.backend.common.BackendType;
+import org.eclipse.xtend.backend.common.StaticProperty;
+
+/**
+ * @author Bernd Kolb
+ *
+ */
+public class BackendTypeConverter {
+
+ public BackendType convertToBackendType(Object ex) {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public StaticProperty getEnumLiteral(String value) {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public StaticProperty getEnumLiteral(Identifier name) {
+ return getEnumLiteral(qualify(name));
+ }
+
+ private String qualify(Identifier name) {
+ String value = name.getValue();
+ if (name.getNext() != null) {
+ value += SyntaxConstants.NS_DELIM + qualify(name.getNext());
+ }
+ return value;
+ }
+
+}
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/SyntaxConstants.java b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/SyntaxConstants.java
new file mode 100644
index 00000000..a1dead95
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/SyntaxConstants.java
@@ -0,0 +1,26 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2007 Kolbware and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kolbware, Bernd Kolb - Initial API and implementation
+ *
+ * </copyright>
+ *
+ */
+package org.eclipse.xtend.middleend.internal.xpand3;
+
+/**
+ * @author Bernd Kolb
+ *
+ */
+public interface SyntaxConstants {
+
+ String NS_DELIM = "::";
+
+}
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendBackendFacade.java b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendBackendFacade.java
new file mode 100644
index 00000000..38228931
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendBackendFacade.java
@@ -0,0 +1,78 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2007 Kolbware and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kolbware, Bernd Kolb - Initial API and implementation
+ *
+ * </copyright>
+ *
+ */
+package org.eclipse.xtend.middleend.internal.xpand3;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipose.xtend.middleend.MiddleEnd;
+import org.eclipose.xtend.middleend.MiddleEndFactory;
+import org.eclipse.xand3.analyzation.AnalyzeContext;
+import org.eclipse.xpand3.File;
+import org.eclipse.xpand3.declaration.Extension;
+import org.eclipse.xtend.backend.common.BackendTypesystem;
+import org.eclipse.xtend.backend.common.ExpressionBase;
+
+/**
+ * @author Bernd Kolb
+ *
+ */
+public class XtendBackendFacade {
+
+ private MiddleEnd middleEnd;
+ private BackendTypeConverter typeConverter;
+ private AnalyzeContext ctx;
+ private final String extensionFile;
+
+ public XtendBackendFacade(String extensionFile) {
+ this.extensionFile = extensionFile;
+ middleEnd = MiddleEndFactory.create(findBackendTypeSystem(), Collections.EMPTY_MAP);
+
+ // TODO: To be impl
+ typeConverter = null;
+ ctx = null;
+ }
+
+ private BackendTypesystem findBackendTypeSystem() {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public static Object evaluateExpression(String extensionFile, String expression, Map<String, Object> localVars) {
+ return createForFile(extensionFile).evaluateExpression(expression, localVars);
+ }
+
+ private static XtendBackendFacade createForFile(String extensionFile) {
+ return new XtendBackendFacade(extensionFile);
+ }
+
+ private Object evaluateExpression(String expression, Map<String, Object> localVars) {
+ if (localVars == null)
+ localVars = new HashMap<String, Object>();
+ File f = parse();
+
+ Extension ext = ctx.findExtension(expression, f.getDeclarations());
+ ExpressionBase expr = new XtendFrontendASTConverter(ctx, typeConverter, extensionFile
+ + SyntaxConstants.NS_DELIM + ext.getName().getValue()).convert(ext);
+
+ return expr.evaluate(middleEnd.getExecutionContext());
+ }
+
+ private File parse() {
+ // TODO: To be impl
+ throw new UnsupportedOperationException("Not yet impl");
+ }
+}
diff --git a/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendFrontendASTConverter.java b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendFrontendASTConverter.java
new file mode 100644
index 00000000..d0eaabbf
--- /dev/null
+++ b/plugins/org.eclipse.xtend.middleend.xpand3/src/org/eclipse/xtend/middleend/internal/xpand3/XtendFrontendASTConverter.java
@@ -0,0 +1,428 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2002-2007 Kolbware and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kolbware, Bernd Kolb - Initial API and implementation
+ *
+ * </copyright>
+ *
+ */
+package org.eclipse.xtend.middleend.internal.xpand3;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.xand3.analyzation.AnalyzeContext;
+import org.eclipse.xpand3.SyntaxElement;
+import org.eclipse.xpand3.expression.AbstractExpression;
+import org.eclipse.xpand3.expression.BooleanLiteral;
+import org.eclipse.xpand3.expression.Case;
+import org.eclipse.xpand3.expression.Cast;
+import org.eclipse.xpand3.expression.ChainExpression;
+import org.eclipse.xpand3.expression.CollectionExpression;
+import org.eclipse.xpand3.expression.ConstructorCallExpression;
+import org.eclipse.xpand3.expression.FeatureCall;
+import org.eclipse.xpand3.expression.GlobalVarExpression;
+import org.eclipse.xpand3.expression.IfExpression;
+import org.eclipse.xpand3.expression.IntegerLiteral;
+import org.eclipse.xpand3.expression.LetExpression;
+import org.eclipse.xpand3.expression.ListLiteral;
+import org.eclipse.xpand3.expression.Literal;
+import org.eclipse.xpand3.expression.NullLiteral;
+import org.eclipse.xpand3.expression.OperationCall;
+import org.eclipse.xpand3.expression.RealLiteral;
+import org.eclipse.xpand3.expression.StringLiteral;
+import org.eclipse.xpand3.expression.SwitchExpression;
+import org.eclipse.xpand3.expression.TypeSelectExpression;
+import org.eclipse.xpand3.staticTypesystem.AbstractTypeReference;
+import org.eclipse.xtend.backend.common.ExpressionBase;
+import org.eclipse.xtend.backend.common.SourcePos;
+import org.eclipse.xtend.backend.common.StaticProperty;
+import org.eclipse.xtend.backend.expr.CreateUncachedExpression;
+import org.eclipse.xtend.backend.expr.HidingLocalVarDefExpression;
+import org.eclipse.xtend.backend.expr.InitClosureExpression;
+import org.eclipse.xtend.backend.expr.InvocationOnCollectionExpression;
+import org.eclipse.xtend.backend.expr.InvocationOnObjectExpression;
+import org.eclipse.xtend.backend.expr.InvocationOnWhateverExpression;
+import org.eclipse.xtend.backend.expr.ListLiteralExpression;
+import org.eclipse.xtend.backend.expr.LiteralExpression;
+import org.eclipse.xtend.backend.expr.LocalVarEvalExpression;
+import org.eclipse.xtend.backend.expr.NewLocalVarDefExpression;
+import org.eclipse.xtend.backend.expr.PropertyOnCollectionExpression;
+import org.eclipse.xtend.backend.expr.PropertyOnObjectExpression;
+import org.eclipse.xtend.backend.expr.PropertyOnWhateverExpression;
+import org.eclipse.xtend.backend.expr.SequenceExpression;
+import org.eclipse.xtend.backend.syslib.SysLibNames;
+import org.eclipse.xtend.backend.types.builtin.CollectionType;
+import org.eclipse.xtend.backend.types.builtin.ObjectType;
+import org.eclipse.xtend.backend.util.CollectionHelper;
+import org.eclipse.xtend.backend.util.Pair;
+
+/**
+ * @author Bernd Kolb
+ *
+ */
+public class XtendFrontendASTConverter {
+
+ private String extensionName;
+ private final BackendTypeConverter typeConverter;
+ private AnalyzeContext ctx;
+
+ public XtendFrontendASTConverter(AnalyzeContext ctx, BackendTypeConverter typeConverter, String extensionName) {
+ this.ctx = ctx;
+ this.typeConverter = typeConverter;
+ this.extensionName = extensionName;
+ }
+
+ public ExpressionBase convert(SyntaxElement ele) {
+ throw new UnsupportedOperationException("Call for abstract class 'SyntaxElement'");
+ }
+
+ public ExpressionBase convert(Literal ele) {
+ throw new UnsupportedOperationException("Call for abstract class 'Literal'");
+ }
+
+ public ExpressionBase convert(BooleanLiteral lit) {
+ return new LiteralExpression("true".equals(lit.getLiteralValue().getValue()), getSourcePos(lit));
+ }
+
+ public ExpressionBase convert(IntegerLiteral lit) {
+ return new LiteralExpression(new Long(lit.getLiteralValue().getValue()), getSourcePos(lit));
+ }
+
+ public ExpressionBase convert(RealLiteral lit) {
+ return new LiteralExpression(new Double(lit.getLiteralValue().getValue()), getSourcePos(lit));
+ }
+
+ public ExpressionBase convert(NullLiteral lit) {
+ return new LiteralExpression(null, getSourcePos(lit));
+ }
+
+ public ExpressionBase convert(ListLiteral lit) {
+ final List<ExpressionBase> inner = new ArrayList<ExpressionBase>();
+
+ for (AbstractExpression e : lit.getElements())
+ inner.add(convert(e));
+
+ return new ListLiteralExpression(inner, getSourcePos(lit));
+ }
+
+ public ExpressionBase convert(StringLiteral lit) {
+ return new LiteralExpression(lit.getLiteralValue().getValue(), getSourcePos(lit));
+ }
+
+ public ExpressionBase convert(ChainExpression expr) {
+ return new SequenceExpression(getInner(expr), getSourcePos(expr));
+ }
+
+ public ExpressionBase convert(Cast expr) {
+ return convert(expr.getTarget());
+ }
+
+ public ExpressionBase convert(ConstructorCallExpression expr) {
+ return new CreateUncachedExpression(typeConverter.convertToBackendType(expr.getType()), getSourcePos(expr));
+ }
+
+ public ExpressionBase convert(FeatureCall expr) {
+ final SourcePos sourcePos = getSourcePos(expr);
+
+ if (expr.getTarget() == null) {
+ // 1. check for a static property
+ final StaticProperty staticProp = typeConverter.getEnumLiteral(expr.getName());
+ if (staticProp != null)
+ return new LiteralExpression(staticProp.get(), sourcePos);
+
+ // 2. check for a local variable
+ if (ctx.getLocalVars().containsKey(expr.getName().getValue()))
+ return new LocalVarEvalExpression(expr.getName().getValue(), sourcePos);
+
+ // 3. check for a type literal
+ try {
+ return new LiteralExpression(typeConverter.convertToBackendType(expr.getName()), sourcePos);
+ } catch (IllegalArgumentException exc) {
+ } // do nothing - this means
+ // it is not a type literal
+
+ // 4. check for "this"
+ if (ctx.hasThis()) {
+ final ExpressionBase thisExpr = new LocalVarEvalExpression(
+ org.eclipse.xtend.backend.common.SyntaxConstants.THIS, sourcePos);
+ return createPropertyExpression(thisExpr, ctx.getThis(), expr.getName().getValue(), sourcePos);
+ }
+
+ throw new IllegalArgumentException("feature call " + expr.toString() + " does not match any feature: "
+ + sourcePos);
+ } else {
+ // evaluate the target and evaluate the property on the result
+ return createPropertyExpression(convert(expr.getTarget()), analyze(expr.getTarget()), expr.getName()
+ .getValue(), sourcePos);
+ }
+ }
+
+ public ExpressionBase convert(CollectionExpression expr) {
+ final SourcePos sourcePos = getSourcePos(expr);
+
+ final String functionName = expr.getName().getValue();
+
+ final AnalyzeContext oldCtx = ctx;
+ ctx = ctx.cloneWithVariable(expr.getEleName(), null /*
+ * TODO ObjectType
+ */);
+ final ExpressionBase bodyExpr = convert(expr.getClosure());
+ ctx = oldCtx;
+
+ final InitClosureExpression closureExpr = new InitClosureExpression(
+ Arrays.asList(expr.getEleName().getValue()), Arrays.asList(ObjectType.INSTANCE), bodyExpr, sourcePos);
+
+ if (expr.getTarget() == null) {
+ if (!ctx.hasThis())
+ throw new IllegalStateException(functionName + " with neither a target nor an implicit 'this'");
+
+ final ExpressionBase thisExpr = new LocalVarEvalExpression(
+ org.eclipse.xtend.backend.common.SyntaxConstants.THIS, sourcePos);
+ return new InvocationOnObjectExpression(functionName, Arrays.asList(thisExpr, closureExpr), true, sourcePos);
+ } else
+ return new InvocationOnObjectExpression(functionName,
+ Arrays.asList(convert(expr.getTarget()), closureExpr), true, sourcePos);
+ }
+
+ public ExpressionBase convert(TypeSelectExpression expr) {
+ final SourcePos sourcePos = getSourcePos(expr);
+
+ final AbstractExpression t = ctx.getTypeForName(expr.getTypeLiteral());
+ final ExpressionBase typeExpr = new LiteralExpression(typeConverter.convertToBackendType(t), sourcePos);
+
+ if (expr.getTarget() == null) {
+ if (!ctx.hasThis())
+ throw new IllegalStateException("typeSelect with neither a target nor an implicit 'this'");
+
+ final ExpressionBase thisExpr = new LocalVarEvalExpression(
+ org.eclipse.xtend.backend.common.SyntaxConstants.THIS, sourcePos);
+ return new InvocationOnObjectExpression(SysLibNames.TYPE_SELECT, Arrays.asList(thisExpr, typeExpr), true,
+ sourcePos);
+ } else
+ return new InvocationOnObjectExpression(SysLibNames.TYPE_SELECT, Arrays.asList(convert(expr.getTarget()),
+ typeExpr), false, sourcePos);
+ }
+
+ public ExpressionBase convert(OperationCall expr) {
+ final SourcePos sourcePos = getSourcePos(expr);
+ final String functionName = transformFunctionName(expr.getName().getValue());
+
+ final List<ExpressionBase> params = new ArrayList<ExpressionBase>();
+ for (AbstractExpression e : expr.getParams())
+ params.add(convert(e));
+
+ final List<AbstractTypeReference> paramTypes = new ArrayList<AbstractTypeReference>();
+ for (AbstractExpression e : expr.getParams())
+ paramTypes.add(analyze(e));
+
+ if (expr.getTarget() == null) {
+ if (ctx.hasThis()) {
+ // if a function matches directly (i.e. without implicitly
+ // passing 'this' as a first parameter), that
+ // has precedence in matching
+ if (hasMatchingOperationCall(functionName, paramTypes.toArray(new AbstractTypeReference[0])))
+ return new InvocationOnObjectExpression(functionName, params, false, sourcePos);
+ else {
+ final ExpressionBase thisExpression = new LocalVarEvalExpression(
+ org.eclipse.xtend.backend.common.SyntaxConstants.THIS, sourcePos);
+ final AbstractTypeReference thisType = ctx.getVariable(AnalyzeContext.IMPLICIT_VARIABLE);
+ return createInvocationOnTargetExpression(functionName, thisExpression, thisType, params,
+ paramTypes, true, sourcePos);
+ }
+ } else
+ return new InvocationOnObjectExpression(functionName, params, false, sourcePos);
+ } else
+ return createInvocationOnTargetExpression(functionName, convert(expr.getTarget()),
+ analyze(expr.getTarget()), params, paramTypes, true, sourcePos);
+ }
+
+ public ExpressionBase convert(GlobalVarExpression expr) {
+ // TODO: To be impl
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public ExpressionBase convert(IfExpression expr) {
+ final ExpressionBase elseExpr = (expr.getElsePart() != null) ? convert(expr.getElsePart())
+ : new LiteralExpression(null, getSourcePos(expr));
+
+ return new org.eclipse.xtend.backend.expr.IfExpression(convert(expr.getCondition()),
+ convert(expr.getThenPart()), elseExpr, getSourcePos(expr));
+ }
+
+ public ExpressionBase convert(LetExpression expr) {
+ final ExpressionBase varExpr = convert(expr.getVarExpression());
+ final AbstractTypeReference varType = analyze(expr.getVarExpression());
+
+ final AnalyzeContext oldCtx = ctx;
+ ctx = ctx.cloneWithVariable(expr.getVarName(), varType);
+
+ try {
+ if (oldCtx.getLocalVars().containsKey(expr.getVarName()))
+ return new HidingLocalVarDefExpression(expr.getVarName().getValue(), varExpr, convert(expr
+ .getTargetExpression()), getSourcePos(expr));
+ else
+ return new NewLocalVarDefExpression(expr.getVarName().getValue(), varExpr, convert(expr
+ .getTargetExpression()), getSourcePos(expr));
+ } finally {
+ ctx = oldCtx;
+ }
+ }
+
+ public ExpressionBase convert(SwitchExpression expr) {
+ final List<Pair<ExpressionBase, ExpressionBase>> cases = new ArrayList<Pair<ExpressionBase, ExpressionBase>>();
+ for (Case c : expr.getCases())
+ cases.add(new Pair<ExpressionBase, ExpressionBase>(convert(c.getCondition()), convert(c.getThenPart())));
+
+ return new org.eclipse.xtend.backend.expr.SwitchExpression(convert(expr.getSwitchExpr()), cases, convert(expr
+ .getDefaultExpr()), getSourcePos(expr));
+ }
+
+ /**
+ * transform built-in operator names from the old to the new special names
+ */
+ private String transformFunctionName(String functionName) {
+ if ("+".equals(functionName))
+ return SysLibNames.OPERATOR_PLUS;
+ if ("-".equals(functionName))
+ return SysLibNames.OPERATOR_MINUS;
+ if ("*".equals(functionName))
+ return SysLibNames.OPERATOR_MULT;
+ if ("/".equals(functionName))
+ return SysLibNames.OPERATOR_DIV;
+ if ("%".equals(functionName))
+ return SysLibNames.OPERATOR_MOD;
+
+ if ("==".equals(functionName))
+ return SysLibNames.OPERATOR_EQUALS;
+ if ("!=".equals(functionName))
+ return SysLibNames.OPERATOR_NOT_EQUALS;
+ if ("<".equals(functionName))
+ return SysLibNames.OPERATOR_LESS;
+ if ("<=".equals(functionName))
+ return SysLibNames.OPERATOR_LESS_OR_EQUALS;
+ if (">=".equals(functionName))
+ return SysLibNames.OPERATOR_GREATER_OR_EQUALS;
+ if (">".equals(functionName))
+ return SysLibNames.OPERATOR_GREATER;
+
+ if ("!".equals(functionName))
+ return SysLibNames.OPERATOR_NOT;
+
+ if ("subString".equals(functionName))
+ return SysLibNames.SUBSTRING;
+ if ("replaceAll".equals(functionName))
+ return SysLibNames.REPLACE_ALL_REGEX;
+
+ return functionName;
+ }
+
+ private AbstractTypeReference analyze(AbstractExpression target) {
+ // TODO: To be impl
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ private ExpressionBase createInvocationOnTargetExpression(String functionName, ExpressionBase targetExpression,
+ AbstractTypeReference targetType, List<ExpressionBase> params, List<AbstractTypeReference> paramTypes,
+ boolean isMethodStyle, SourcePos sourcePos) {
+ final List<ExpressionBase> paramsWithoutFirst = params;
+ final List<ExpressionBase> allParams = new ArrayList<ExpressionBase>();
+ allParams.add(targetExpression);
+ allParams.addAll(params);
+
+ if (isCollectionType(targetType)) {
+ paramTypes.add(0, targetType);
+ final AbstractTypeReference[] paramTypeArray = paramTypes.toArray(new AbstractTypeReference[0]);
+
+ if (hasMatchingOperationCall(functionName, paramTypeArray))
+ // check if there is a function that directly matches the
+ // collection
+ return new InvocationOnObjectExpression(functionName, allParams, true, sourcePos);
+ else
+ // otherwise, do a 'collect' and call the function on all
+ // elements of the collection
+ return new InvocationOnCollectionExpression(targetExpression, functionName, paramsWithoutFirst,
+ sourcePos);
+ }
+
+ if (isObjectType(targetType))
+ // if the static type is "Object", we do not know if it is a
+ // collection, so we do the logic at runtime
+ return new InvocationOnWhateverExpression(functionName, allParams, isMethodStyle, sourcePos);
+
+ // otherwise we know that it is not a collection and can avoid repeating
+ // this logic at runtime
+ return new InvocationOnObjectExpression(functionName, allParams, true, sourcePos);
+ }
+
+ private boolean hasMatchingOperationCall(String functionName, AbstractTypeReference[] paramTypes) {
+ if (ctx.getExtensionForTypes(functionName, paramTypes) != null)
+ return true;
+
+ if (paramTypes.length == 0)
+ return false;
+
+ final AbstractTypeReference target = paramTypes[0];
+ return ctx.getOperationFor(target, functionName, CollectionHelper.withoutFirst(paramTypes)) != null;
+ }
+
+ private ExpressionBase createPropertyExpression(ExpressionBase target, Object type, String varName,
+ SourcePos sourcePos) {
+ if (isCollectionType(type)) {
+ if (CollectionType.INSTANCE.getProperties().keySet().contains(varName))
+ return new PropertyOnObjectExpression(target, varName, sourcePos);
+ else
+ return new PropertyOnCollectionExpression(target, varName, sourcePos);
+ }
+
+ if (isObjectType(type))
+ return new PropertyOnWhateverExpression(target, varName, sourcePos);
+
+ return new PropertyOnObjectExpression(target, varName, sourcePos);
+ }
+
+ private boolean isObjectType(Object t) {
+ // TODO : To be impl
+ return true;
+ // throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ private boolean isCollectionType(Object t) {
+ // TODO : To be impl
+ return false;
+ // throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ /**
+ * extract the inner expressions as a "flat" list - they are stored as a
+ * binary tree in the ChainExpression...
+ */
+ private List<ExpressionBase> getInner(ChainExpression expr) {
+ final List<ExpressionBase> result = new ArrayList<ExpressionBase>();
+
+ if (expr.getFirst() instanceof ChainExpression)
+ result.addAll(getInner((ChainExpression) expr.getFirst()));
+ else
+ result.add(convert(expr.getFirst()));
+
+ if (expr.getNext() instanceof ChainExpression)
+ result.addAll(getInner((ChainExpression) expr.getNext()));
+ else
+ result.add(convert(expr.getNext()));
+
+ return result;
+ }
+
+ private SourcePos getSourcePos(SyntaxElement lit) {
+ return new SourcePos(lit.getFileName(), extensionName, lit.getLine());
+ }
+
+}

Back to the top