expressir 0.2.26-x86_64-darwin → 1.2.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +50 -5
- data/.github/workflows/release.yml +8 -0
- data/.gitignore +2 -2
- data/.hound.yml +3 -0
- data/.rubocop.yml +6 -506
- data/.yardopts +11 -0
- data/Rakefile +3 -0
- data/demo.rb +5 -5
- data/exe/format +8 -8
- data/exe/format-test +11 -11
- data/expressir.gemspec +4 -2
- data/lib/expressir/cli.rb +0 -6
- data/lib/expressir/{express_exp/2.7 → express/2.4}/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp → express}/2.5/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp/2.4 → express/2.6}/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp/2.6 → express/2.7}/express_parser.bundle +0 -0
- data/lib/expressir/{express_exp → express}/3.0/express_parser.bundle +0 -0
- data/lib/expressir/express/cache.rb +51 -0
- data/lib/expressir/{express_exp → express}/formatter.rb +304 -237
- data/lib/expressir/{express_exp → express}/hyperlink_formatter.rb +16 -2
- data/lib/expressir/{express_exp → express}/model_visitor.rb +2 -1
- data/lib/expressir/{express_exp → express}/parser.rb +19 -13
- data/lib/expressir/{express_exp → express}/resolve_references_model_visitor.rb +9 -7
- data/lib/expressir/express/schema_head_formatter.rb +23 -0
- data/lib/expressir/{express_exp → express}/visitor.rb +318 -270
- data/lib/expressir/model/cache.rb +6 -2
- data/lib/expressir/model/data_type.rb +9 -0
- data/lib/expressir/model/data_types/aggregate.rb +31 -0
- data/lib/expressir/model/data_types/array.rb +31 -0
- data/lib/expressir/model/data_types/bag.rb +25 -0
- data/lib/expressir/model/data_types/binary.rb +22 -0
- data/lib/expressir/model/data_types/boolean.rb +10 -0
- data/lib/expressir/model/data_types/enumeration.rb +25 -0
- data/lib/expressir/model/data_types/enumeration_item.rb +26 -0
- data/lib/expressir/model/data_types/generic.rb +26 -0
- data/lib/expressir/model/data_types/generic_entity.rb +26 -0
- data/lib/expressir/model/data_types/integer.rb +10 -0
- data/lib/expressir/model/data_types/list.rb +28 -0
- data/lib/expressir/model/data_types/logical.rb +10 -0
- data/lib/expressir/model/data_types/number.rb +10 -0
- data/lib/expressir/model/data_types/real.rb +19 -0
- data/lib/expressir/model/data_types/select.rb +28 -0
- data/lib/expressir/model/data_types/set.rb +25 -0
- data/lib/expressir/model/data_types/string.rb +22 -0
- data/lib/expressir/model/declaration.rb +9 -0
- data/lib/expressir/model/declarations/attribute.rb +47 -0
- data/lib/expressir/model/declarations/constant.rb +34 -0
- data/lib/expressir/model/declarations/entity.rb +53 -0
- data/lib/expressir/model/declarations/function.rb +67 -0
- data/lib/expressir/model/declarations/interface.rb +28 -0
- data/lib/expressir/model/declarations/interface_item.rb +23 -0
- data/lib/expressir/model/declarations/interfaced_item.rb +37 -0
- data/lib/expressir/model/declarations/parameter.rb +34 -0
- data/lib/expressir/model/declarations/procedure.rb +64 -0
- data/lib/expressir/model/declarations/remark_item.rb +21 -0
- data/lib/expressir/model/declarations/rule.rb +71 -0
- data/lib/expressir/model/declarations/schema.rb +117 -0
- data/lib/expressir/model/declarations/schema_version.rb +22 -0
- data/lib/expressir/model/declarations/schema_version_item.rb +22 -0
- data/lib/expressir/model/declarations/subtype_constraint.rb +40 -0
- data/lib/expressir/model/declarations/type.rb +45 -0
- data/lib/expressir/model/declarations/unique_rule.rb +31 -0
- data/lib/expressir/model/declarations/variable.rb +34 -0
- data/lib/expressir/model/declarations/where_rule.rb +31 -0
- data/lib/expressir/model/expression.rb +9 -0
- data/lib/expressir/model/expressions/aggregate_initializer.rb +7 -3
- data/lib/expressir/model/expressions/aggregate_initializer_item.rb +22 -0
- data/lib/expressir/model/expressions/binary_expression.rb +16 -5
- data/lib/expressir/model/expressions/entity_constructor.rb +9 -4
- data/lib/expressir/model/expressions/function_call.rb +22 -0
- data/lib/expressir/model/expressions/interval.rb +17 -6
- data/lib/expressir/model/expressions/query_expression.rb +11 -7
- data/lib/expressir/model/expressions/unary_expression.rb +9 -3
- data/lib/expressir/model/identifier.rb +26 -4
- data/lib/expressir/model/literal.rb +9 -0
- data/lib/expressir/model/literals/binary.rb +6 -2
- data/lib/expressir/model/literals/integer.rb +6 -2
- data/lib/expressir/model/literals/logical.rb +6 -2
- data/lib/expressir/model/literals/real.rb +6 -2
- data/lib/expressir/model/literals/string.rb +8 -3
- data/lib/expressir/model/model_element.rb +63 -37
- data/lib/expressir/model/reference.rb +9 -0
- data/lib/expressir/model/references/attribute_reference.rb +22 -0
- data/lib/expressir/model/references/group_reference.rb +22 -0
- data/lib/expressir/model/references/index_reference.rb +27 -0
- data/lib/expressir/model/references/simple_reference.rb +24 -0
- data/lib/expressir/model/repository.rb +6 -2
- data/lib/expressir/model/statement.rb +9 -0
- data/lib/expressir/model/statements/alias.rb +12 -8
- data/lib/expressir/model/statements/assignment.rb +8 -3
- data/lib/expressir/model/statements/case.rb +11 -5
- data/lib/expressir/model/statements/case_action.rb +8 -3
- data/lib/expressir/model/statements/compound.rb +7 -3
- data/lib/expressir/model/statements/escape.rb +3 -1
- data/lib/expressir/model/statements/if.rb +12 -6
- data/lib/expressir/model/statements/null.rb +3 -1
- data/lib/expressir/model/statements/procedure_call.rb +22 -0
- data/lib/expressir/model/statements/repeat.rb +20 -12
- data/lib/expressir/model/statements/return.rb +6 -2
- data/lib/expressir/model/statements/skip.rb +3 -1
- data/lib/expressir/model/supertype_expression.rb +9 -0
- data/lib/expressir/model/supertype_expressions/binary_supertype_expression.rb +29 -0
- data/lib/expressir/model/supertype_expressions/oneof_supertype_expression.rb +19 -0
- data/lib/expressir/model.rb +52 -43
- data/lib/expressir/version.rb +1 -1
- data/lib/expressir.rb +0 -1
- data/rakelib/cross-ruby.rake +1 -1
- data/spec/expressir/{express_exp → express}/cache_spec.rb +9 -9
- data/spec/expressir/express/formatter_spec.rb +127 -0
- data/spec/expressir/{express_exp → express}/parser_spec.rb +23 -23
- data/spec/expressir/model/model_element_spec.rb +153 -153
- data/{original/examples → spec}/syntax/multiple.exp +0 -0
- data/spec/syntax/multiple.yaml +198 -0
- data/{original/examples → spec}/syntax/multiple_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/multiple_hyperlink_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/multiple_schema_head_hyperlink_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/remark.exp +0 -0
- data/{original/examples → spec}/syntax/remark.yaml +73 -73
- data/{original/examples → spec}/syntax/remark_formatted.exp +0 -0
- data/{original/examples → spec}/syntax/single.exp +1 -1
- data/spec/syntax/single.yaml +18 -0
- data/{original/examples → spec}/syntax/single_formatted.exp +1 -1
- data/{original/examples → spec}/syntax/single_formatted.yaml +9 -6
- data/{original/examples → spec}/syntax/syntax.exp +11 -11
- data/{original/examples → spec}/syntax/syntax.yaml +1100 -1111
- data/{original/examples → spec}/syntax/syntax_formatted.exp +11 -11
- data/{original/examples → spec}/syntax/syntax_hyperlink_formatted.exp +11 -11
- data/{original/examples → spec}/syntax/syntax_schema_head_formatted.exp +1 -1
- metadata +128 -121
- data/lib/expressir/express/aggregate_dimension.rb +0 -38
- data/lib/expressir/express/attribute.rb +0 -15
- data/lib/expressir/express/comment.rb +0 -7
- data/lib/expressir/express/defined_type.rb +0 -36
- data/lib/expressir/express/derived.rb +0 -65
- data/lib/expressir/express/derived_aggregate.rb +0 -43
- data/lib/expressir/express/entity.rb +0 -137
- data/lib/expressir/express/explicit.rb +0 -70
- data/lib/expressir/express/explicit_aggregate.rb +0 -46
- data/lib/expressir/express/explicit_or_derived.rb +0 -16
- data/lib/expressir/express/global_rule.rb +0 -44
- data/lib/expressir/express/interface_specification.rb +0 -51
- data/lib/expressir/express/interfaced_item.rb +0 -38
- data/lib/expressir/express/inverse.rb +0 -46
- data/lib/expressir/express/inverse_aggregate.rb +0 -37
- data/lib/expressir/express/model_element.rb +0 -7
- data/lib/expressir/express/named_type.rb +0 -19
- data/lib/expressir/express/remark.rb +0 -8
- data/lib/expressir/express/repository.rb +0 -306
- data/lib/expressir/express/schema_definition.rb +0 -96
- data/lib/expressir/express/subtype_constraint.rb +0 -14
- data/lib/expressir/express/type.rb +0 -26
- data/lib/expressir/express/type_aggregate.rb +0 -42
- data/lib/expressir/express/type_enum.rb +0 -29
- data/lib/expressir/express/type_parser.rb +0 -45
- data/lib/expressir/express/type_select.rb +0 -82
- data/lib/expressir/express/unique_rule.rb +0 -35
- data/lib/expressir/express/where_rule.rb +0 -32
- data/lib/expressir/express.rb +0 -11
- data/lib/expressir/express_exp/cache.rb +0 -48
- data/lib/expressir/express_exp/schema_head_formatter.rb +0 -9
- data/lib/expressir/express_parser.rb +0 -30
- data/lib/expressir/model/attribute.rb +0 -38
- data/lib/expressir/model/constant.rb +0 -28
- data/lib/expressir/model/entity.rb +0 -42
- data/lib/expressir/model/enumeration_item.rb +0 -22
- data/lib/expressir/model/expressions/aggregate_item.rb +0 -17
- data/lib/expressir/model/expressions/attribute_reference.rb +0 -17
- data/lib/expressir/model/expressions/call.rb +0 -17
- data/lib/expressir/model/expressions/group_reference.rb +0 -17
- data/lib/expressir/model/expressions/index_reference.rb +0 -19
- data/lib/expressir/model/expressions/simple_reference.rb +0 -19
- data/lib/expressir/model/function.rb +0 -57
- data/lib/expressir/model/interface.rb +0 -20
- data/lib/expressir/model/interface_item.rb +0 -15
- data/lib/expressir/model/interfaced_item.rb +0 -27
- data/lib/expressir/model/parameter.rb +0 -28
- data/lib/expressir/model/procedure.rb +0 -55
- data/lib/expressir/model/remark_item.rb +0 -15
- data/lib/expressir/model/rule.rb +0 -60
- data/lib/expressir/model/schema.rb +0 -100
- data/lib/expressir/model/statements/call.rb +0 -17
- data/lib/expressir/model/subtype_constraint.rb +0 -32
- data/lib/expressir/model/type.rb +0 -37
- data/lib/expressir/model/types/aggregate.rb +0 -28
- data/lib/expressir/model/types/array.rb +0 -23
- data/lib/expressir/model/types/bag.rb +0 -19
- data/lib/expressir/model/types/binary.rb +0 -17
- data/lib/expressir/model/types/boolean.rb +0 -8
- data/lib/expressir/model/types/enumeration.rb +0 -21
- data/lib/expressir/model/types/generic.rb +0 -24
- data/lib/expressir/model/types/generic_entity.rb +0 -24
- data/lib/expressir/model/types/integer.rb +0 -8
- data/lib/expressir/model/types/list.rb +0 -21
- data/lib/expressir/model/types/logical.rb +0 -8
- data/lib/expressir/model/types/number.rb +0 -8
- data/lib/expressir/model/types/real.rb +0 -15
- data/lib/expressir/model/types/select.rb +0 -23
- data/lib/expressir/model/types/set.rb +0 -19
- data/lib/expressir/model/types/string.rb +0 -17
- data/lib/expressir/model/unique.rb +0 -26
- data/lib/expressir/model/variable.rb +0 -28
- data/lib/expressir/model/where.rb +0 -26
- data/lib/expressir/parser/owl_parser.rb +0 -8
- data/lib/expressir/parser.rb +0 -6
- data/original/examples/syntax/multiple.yaml +0 -198
- data/original/examples/syntax/single.yaml +0 -15
- data/spec/acceptance/express_to_owl_spec.rb +0 -18
- data/spec/expressir/express/repository_spec.rb +0 -25
- data/spec/expressir/express_exp/formatter_spec.rb +0 -127
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'expressir/model'
|
2
2
|
|
3
3
|
module Expressir
|
4
|
-
module
|
4
|
+
module Express
|
5
5
|
class Formatter
|
6
6
|
INDENT_CHAR = ' '
|
7
7
|
INDENT_WIDTH = 2
|
8
8
|
INDENT = INDENT_CHAR * INDENT_WIDTH
|
9
|
-
|
10
9
|
OPERATOR_PRECEDENCE = {
|
11
10
|
Model::Expressions::BinaryExpression::EXPONENTIATION => 1,
|
12
11
|
Model::Expressions::BinaryExpression::MULTIPLICATION => 2,
|
@@ -29,71 +28,112 @@ module Expressir
|
|
29
28
|
Model::Expressions::BinaryExpression::INSTANCE_NOT_EQUAL => 4,
|
30
29
|
Model::Expressions::BinaryExpression::IN => 4,
|
31
30
|
Model::Expressions::BinaryExpression::LIKE => 4,
|
32
|
-
Model::Expressions::BinaryExpression::ANDOR => 4,
|
33
31
|
}
|
32
|
+
SUPERTYPE_OPERATOR_PRECEDENCE = {
|
33
|
+
Model::SupertypeExpressions::BinarySupertypeExpression::AND => 1,
|
34
|
+
Model::SupertypeExpressions::BinarySupertypeExpression::ANDOR => 2,
|
35
|
+
}
|
36
|
+
|
37
|
+
private_constant :INDENT_CHAR
|
38
|
+
private_constant :INDENT_WIDTH
|
39
|
+
private_constant :INDENT
|
40
|
+
private_constant :OPERATOR_PRECEDENCE
|
41
|
+
private_constant :SUPERTYPE_OPERATOR_PRECEDENCE
|
34
42
|
|
43
|
+
# Formats Express model into an Express code
|
44
|
+
# @param [Model::ModelElement] node
|
45
|
+
# @return [String]
|
35
46
|
def self.format(node)
|
36
47
|
formatter = self.new
|
37
48
|
formatter.format(node)
|
38
49
|
end
|
39
50
|
|
51
|
+
# Formats Express model into an Express code
|
52
|
+
# @param [Model::ModelElement] node
|
53
|
+
# @return [String]
|
40
54
|
def format(node)
|
41
|
-
if node.is_a? Model::
|
42
|
-
format_attribute(node)
|
43
|
-
elsif node.is_a? Model::Constant
|
44
|
-
format_constant(node)
|
45
|
-
elsif node.is_a? Model::Entity
|
46
|
-
format_entity(node)
|
47
|
-
elsif node.is_a? Model::EnumerationItem
|
48
|
-
format_enumeration_item(node)
|
49
|
-
elsif node.is_a? Model::Function
|
50
|
-
format_function(node)
|
51
|
-
elsif node.is_a? Model::Interface
|
52
|
-
format_interface(node)
|
53
|
-
elsif node.is_a? Model::InterfaceItem
|
54
|
-
format_interface_item(node)
|
55
|
-
elsif node.is_a? Model::Parameter
|
56
|
-
format_parameter(node)
|
57
|
-
elsif node.is_a? Model::Procedure
|
58
|
-
format_procedure(node)
|
59
|
-
elsif node.is_a? Model::Repository
|
55
|
+
if node.is_a? Model::Repository
|
60
56
|
format_repository(node)
|
61
|
-
elsif node.is_a? Model::
|
62
|
-
|
63
|
-
elsif node.is_a? Model::
|
64
|
-
|
65
|
-
elsif node.is_a? Model::
|
66
|
-
|
67
|
-
elsif node.is_a? Model::
|
68
|
-
|
69
|
-
elsif node.is_a? Model::
|
70
|
-
|
71
|
-
elsif node.is_a? Model::
|
72
|
-
|
73
|
-
elsif node.is_a? Model::
|
74
|
-
|
57
|
+
elsif node.is_a? Model::Declarations::Attribute
|
58
|
+
format_declarations_attribute(node)
|
59
|
+
elsif node.is_a? Model::Declarations::Constant
|
60
|
+
format_declarations_constant(node)
|
61
|
+
elsif node.is_a? Model::Declarations::Entity
|
62
|
+
format_declarations_entity(node)
|
63
|
+
elsif node.is_a? Model::Declarations::Function
|
64
|
+
format_declarations_function(node)
|
65
|
+
elsif node.is_a? Model::Declarations::Interface
|
66
|
+
format_declarations_interface(node)
|
67
|
+
elsif node.is_a? Model::Declarations::InterfaceItem
|
68
|
+
format_declarations_interface_item(node)
|
69
|
+
elsif node.is_a? Model::Declarations::Parameter
|
70
|
+
format_declarations_parameter(node)
|
71
|
+
elsif node.is_a? Model::Declarations::Procedure
|
72
|
+
format_declarations_procedure(node)
|
73
|
+
elsif node.is_a? Model::Declarations::Rule
|
74
|
+
format_declarations_rule(node)
|
75
|
+
elsif node.is_a? Model::Declarations::Schema
|
76
|
+
format_declarations_schema(node)
|
77
|
+
elsif node.is_a? Model::Declarations::SchemaVersion
|
78
|
+
format_declarations_schema_version(node)
|
79
|
+
elsif node.is_a? Model::Declarations::SubtypeConstraint
|
80
|
+
format_declarations_subtype_constraint(node)
|
81
|
+
elsif node.is_a? Model::Declarations::Type
|
82
|
+
format_declarations_type(node)
|
83
|
+
elsif node.is_a? Model::Declarations::UniqueRule
|
84
|
+
format_declarations_unique_rule(node)
|
85
|
+
elsif node.is_a? Model::Declarations::Variable
|
86
|
+
format_declarations_variable(node)
|
87
|
+
elsif node.is_a? Model::Declarations::WhereRule
|
88
|
+
format_declarations_where_rule(node)
|
89
|
+
elsif node.is_a? Model::DataTypes::Aggregate
|
90
|
+
format_data_types_aggregate(node)
|
91
|
+
elsif node.is_a? Model::DataTypes::Array
|
92
|
+
format_data_types_array(node)
|
93
|
+
elsif node.is_a? Model::DataTypes::Bag
|
94
|
+
format_data_types_bag(node)
|
95
|
+
elsif node.is_a? Model::DataTypes::Binary
|
96
|
+
format_data_types_binary(node)
|
97
|
+
elsif node.is_a? Model::DataTypes::Boolean
|
98
|
+
format_data_types_boolean(node)
|
99
|
+
elsif node.is_a? Model::DataTypes::Enumeration
|
100
|
+
format_data_types_enumeration(node)
|
101
|
+
elsif node.is_a? Model::DataTypes::EnumerationItem
|
102
|
+
format_data_types_enumeration_item(node)
|
103
|
+
elsif node.is_a? Model::DataTypes::GenericEntity
|
104
|
+
format_data_types_generic_entity(node)
|
105
|
+
elsif node.is_a? Model::DataTypes::Generic
|
106
|
+
format_data_types_generic(node)
|
107
|
+
elsif node.is_a? Model::DataTypes::Integer
|
108
|
+
format_data_types_integer(node)
|
109
|
+
elsif node.is_a? Model::DataTypes::List
|
110
|
+
format_data_types_list(node)
|
111
|
+
elsif node.is_a? Model::DataTypes::Logical
|
112
|
+
format_data_types_logical(node)
|
113
|
+
elsif node.is_a? Model::DataTypes::Number
|
114
|
+
format_data_types_number(node)
|
115
|
+
elsif node.is_a? Model::DataTypes::Real
|
116
|
+
format_data_types_real(node)
|
117
|
+
elsif node.is_a? Model::DataTypes::Select
|
118
|
+
format_data_types_select(node)
|
119
|
+
elsif node.is_a? Model::DataTypes::Set
|
120
|
+
format_data_types_set(node)
|
121
|
+
elsif node.is_a? Model::DataTypes::String
|
122
|
+
format_data_types_string(node)
|
75
123
|
elsif node.is_a? Model::Expressions::AggregateInitializer
|
76
124
|
format_expressions_aggregate_initializer(node)
|
77
|
-
elsif node.is_a? Model::Expressions::
|
78
|
-
|
79
|
-
elsif node.is_a? Model::Expressions::AttributeReference
|
80
|
-
format_expressions_attribute_reference(node)
|
125
|
+
elsif node.is_a? Model::Expressions::AggregateInitializerItem
|
126
|
+
format_expressions_aggregate_initializer_item(node)
|
81
127
|
elsif node.is_a? Model::Expressions::BinaryExpression
|
82
128
|
format_expressions_binary_expression(node)
|
83
|
-
elsif node.is_a? Model::Expressions::Call
|
84
|
-
format_expressions_call(node)
|
85
129
|
elsif node.is_a? Model::Expressions::EntityConstructor
|
86
130
|
format_expressions_entity_constructor(node)
|
87
|
-
elsif node.is_a? Model::Expressions::
|
88
|
-
|
89
|
-
elsif node.is_a? Model::Expressions::IndexReference
|
90
|
-
format_expressions_index_reference(node)
|
131
|
+
elsif node.is_a? Model::Expressions::FunctionCall
|
132
|
+
format_expressions_function_call(node)
|
91
133
|
elsif node.is_a? Model::Expressions::Interval
|
92
134
|
format_expressions_interval(node)
|
93
135
|
elsif node.is_a? Model::Expressions::QueryExpression
|
94
136
|
format_expressions_query_expression(node)
|
95
|
-
elsif node.is_a? Model::Expressions::SimpleReference
|
96
|
-
format_expressions_simple_reference(node)
|
97
137
|
elsif node.is_a? Model::Expressions::UnaryExpression
|
98
138
|
format_expressions_unary_expression(node)
|
99
139
|
elsif node.is_a? Model::Literals::Binary
|
@@ -106,12 +146,18 @@ module Expressir
|
|
106
146
|
format_literals_real(node)
|
107
147
|
elsif node.is_a? Model::Literals::String
|
108
148
|
format_literals_string(node)
|
149
|
+
elsif node.is_a? Model::References::AttributeReference
|
150
|
+
format_references_attribute_reference(node)
|
151
|
+
elsif node.is_a? Model::References::GroupReference
|
152
|
+
format_references_group_reference(node)
|
153
|
+
elsif node.is_a? Model::References::IndexReference
|
154
|
+
format_references_index_reference(node)
|
155
|
+
elsif node.is_a? Model::References::SimpleReference
|
156
|
+
format_references_simple_reference(node)
|
109
157
|
elsif node.is_a? Model::Statements::Alias
|
110
158
|
format_statements_alias(node)
|
111
159
|
elsif node.is_a? Model::Statements::Assignment
|
112
160
|
format_statements_assignment(node)
|
113
|
-
elsif node.is_a? Model::Statements::Call
|
114
|
-
format_statements_call(node)
|
115
161
|
elsif node.is_a? Model::Statements::Case
|
116
162
|
format_statements_case(node)
|
117
163
|
elsif node.is_a? Model::Statements::CaseAction
|
@@ -124,44 +170,18 @@ module Expressir
|
|
124
170
|
format_statements_if(node)
|
125
171
|
elsif node.is_a? Model::Statements::Null
|
126
172
|
format_statements_null(node)
|
173
|
+
elsif node.is_a? Model::Statements::ProcedureCall
|
174
|
+
format_statements_procedure_call(node)
|
127
175
|
elsif node.is_a? Model::Statements::Repeat
|
128
176
|
format_statements_repeat(node)
|
129
177
|
elsif node.is_a? Model::Statements::Return
|
130
178
|
format_statements_return(node)
|
131
179
|
elsif node.is_a? Model::Statements::Skip
|
132
180
|
format_statements_skip(node)
|
133
|
-
elsif node.is_a? Model::
|
134
|
-
|
135
|
-
elsif node.is_a? Model::
|
136
|
-
|
137
|
-
elsif node.is_a? Model::Types::Bag
|
138
|
-
format_types_bag(node)
|
139
|
-
elsif node.is_a? Model::Types::Binary
|
140
|
-
format_types_binary(node)
|
141
|
-
elsif node.is_a? Model::Types::Boolean
|
142
|
-
format_types_boolean(node)
|
143
|
-
elsif node.is_a? Model::Types::Enumeration
|
144
|
-
format_types_enumeration(node)
|
145
|
-
elsif node.is_a? Model::Types::GenericEntity
|
146
|
-
format_types_generic_entity(node)
|
147
|
-
elsif node.is_a? Model::Types::Generic
|
148
|
-
format_types_generic(node)
|
149
|
-
elsif node.is_a? Model::Types::Integer
|
150
|
-
format_types_integer(node)
|
151
|
-
elsif node.is_a? Model::Types::List
|
152
|
-
format_types_list(node)
|
153
|
-
elsif node.is_a? Model::Types::Logical
|
154
|
-
format_types_logical(node)
|
155
|
-
elsif node.is_a? Model::Types::Number
|
156
|
-
format_types_number(node)
|
157
|
-
elsif node.is_a? Model::Types::Real
|
158
|
-
format_types_real(node)
|
159
|
-
elsif node.is_a? Model::Types::Select
|
160
|
-
format_types_select(node)
|
161
|
-
elsif node.is_a? Model::Types::Set
|
162
|
-
format_types_set(node)
|
163
|
-
elsif node.is_a? Model::Types::String
|
164
|
-
format_types_string(node)
|
181
|
+
elsif node.is_a? Model::SupertypeExpressions::BinarySupertypeExpression
|
182
|
+
format_supertype_expressions_binary_supertype_expression(node)
|
183
|
+
elsif node.is_a? Model::SupertypeExpressions::OneofSupertypeExpression
|
184
|
+
format_supertype_expressions_oneof_supertype_expression(node)
|
165
185
|
else
|
166
186
|
STDERR.puts "#{node.class.name} format not implemented"
|
167
187
|
''
|
@@ -170,7 +190,11 @@ module Expressir
|
|
170
190
|
|
171
191
|
private
|
172
192
|
|
173
|
-
def
|
193
|
+
def format_repository(node)
|
194
|
+
node.schemas.map{|x| format(x)}.join("\n\n")
|
195
|
+
end
|
196
|
+
|
197
|
+
def format_declarations_attribute(node)
|
174
198
|
[
|
175
199
|
*if node.supertype_attribute
|
176
200
|
[
|
@@ -199,14 +223,14 @@ module Expressir
|
|
199
223
|
end,
|
200
224
|
' ',
|
201
225
|
format(node.type),
|
202
|
-
*if node.kind == Model::Attribute::DERIVED
|
226
|
+
*if node.kind == Model::Declarations::Attribute::DERIVED
|
203
227
|
[
|
204
228
|
' ',
|
205
229
|
':=',
|
206
230
|
' ',
|
207
231
|
format(node.expression)
|
208
232
|
].join('')
|
209
|
-
elsif node.kind == Model::Attribute::INVERSE
|
233
|
+
elsif node.kind == Model::Declarations::Attribute::INVERSE
|
210
234
|
[
|
211
235
|
' ',
|
212
236
|
'FOR',
|
@@ -218,7 +242,7 @@ module Expressir
|
|
218
242
|
].join('')
|
219
243
|
end
|
220
244
|
|
221
|
-
def
|
245
|
+
def format_declarations_constant(node)
|
222
246
|
[
|
223
247
|
node.id,
|
224
248
|
' ',
|
@@ -233,10 +257,10 @@ module Expressir
|
|
233
257
|
].join('')
|
234
258
|
end
|
235
259
|
|
236
|
-
def
|
237
|
-
explicit_attributes = node.attributes.select{|x| x.kind == Model::Attribute::EXPLICIT}
|
238
|
-
derived_attributes = node.attributes.select{|x| x.kind == Model::Attribute::DERIVED}
|
239
|
-
inverse_attributes = node.attributes.select{|x| x.kind == Model::Attribute::INVERSE}
|
260
|
+
def format_declarations_entity(node)
|
261
|
+
explicit_attributes = node.attributes.select{|x| x.kind == Model::Declarations::Attribute::EXPLICIT}
|
262
|
+
derived_attributes = node.attributes.select{|x| x.kind == Model::Declarations::Attribute::DERIVED}
|
263
|
+
inverse_attributes = node.attributes.select{|x| x.kind == Model::Declarations::Attribute::INVERSE}
|
240
264
|
|
241
265
|
[
|
242
266
|
[
|
@@ -314,16 +338,16 @@ module Expressir
|
|
314
338
|
indent(inverse_attributes.map{|x| format(x)}.join("\n")),
|
315
339
|
]
|
316
340
|
end,
|
317
|
-
*if node.
|
341
|
+
*if node.unique_rules.length > 0
|
318
342
|
[
|
319
343
|
'UNIQUE',
|
320
|
-
indent(node.
|
344
|
+
indent(node.unique_rules.map{|x| format(x)}.join("\n"))
|
321
345
|
]
|
322
346
|
end,
|
323
|
-
*if node.
|
347
|
+
*if node.where_rules.length > 0
|
324
348
|
[
|
325
349
|
'WHERE',
|
326
|
-
indent(node.
|
350
|
+
indent(node.where_rules.map{|x| format(x)}.join("\n")),
|
327
351
|
]
|
328
352
|
end,
|
329
353
|
[
|
@@ -333,11 +357,7 @@ module Expressir
|
|
333
357
|
].join("\n")
|
334
358
|
end
|
335
359
|
|
336
|
-
def
|
337
|
-
node.id
|
338
|
-
end
|
339
|
-
|
340
|
-
def format_function(node)
|
360
|
+
def format_declarations_function(node)
|
341
361
|
[
|
342
362
|
[
|
343
363
|
'FUNCTION',
|
@@ -402,11 +422,11 @@ module Expressir
|
|
402
422
|
].join("\n")
|
403
423
|
end
|
404
424
|
|
405
|
-
def
|
425
|
+
def format_declarations_interface(node)
|
406
426
|
[
|
407
427
|
case node.kind
|
408
|
-
when Model::Interface::USE then 'USE'
|
409
|
-
when Model::Interface::REFERENCE then 'REFERENCE'
|
428
|
+
when Model::Declarations::Interface::USE then 'USE'
|
429
|
+
when Model::Declarations::Interface::REFERENCE then 'REFERENCE'
|
410
430
|
end,
|
411
431
|
' ',
|
412
432
|
'FROM',
|
@@ -427,7 +447,7 @@ module Expressir
|
|
427
447
|
].join('')
|
428
448
|
end
|
429
449
|
|
430
|
-
def
|
450
|
+
def format_declarations_interface_item(node)
|
431
451
|
[
|
432
452
|
format(node.ref),
|
433
453
|
*if node.id
|
@@ -441,7 +461,7 @@ module Expressir
|
|
441
461
|
].join('')
|
442
462
|
end
|
443
463
|
|
444
|
-
def
|
464
|
+
def format_declarations_parameter(node)
|
445
465
|
[
|
446
466
|
*if node.var
|
447
467
|
[
|
@@ -457,7 +477,7 @@ module Expressir
|
|
457
477
|
].join('')
|
458
478
|
end
|
459
479
|
|
460
|
-
def
|
480
|
+
def format_declarations_procedure(node)
|
461
481
|
[
|
462
482
|
[
|
463
483
|
'PROCEDURE',
|
@@ -518,11 +538,7 @@ module Expressir
|
|
518
538
|
].join("\n")
|
519
539
|
end
|
520
540
|
|
521
|
-
def
|
522
|
-
node.schemas.map{|node| format(node)}.join("\n\n")
|
523
|
-
end
|
524
|
-
|
525
|
-
def format_rule(node)
|
541
|
+
def format_declarations_rule(node)
|
526
542
|
[
|
527
543
|
[
|
528
544
|
'RULE',
|
@@ -574,10 +590,10 @@ module Expressir
|
|
574
590
|
*if node.statements.length > 0
|
575
591
|
indent(node.statements.map{|x| format(x)}.join("\n"))
|
576
592
|
end,
|
577
|
-
*if node.
|
593
|
+
*if node.where_rules.length > 0
|
578
594
|
[
|
579
595
|
'WHERE',
|
580
|
-
indent(node.
|
596
|
+
indent(node.where_rules.map{|x| format(x)}.join("\n"))
|
581
597
|
]
|
582
598
|
end,
|
583
599
|
[
|
@@ -587,7 +603,7 @@ module Expressir
|
|
587
603
|
].join("\n")
|
588
604
|
end
|
589
605
|
|
590
|
-
def
|
606
|
+
def format_declarations_schema_head(node)
|
591
607
|
[
|
592
608
|
[
|
593
609
|
'SCHEMA',
|
@@ -610,7 +626,7 @@ module Expressir
|
|
610
626
|
].join("\n")
|
611
627
|
end
|
612
628
|
|
613
|
-
def
|
629
|
+
def format_declarations_schema(node)
|
614
630
|
schema_declarations = [
|
615
631
|
*if node.constants.length > 0
|
616
632
|
[
|
@@ -643,7 +659,7 @@ module Expressir
|
|
643
659
|
]
|
644
660
|
|
645
661
|
[
|
646
|
-
|
662
|
+
format_declarations_schema_head(node),
|
647
663
|
*if schema_declarations.length > 0
|
648
664
|
[
|
649
665
|
'',
|
@@ -659,7 +675,15 @@ module Expressir
|
|
659
675
|
].join("\n")
|
660
676
|
end
|
661
677
|
|
662
|
-
def
|
678
|
+
def format_declarations_schema_version(node)
|
679
|
+
[
|
680
|
+
"'",
|
681
|
+
node.value,
|
682
|
+
"'"
|
683
|
+
].join('')
|
684
|
+
end
|
685
|
+
|
686
|
+
def format_declarations_subtype_constraint(node)
|
663
687
|
[
|
664
688
|
[
|
665
689
|
'SUBTYPE_CONSTRAINT',
|
@@ -701,7 +725,7 @@ module Expressir
|
|
701
725
|
].join("\n")
|
702
726
|
end
|
703
727
|
|
704
|
-
def
|
728
|
+
def format_declarations_type(node)
|
705
729
|
[
|
706
730
|
[
|
707
731
|
'TYPE',
|
@@ -710,13 +734,13 @@ module Expressir
|
|
710
734
|
' ',
|
711
735
|
'=',
|
712
736
|
' ',
|
713
|
-
format(node.
|
737
|
+
format(node.underlying_type),
|
714
738
|
';',
|
715
739
|
].join(''),
|
716
|
-
*if node.
|
740
|
+
*if node.where_rules.length > 0
|
717
741
|
[
|
718
742
|
'WHERE',
|
719
|
-
indent(node.
|
743
|
+
indent(node.where_rules.map{|x| format(x)}.join("\n"))
|
720
744
|
]
|
721
745
|
end,
|
722
746
|
[
|
@@ -726,7 +750,7 @@ module Expressir
|
|
726
750
|
].join("\n")
|
727
751
|
end
|
728
752
|
|
729
|
-
def
|
753
|
+
def format_declarations_unique_rule(node)
|
730
754
|
[
|
731
755
|
*if node.id
|
732
756
|
[
|
@@ -740,7 +764,7 @@ module Expressir
|
|
740
764
|
].join('')
|
741
765
|
end
|
742
766
|
|
743
|
-
def
|
767
|
+
def format_declarations_variable(node)
|
744
768
|
[
|
745
769
|
node.id,
|
746
770
|
' ',
|
@@ -759,7 +783,7 @@ module Expressir
|
|
759
783
|
].join('')
|
760
784
|
end
|
761
785
|
|
762
|
-
def
|
786
|
+
def format_declarations_where_rule(node)
|
763
787
|
[
|
764
788
|
*if node.id
|
765
789
|
[
|
@@ -781,7 +805,7 @@ module Expressir
|
|
781
805
|
].join('')
|
782
806
|
end
|
783
807
|
|
784
|
-
def
|
808
|
+
def format_expressions_aggregate_initializer_item(node)
|
785
809
|
[
|
786
810
|
format(node.expression),
|
787
811
|
':',
|
@@ -789,14 +813,6 @@ module Expressir
|
|
789
813
|
].join('')
|
790
814
|
end
|
791
815
|
|
792
|
-
def format_expressions_attribute_reference(node)
|
793
|
-
[
|
794
|
-
format(node.ref),
|
795
|
-
'.',
|
796
|
-
format(node.attribute)
|
797
|
-
].join('')
|
798
|
-
end
|
799
|
-
|
800
816
|
def format_expressions_binary_expression(node)
|
801
817
|
[
|
802
818
|
*if node.operand1.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand1.operator] > OPERATOR_PRECEDENCE[node.operator]
|
@@ -810,7 +826,6 @@ module Expressir
|
|
810
826
|
case node.operator
|
811
827
|
when Model::Expressions::BinaryExpression::ADDITION then '+'
|
812
828
|
when Model::Expressions::BinaryExpression::AND then 'AND'
|
813
|
-
when Model::Expressions::BinaryExpression::ANDOR then 'ANDOR'
|
814
829
|
when Model::Expressions::BinaryExpression::COMBINE then '||'
|
815
830
|
when Model::Expressions::BinaryExpression::EQUAL then '='
|
816
831
|
when Model::Expressions::BinaryExpression::EXPONENTIATION then '**'
|
@@ -842,62 +857,39 @@ module Expressir
|
|
842
857
|
].join('')
|
843
858
|
end
|
844
859
|
|
845
|
-
def
|
860
|
+
def format_expressions_entity_constructor(node)
|
846
861
|
[
|
847
|
-
format(node.
|
862
|
+
format(node.entity),
|
848
863
|
'(',
|
849
864
|
node.parameters.map{|x| format(x)}.join(', '),
|
850
865
|
')'
|
851
866
|
].join('')
|
852
867
|
end
|
853
868
|
|
854
|
-
def
|
869
|
+
def format_expressions_function_call(node)
|
855
870
|
[
|
856
|
-
format(node.
|
871
|
+
format(node.function),
|
857
872
|
'(',
|
858
873
|
node.parameters.map{|x| format(x)}.join(', '),
|
859
874
|
')'
|
860
875
|
].join('')
|
861
876
|
end
|
862
877
|
|
863
|
-
def format_expressions_group_reference(node)
|
864
|
-
[
|
865
|
-
format(node.ref),
|
866
|
-
'\\',
|
867
|
-
format(node.entity)
|
868
|
-
].join('')
|
869
|
-
end
|
870
|
-
|
871
|
-
def format_expressions_index_reference(node)
|
872
|
-
[
|
873
|
-
format(node.ref),
|
874
|
-
'[',
|
875
|
-
format(node.index1),
|
876
|
-
*if node.index2
|
877
|
-
[
|
878
|
-
':',
|
879
|
-
format(node.index2)
|
880
|
-
].join('')
|
881
|
-
end,
|
882
|
-
']'
|
883
|
-
].join('')
|
884
|
-
end
|
885
|
-
|
886
878
|
def format_expressions_interval(node)
|
887
879
|
[
|
888
880
|
'{',
|
889
881
|
format(node.low),
|
890
882
|
' ',
|
891
883
|
case node.operator1
|
892
|
-
when Model::Expressions::
|
893
|
-
when Model::Expressions::
|
884
|
+
when Model::Expressions::Interval::LESS_THAN then '<'
|
885
|
+
when Model::Expressions::Interval::LESS_THAN_OR_EQUAL then '<='
|
894
886
|
end,
|
895
887
|
' ',
|
896
888
|
format(node.item),
|
897
889
|
' ',
|
898
890
|
case node.operator2
|
899
|
-
when Model::Expressions::
|
900
|
-
when Model::Expressions::
|
891
|
+
when Model::Expressions::Interval::LESS_THAN then '<'
|
892
|
+
when Model::Expressions::Interval::LESS_THAN_OR_EQUAL then '<='
|
901
893
|
end,
|
902
894
|
' ',
|
903
895
|
format(node.high),
|
@@ -923,10 +915,6 @@ module Expressir
|
|
923
915
|
].join('')
|
924
916
|
end
|
925
917
|
|
926
|
-
def format_expressions_simple_reference(node)
|
927
|
-
node.id
|
928
|
-
end
|
929
|
-
|
930
918
|
def format_expressions_unary_expression(node)
|
931
919
|
[
|
932
920
|
case node.operator
|
@@ -986,6 +974,41 @@ module Expressir
|
|
986
974
|
end
|
987
975
|
end
|
988
976
|
|
977
|
+
def format_references_attribute_reference(node)
|
978
|
+
[
|
979
|
+
format(node.ref),
|
980
|
+
'.',
|
981
|
+
format(node.attribute)
|
982
|
+
].join('')
|
983
|
+
end
|
984
|
+
|
985
|
+
def format_references_group_reference(node)
|
986
|
+
[
|
987
|
+
format(node.ref),
|
988
|
+
'\\',
|
989
|
+
format(node.entity)
|
990
|
+
].join('')
|
991
|
+
end
|
992
|
+
|
993
|
+
def format_references_index_reference(node)
|
994
|
+
[
|
995
|
+
format(node.ref),
|
996
|
+
'[',
|
997
|
+
format(node.index1),
|
998
|
+
*if node.index2
|
999
|
+
[
|
1000
|
+
':',
|
1001
|
+
format(node.index2)
|
1002
|
+
].join('')
|
1003
|
+
end,
|
1004
|
+
']'
|
1005
|
+
].join('')
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
def format_references_simple_reference(node)
|
1009
|
+
node.id
|
1010
|
+
end
|
1011
|
+
|
989
1012
|
def format_statements_alias(node)
|
990
1013
|
[
|
991
1014
|
[
|
@@ -1020,9 +1043,9 @@ module Expressir
|
|
1020
1043
|
].join('')
|
1021
1044
|
end
|
1022
1045
|
|
1023
|
-
def
|
1046
|
+
def format_statements_procedure_call(node)
|
1024
1047
|
[
|
1025
|
-
format(node.
|
1048
|
+
format(node.procedure),
|
1026
1049
|
*if node.parameters.length > 0
|
1027
1050
|
[
|
1028
1051
|
'(',
|
@@ -1200,11 +1223,45 @@ module Expressir
|
|
1200
1223
|
].join('')
|
1201
1224
|
end
|
1202
1225
|
|
1203
|
-
def
|
1226
|
+
def format_supertype_expressions_binary_supertype_expression(node)
|
1227
|
+
[
|
1228
|
+
*if node.operand1.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand1.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
1229
|
+
'('
|
1230
|
+
end,
|
1231
|
+
format(node.operand1),
|
1232
|
+
*if node.operand1.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand1.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
1233
|
+
')'
|
1234
|
+
end,
|
1235
|
+
' ',
|
1236
|
+
case node.operator
|
1237
|
+
when Model::SupertypeExpressions::BinarySupertypeExpression::AND then 'AND'
|
1238
|
+
when Model::SupertypeExpressions::BinarySupertypeExpression::ANDOR then 'ANDOR'
|
1239
|
+
end,
|
1240
|
+
' ',
|
1241
|
+
*if node.operand2.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand2.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
1242
|
+
'('
|
1243
|
+
end,
|
1244
|
+
format(node.operand2),
|
1245
|
+
*if node.operand2.is_a? Model::SupertypeExpressions::BinarySupertypeExpression and SUPERTYPE_OPERATOR_PRECEDENCE[node.operand2.operator] > SUPERTYPE_OPERATOR_PRECEDENCE[node.operator]
|
1246
|
+
')'
|
1247
|
+
end,
|
1248
|
+
].join('')
|
1249
|
+
end
|
1250
|
+
|
1251
|
+
def format_supertype_expressions_oneof_supertype_expression(node)
|
1252
|
+
[
|
1253
|
+
'ONEOF',
|
1254
|
+
'(',
|
1255
|
+
node.operands.map{|x| format(x)}.join(', '),
|
1256
|
+
')'
|
1257
|
+
].join('')
|
1258
|
+
end
|
1259
|
+
|
1260
|
+
def format_data_types_aggregate(node)
|
1204
1261
|
'AGGREGATE'
|
1205
1262
|
end
|
1206
1263
|
|
1207
|
-
def
|
1264
|
+
def format_data_types_array(node)
|
1208
1265
|
[
|
1209
1266
|
'ARRAY',
|
1210
1267
|
*if node.bound1 and node.bound2
|
@@ -1236,7 +1293,7 @@ module Expressir
|
|
1236
1293
|
].join('')
|
1237
1294
|
end
|
1238
1295
|
|
1239
|
-
def
|
1296
|
+
def format_data_types_bag(node)
|
1240
1297
|
[
|
1241
1298
|
'BAG',
|
1242
1299
|
*if node.bound1 and node.bound2
|
@@ -1256,7 +1313,7 @@ module Expressir
|
|
1256
1313
|
].join('')
|
1257
1314
|
end
|
1258
1315
|
|
1259
|
-
def
|
1316
|
+
def format_data_types_binary(node)
|
1260
1317
|
[
|
1261
1318
|
'BINARY',
|
1262
1319
|
*if node.width
|
@@ -1276,11 +1333,11 @@ module Expressir
|
|
1276
1333
|
].join('')
|
1277
1334
|
end
|
1278
1335
|
|
1279
|
-
def
|
1336
|
+
def format_data_types_boolean(node)
|
1280
1337
|
'BOOLEAN'
|
1281
1338
|
end
|
1282
1339
|
|
1283
|
-
def
|
1340
|
+
def format_data_types_enumeration(node)
|
1284
1341
|
[
|
1285
1342
|
*if node.extensible
|
1286
1343
|
[
|
@@ -1289,44 +1346,51 @@ module Expressir
|
|
1289
1346
|
].join('')
|
1290
1347
|
end,
|
1291
1348
|
'ENUMERATION',
|
1292
|
-
*if node.
|
1293
|
-
item_indent = INDENT_CHAR * '('.length
|
1294
|
-
[
|
1295
|
-
' ',
|
1296
|
-
'OF',
|
1297
|
-
"\n",
|
1298
|
-
indent([
|
1299
|
-
'(',
|
1300
|
-
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
1301
|
-
')'
|
1302
|
-
].join(''))
|
1303
|
-
].join('')
|
1304
|
-
end,
|
1305
|
-
*if node.extension_type
|
1349
|
+
*if node.based_on
|
1306
1350
|
[
|
1307
1351
|
' ',
|
1308
1352
|
'BASED_ON',
|
1309
1353
|
' ',
|
1310
|
-
format(node.
|
1354
|
+
format(node.based_on),
|
1355
|
+
*if node.items.length > 0
|
1356
|
+
item_indent = INDENT_CHAR * '('.length
|
1357
|
+
[
|
1358
|
+
' ',
|
1359
|
+
'WITH',
|
1360
|
+
"\n",
|
1361
|
+
indent([
|
1362
|
+
'(',
|
1363
|
+
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
1364
|
+
')'
|
1365
|
+
].join(''))
|
1366
|
+
].join('')
|
1367
|
+
end
|
1311
1368
|
].join('')
|
1312
|
-
|
1313
|
-
*if node.extension_items.length > 0
|
1314
|
-
item_indent = INDENT_CHAR * '('.length
|
1369
|
+
else
|
1315
1370
|
[
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1371
|
+
*if node.items.length > 0
|
1372
|
+
item_indent = INDENT_CHAR * '('.length
|
1373
|
+
[
|
1374
|
+
' ',
|
1375
|
+
'OF',
|
1376
|
+
"\n",
|
1377
|
+
indent([
|
1378
|
+
'(',
|
1379
|
+
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
1380
|
+
')'
|
1381
|
+
].join(''))
|
1382
|
+
].join('')
|
1383
|
+
end
|
1324
1384
|
].join('')
|
1325
1385
|
end
|
1326
1386
|
].join('')
|
1327
1387
|
end
|
1328
1388
|
|
1329
|
-
def
|
1389
|
+
def format_data_types_enumeration_item(node)
|
1390
|
+
node.id
|
1391
|
+
end
|
1392
|
+
|
1393
|
+
def format_data_types_generic_entity(node)
|
1330
1394
|
[
|
1331
1395
|
'GENERIC_ENTITY',
|
1332
1396
|
*if node.id
|
@@ -1338,7 +1402,7 @@ module Expressir
|
|
1338
1402
|
].join('')
|
1339
1403
|
end
|
1340
1404
|
|
1341
|
-
def
|
1405
|
+
def format_data_types_generic(node)
|
1342
1406
|
[
|
1343
1407
|
'GENERIC',
|
1344
1408
|
*if node.id
|
@@ -1350,11 +1414,11 @@ module Expressir
|
|
1350
1414
|
].join('')
|
1351
1415
|
end
|
1352
1416
|
|
1353
|
-
def
|
1417
|
+
def format_data_types_integer(node)
|
1354
1418
|
'INTEGER'
|
1355
1419
|
end
|
1356
1420
|
|
1357
|
-
def
|
1421
|
+
def format_data_types_list(node)
|
1358
1422
|
[
|
1359
1423
|
'LIST',
|
1360
1424
|
*if node.bound1 and node.bound2
|
@@ -1380,15 +1444,15 @@ module Expressir
|
|
1380
1444
|
].join('')
|
1381
1445
|
end
|
1382
1446
|
|
1383
|
-
def
|
1447
|
+
def format_data_types_logical(node)
|
1384
1448
|
'LOGICAL'
|
1385
1449
|
end
|
1386
1450
|
|
1387
|
-
def
|
1451
|
+
def format_data_types_number(node)
|
1388
1452
|
'NUMBER'
|
1389
1453
|
end
|
1390
1454
|
|
1391
|
-
def
|
1455
|
+
def format_data_types_real(node)
|
1392
1456
|
[
|
1393
1457
|
'REAL',
|
1394
1458
|
*if node.precision
|
@@ -1402,7 +1466,7 @@ module Expressir
|
|
1402
1466
|
].join('')
|
1403
1467
|
end
|
1404
1468
|
|
1405
|
-
def
|
1469
|
+
def format_data_types_select(node)
|
1406
1470
|
[
|
1407
1471
|
*if node.extensible
|
1408
1472
|
[
|
@@ -1417,42 +1481,45 @@ module Expressir
|
|
1417
1481
|
].join('')
|
1418
1482
|
end,
|
1419
1483
|
'SELECT',
|
1420
|
-
*if node.
|
1421
|
-
item_indent = INDENT_CHAR * '('.length
|
1422
|
-
[
|
1423
|
-
"\n",
|
1424
|
-
indent([
|
1425
|
-
'(',
|
1426
|
-
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
1427
|
-
')'
|
1428
|
-
].join(''))
|
1429
|
-
].join('')
|
1430
|
-
end,
|
1431
|
-
*if node.extension_type
|
1484
|
+
*if node.based_on
|
1432
1485
|
[
|
1433
1486
|
' ',
|
1434
1487
|
'BASED_ON',
|
1435
1488
|
' ',
|
1436
|
-
format(node.
|
1489
|
+
format(node.based_on),
|
1490
|
+
*if node.items.length > 0
|
1491
|
+
item_indent = INDENT_CHAR * '('.length
|
1492
|
+
[
|
1493
|
+
' ',
|
1494
|
+
'WITH',
|
1495
|
+
"\n",
|
1496
|
+
indent([
|
1497
|
+
'(',
|
1498
|
+
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
1499
|
+
')'
|
1500
|
+
].join(''))
|
1501
|
+
].join('')
|
1502
|
+
end
|
1437
1503
|
].join('')
|
1438
|
-
|
1439
|
-
*if node.extension_items.length > 0
|
1440
|
-
item_indent = INDENT_CHAR * '('.length
|
1504
|
+
else
|
1441
1505
|
[
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1506
|
+
*if node.items.length > 0
|
1507
|
+
item_indent = INDENT_CHAR * '('.length
|
1508
|
+
[
|
1509
|
+
"\n",
|
1510
|
+
indent([
|
1511
|
+
'(',
|
1512
|
+
node.items.map{|x| format(x)}.join(",\n#{item_indent}"),
|
1513
|
+
')'
|
1514
|
+
].join(''))
|
1515
|
+
].join('')
|
1516
|
+
end
|
1450
1517
|
].join('')
|
1451
1518
|
end
|
1452
1519
|
].join('')
|
1453
1520
|
end
|
1454
1521
|
|
1455
|
-
def
|
1522
|
+
def format_data_types_set(node)
|
1456
1523
|
[
|
1457
1524
|
'SET',
|
1458
1525
|
*if node.bound1 and node.bound2
|
@@ -1472,7 +1539,7 @@ module Expressir
|
|
1472
1539
|
].join('')
|
1473
1540
|
end
|
1474
1541
|
|
1475
|
-
def
|
1542
|
+
def format_data_types_string(node)
|
1476
1543
|
[
|
1477
1544
|
'STRING',
|
1478
1545
|
*if node.width
|
@@ -1533,7 +1600,7 @@ module Expressir
|
|
1533
1600
|
def format_scope_remarks(node)
|
1534
1601
|
[
|
1535
1602
|
*format_remarks(node),
|
1536
|
-
*node.children.select{|x| !x.is_a? Model::EnumerationItem or node.is_a? Model::Type}.flat_map{|x| format_scope_remarks(x)}
|
1603
|
+
*node.children.select{|x| !x.is_a? Model::DataTypes::EnumerationItem or node.is_a? Model::Declarations::Type}.flat_map{|x| format_scope_remarks(x)}
|
1537
1604
|
]
|
1538
1605
|
end
|
1539
1606
|
end
|