Class: Expressir::Express::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/expressir/express/formatter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.format(node) ⇒ String

Formats Express model into an Express code

Parameters:

Returns:



46
47
48
49
# File 'lib/expressir/express/formatter.rb', line 46

def self.format(node)
  formatter = self.new
  formatter.format(node)
end

Instance Method Details

#format(node) ⇒ String

Formats Express model into an Express code

Parameters:

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/expressir/express/formatter.rb', line 54

def format(node)
  if node.is_a? Model::Repository
    format_repository(node)
  elsif node.is_a? Model::Declarations::Attribute
    format_declarations_attribute(node)
  elsif node.is_a? Model::Declarations::Constant
    format_declarations_constant(node)
  elsif node.is_a? Model::Declarations::Entity
    format_declarations_entity(node)
  elsif node.is_a? Model::Declarations::Function
    format_declarations_function(node)
  elsif node.is_a? Model::Declarations::Interface
    format_declarations_interface(node)
  elsif node.is_a? Model::Declarations::InterfaceItem
    format_declarations_interface_item(node)
  elsif node.is_a? Model::Declarations::Parameter
    format_declarations_parameter(node)
  elsif node.is_a? Model::Declarations::Procedure
    format_declarations_procedure(node)
  elsif node.is_a? Model::Declarations::Rule
    format_declarations_rule(node)
  elsif node.is_a? Model::Declarations::Schema
    format_declarations_schema(node)
  elsif node.is_a? Model::Declarations::SchemaVersion
    format_declarations_schema_version(node)
  elsif node.is_a? Model::Declarations::SubtypeConstraint
    format_declarations_subtype_constraint(node)
  elsif node.is_a? Model::Declarations::Type
    format_declarations_type(node)
  elsif node.is_a? Model::Declarations::UniqueRule
    format_declarations_unique_rule(node)
  elsif node.is_a? Model::Declarations::Variable
    format_declarations_variable(node)
  elsif node.is_a? Model::Declarations::WhereRule
    format_declarations_where_rule(node)
  elsif node.is_a? Model::DataTypes::Aggregate
    format_data_types_aggregate(node)
  elsif node.is_a? Model::DataTypes::Array
    format_data_types_array(node)
  elsif node.is_a? Model::DataTypes::Bag
    format_data_types_bag(node)
  elsif node.is_a? Model::DataTypes::Binary
    format_data_types_binary(node)
  elsif node.is_a? Model::DataTypes::Boolean
    format_data_types_boolean(node)
  elsif node.is_a? Model::DataTypes::Enumeration
    format_data_types_enumeration(node)
  elsif node.is_a? Model::DataTypes::EnumerationItem
    format_data_types_enumeration_item(node)
  elsif node.is_a? Model::DataTypes::GenericEntity
    format_data_types_generic_entity(node)
  elsif node.is_a? Model::DataTypes::Generic
    format_data_types_generic(node)
  elsif node.is_a? Model::DataTypes::Integer
    format_data_types_integer(node)
  elsif node.is_a? Model::DataTypes::List
    format_data_types_list(node)
  elsif node.is_a? Model::DataTypes::Logical
    format_data_types_logical(node)
  elsif node.is_a? Model::DataTypes::Number
    format_data_types_number(node)
  elsif node.is_a? Model::DataTypes::Real
    format_data_types_real(node)
  elsif node.is_a? Model::DataTypes::Select
    format_data_types_select(node)
  elsif node.is_a? Model::DataTypes::Set
    format_data_types_set(node)
  elsif node.is_a? Model::DataTypes::String
    format_data_types_string(node)
  elsif node.is_a? Model::Expressions::AggregateInitializer
    format_expressions_aggregate_initializer(node)
  elsif node.is_a? Model::Expressions::AggregateInitializerItem
    format_expressions_aggregate_initializer_item(node)
  elsif node.is_a? Model::Expressions::BinaryExpression
    format_expressions_binary_expression(node)
  elsif node.is_a? Model::Expressions::EntityConstructor
    format_expressions_entity_constructor(node)
  elsif node.is_a? Model::Expressions::FunctionCall
    format_expressions_function_call(node)
  elsif node.is_a? Model::Expressions::Interval
    format_expressions_interval(node)
  elsif node.is_a? Model::Expressions::QueryExpression
    format_expressions_query_expression(node)
  elsif node.is_a? Model::Expressions::UnaryExpression
    format_expressions_unary_expression(node)
  elsif node.is_a? Model::Literals::Binary
    format_literals_binary(node)
  elsif node.is_a? Model::Literals::Integer
    format_literals_integer(node)
  elsif node.is_a? Model::Literals::Logical
    format_literals_logical(node)
  elsif node.is_a? Model::Literals::Real
    format_literals_real(node)
  elsif node.is_a? Model::Literals::String
    format_literals_string(node)
  elsif node.is_a? Model::References::AttributeReference
    format_references_attribute_reference(node)
  elsif node.is_a? Model::References::GroupReference
    format_references_group_reference(node)
  elsif node.is_a? Model::References::IndexReference
    format_references_index_reference(node)
  elsif node.is_a? Model::References::SimpleReference
    format_references_simple_reference(node)
  elsif node.is_a? Model::Statements::Alias
    format_statements_alias(node)
  elsif node.is_a? Model::Statements::Assignment
    format_statements_assignment(node)
  elsif node.is_a? Model::Statements::Case
    format_statements_case(node)
  elsif node.is_a? Model::Statements::CaseAction
    format_statements_case_action(node)
  elsif node.is_a? Model::Statements::Compound
    format_statements_compound(node)
  elsif node.is_a? Model::Statements::Escape
    format_statements_escape(node)
  elsif node.is_a? Model::Statements::If
    format_statements_if(node)
  elsif node.is_a? Model::Statements::Null
    format_statements_null(node)
  elsif node.is_a? Model::Statements::ProcedureCall
    format_statements_procedure_call(node)
  elsif node.is_a? Model::Statements::Repeat
    format_statements_repeat(node)
  elsif node.is_a? Model::Statements::Return
    format_statements_return(node)
  elsif node.is_a? Model::Statements::Skip
    format_statements_skip(node)
  elsif node.is_a? Model::SupertypeExpressions::BinarySupertypeExpression
    format_supertype_expressions_binary_supertype_expression(node)
  elsif node.is_a? Model::SupertypeExpressions::OneofSupertypeExpression
    format_supertype_expressions_oneof_supertype_expression(node)
  else
    STDERR.puts "#{node.class.name} format not implemented"
    ""
  end
end