expressir 0.2.7-x86-linux → 0.2.12-x86-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +3 -4
- data/.gitignore +1 -1
- data/exe/format +16 -0
- data/expressir.gemspec +3 -2
- data/lib/expressir/express_exp/2.4/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.5/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.6/express_parser.so +0 -0
- data/lib/expressir/express_exp/2.7/express_parser.so +0 -0
- data/lib/expressir/express_exp/3.0/express_parser.so +0 -0
- data/lib/expressir/express_exp/formatter.rb +147 -110
- data/lib/expressir/express_exp/hyperlink_formatter.rb +25 -0
- data/lib/expressir/express_exp/parser.rb +14 -1
- data/lib/expressir/express_exp/schema_head_formatter.rb +14 -0
- data/lib/expressir/express_exp/visitor.rb +206 -118
- data/lib/expressir/model.rb +3 -1
- data/lib/expressir/model/attribute.rb +5 -1
- data/lib/expressir/model/constant.rb +5 -1
- data/lib/expressir/model/entity.rb +14 -20
- data/lib/expressir/model/enumeration_item.rb +5 -1
- data/lib/expressir/model/expressions/aggregate_initializer.rb +4 -2
- data/lib/expressir/model/expressions/aggregate_item.rb +3 -1
- data/lib/expressir/model/expressions/attribute_reference.rb +3 -1
- data/lib/expressir/model/expressions/binary_expression.rb +3 -1
- data/lib/expressir/model/expressions/call.rb +4 -2
- data/lib/expressir/model/expressions/entity_constructor.rb +4 -2
- data/lib/expressir/model/expressions/group_reference.rb +3 -1
- data/lib/expressir/model/expressions/index_reference.rb +3 -1
- data/lib/expressir/model/expressions/interval.rb +3 -1
- data/lib/expressir/model/expressions/query_expression.rb +5 -2
- data/lib/expressir/model/expressions/simple_reference.rb +3 -1
- data/lib/expressir/model/expressions/unary_expression.rb +3 -1
- data/lib/expressir/model/function.rb +28 -39
- data/lib/expressir/model/identifier.rb +0 -1
- data/lib/expressir/model/informal_proposition.rb +15 -0
- data/lib/expressir/model/interface.rb +4 -2
- data/lib/expressir/model/literals/binary.rb +3 -1
- data/lib/expressir/model/literals/integer.rb +3 -1
- data/lib/expressir/model/literals/logical.rb +3 -1
- data/lib/expressir/model/literals/real.rb +3 -1
- data/lib/expressir/model/literals/string.rb +3 -1
- data/lib/expressir/model/model_element.rb +140 -0
- data/lib/expressir/model/parameter.rb +5 -1
- data/lib/expressir/model/procedure.rb +29 -40
- data/lib/expressir/model/renamed_ref.rb +3 -1
- data/lib/expressir/model/repository.rb +5 -5
- data/lib/expressir/model/rule.rb +33 -41
- data/lib/expressir/model/schema.rb +32 -46
- data/lib/expressir/model/statements/alias.rb +6 -3
- data/lib/expressir/model/statements/assignment.rb +3 -1
- data/lib/expressir/model/statements/call.rb +4 -2
- data/lib/expressir/model/statements/case.rb +4 -2
- data/lib/expressir/model/statements/case_action.rb +4 -2
- data/lib/expressir/model/statements/compound.rb +4 -2
- data/lib/expressir/model/statements/escape.rb +1 -1
- data/lib/expressir/model/statements/if.rb +5 -3
- data/lib/expressir/model/statements/null.rb +1 -1
- data/lib/expressir/model/statements/repeat.rb +6 -3
- data/lib/expressir/model/statements/return.rb +3 -1
- data/lib/expressir/model/statements/skip.rb +1 -1
- data/lib/expressir/model/subtype_constraint.rb +5 -2
- data/lib/expressir/model/type.rb +11 -4
- data/lib/expressir/model/types/aggregate.rb +5 -1
- data/lib/expressir/model/types/array.rb +3 -1
- data/lib/expressir/model/types/bag.rb +3 -1
- data/lib/expressir/model/types/binary.rb +3 -1
- data/lib/expressir/model/types/boolean.rb +1 -1
- data/lib/expressir/model/types/enumeration.rb +5 -3
- data/lib/expressir/model/types/generic.rb +5 -1
- data/lib/expressir/model/types/generic_entity.rb +5 -1
- data/lib/expressir/model/types/integer.rb +1 -1
- data/lib/expressir/model/types/list.rb +3 -1
- data/lib/expressir/model/types/logical.rb +1 -1
- data/lib/expressir/model/types/number.rb +1 -1
- data/lib/expressir/model/types/real.rb +3 -1
- data/lib/expressir/model/types/select.rb +5 -3
- data/lib/expressir/model/types/set.rb +3 -1
- data/lib/expressir/model/types/string.rb +3 -1
- data/lib/expressir/model/unique.rb +6 -2
- data/lib/expressir/model/variable.rb +5 -1
- data/lib/expressir/model/where.rb +5 -1
- data/lib/expressir/version.rb +1 -1
- data/original/examples/syntax/hyperlink.exp +8 -0
- data/original/examples/syntax/hyperlink_formatted.exp +19 -0
- data/original/examples/syntax/remark.exp +63 -20
- data/original/examples/syntax/remark_formatted.exp +62 -24
- data/original/examples/syntax/simple.exp +3 -0
- data/original/examples/syntax/source.exp +16 -0
- data/original/examples/syntax/syntax.exp +202 -190
- data/original/examples/syntax/syntax_formatted.exp +370 -799
- data/spec/expressir/express_exp/{format_remark_spec.rb → formatter/remark_spec.rb} +2 -2
- data/spec/expressir/express_exp/{format_syntax_spec.rb → formatter/syntax_spec.rb} +2 -2
- data/spec/expressir/express_exp/hyperlink_formatter_spec.rb +24 -0
- data/spec/expressir/express_exp/parser/head_source_spec.rb +38 -0
- data/spec/expressir/express_exp/parser/multiple_spec.rb +32 -0
- data/spec/expressir/express_exp/{parse_remark_spec.rb → parser/remark_spec.rb} +120 -55
- data/spec/expressir/express_exp/parser/source_spec.rb +29 -0
- data/spec/expressir/express_exp/parser/syntax_spec.rb +3080 -0
- data/spec/expressir/express_exp/schema_head_formatter_spec.rb +36 -0
- data/spec/expressir/model/{find_spec.rb → model_element/find_spec.rb} +26 -8
- data/spec/expressir/model/model_element/hash_spec.rb +66 -0
- metadata +38 -11
- data/lib/expressir/model/scope.rb +0 -17
- data/spec/expressir/express_exp/ap233_spec.rb +0 -22
- data/spec/expressir/express_exp/parse_syntax_spec.rb +0 -3003
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 432faff204670f985cc301c087b0c9da0c689b08f0a848a95fc3e3f95fc6b7b4
|
4
|
+
data.tar.gz: 59403e704f248d53d94663a8ece3d6a7650f895e8edd416983701e0b91f42f4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3291946e2a534e087d8f288bdcba3e43854280a2d4ffda087cfbbad25ca1f4517dc14dda9a6f2ae57b9804aeff86b25a158bc686c4d2f8777648fbd1913ccfa
|
7
|
+
data.tar.gz: 7a2c7cc654c8ac2518f659006ffd006830f7f58c93eaf908af7714d58f7a25ba63964f2e13ea09cf036fc527ab4d46133dee7bdc3dec20248c1767bd33e2504f
|
@@ -71,14 +71,13 @@ jobs:
|
|
71
71
|
|
72
72
|
- name: Publish to rubygems.org
|
73
73
|
env:
|
74
|
-
RUBYGEMS_API_KEY: ${{secrets.LUTAML_CI_RUBYGEMS_API_KEY}}
|
74
|
+
RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
|
75
75
|
run: |
|
76
76
|
mkdir -p ~/.gem
|
77
|
-
cat
|
77
|
+
cat > ~/.gem/credentials << EOF
|
78
78
|
---
|
79
79
|
:rubygems_api_key: ${RUBYGEMS_API_KEY}
|
80
80
|
EOF
|
81
81
|
chmod 0600 ~/.gem/credentials
|
82
|
-
gem -v
|
83
82
|
gem signin
|
84
|
-
for gem in pkg/*.gem; do gem push $gem -V
|
83
|
+
for gem in pkg/*.gem; do gem push $gem -V; done
|
data/.gitignore
CHANGED
data/exe/format
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "expressir/express_exp/parser"
|
4
|
+
require "expressir/express_exp/hyperlink_formatter"
|
5
|
+
|
6
|
+
input_files = [
|
7
|
+
'../iso-10303-stepmod/data/resources/action_schema/action_schema_annotated.exp',
|
8
|
+
'../iso-10303-stepmod/data/resources/basic_attribute_schema/basic_attribute_schema_annotated.exp',
|
9
|
+
'../iso-10303-stepmod/data/resources/support_resource_schema/support_resource_schema_annotated.exp'
|
10
|
+
]
|
11
|
+
|
12
|
+
repo = Expressir::ExpressExp::Parser.from_files(input_files)
|
13
|
+
schema = repo.schemas.find{|x| x.id == 'action_schema'}
|
14
|
+
result = Expressir::ExpressExp::HyperlinkFormatter.format(schema)
|
15
|
+
|
16
|
+
puts result
|
data/expressir.gemspec
CHANGED
@@ -32,11 +32,12 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.add_runtime_dependency "nokogiri", "~> 1.10"
|
34
34
|
spec.add_runtime_dependency "thor", "~> 1.0"
|
35
|
-
spec.add_runtime_dependency "rice", "~>
|
35
|
+
spec.add_runtime_dependency "rice", "~> 3"
|
36
36
|
spec.add_development_dependency "antlr4-native", "~> 1.1.0"
|
37
37
|
spec.add_development_dependency "bundler", "~> 2.0"
|
38
38
|
spec.add_development_dependency "pry", "~> 0.12.2"
|
39
|
-
spec.add_development_dependency "
|
39
|
+
spec.add_development_dependency "byebug", "~> 11.1"
|
40
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
40
41
|
spec.add_development_dependency "rake-compiler", "~> 1.1"
|
41
42
|
spec.add_development_dependency "rake-compiler-dock", "~> 1.1"
|
42
43
|
spec.add_development_dependency "rspec", "~> 3.0"
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -38,129 +38,129 @@ module Expressir
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def format(node)
|
41
|
-
if node.
|
41
|
+
if node.is_a? Model::Attribute
|
42
42
|
format_attribute(node)
|
43
|
-
elsif node.
|
43
|
+
elsif node.is_a? Model::Constant
|
44
44
|
format_constant(node)
|
45
|
-
elsif node.
|
45
|
+
elsif node.is_a? Model::Entity
|
46
46
|
format_entity(node)
|
47
|
-
elsif node.
|
47
|
+
elsif node.is_a? Model::EnumerationItem
|
48
48
|
format_enumeration_item(node)
|
49
|
-
elsif node.
|
49
|
+
elsif node.is_a? Model::Function
|
50
50
|
format_function(node)
|
51
|
-
elsif node.
|
51
|
+
elsif node.is_a? Model::Interface
|
52
52
|
format_interface(node)
|
53
|
-
elsif node.
|
53
|
+
elsif node.is_a? Model::Parameter
|
54
54
|
format_parameter(node)
|
55
|
-
elsif node.
|
55
|
+
elsif node.is_a? Model::Procedure
|
56
56
|
format_procedure(node)
|
57
|
-
elsif node.
|
57
|
+
elsif node.is_a? Model::RenamedRef
|
58
58
|
format_renamed_ref(node)
|
59
|
-
elsif node.
|
59
|
+
elsif node.is_a? Model::Repository
|
60
60
|
format_repository(node)
|
61
|
-
elsif node.
|
61
|
+
elsif node.is_a? Model::Rule
|
62
62
|
format_rule(node)
|
63
|
-
elsif node.
|
63
|
+
elsif node.is_a? Model::Schema
|
64
64
|
format_schema(node)
|
65
|
-
elsif node.
|
65
|
+
elsif node.is_a? Model::SubtypeConstraint
|
66
66
|
format_subtype_constraint(node)
|
67
|
-
elsif node.
|
67
|
+
elsif node.is_a? Model::Type
|
68
68
|
format_type(node)
|
69
|
-
elsif node.
|
69
|
+
elsif node.is_a? Model::Unique
|
70
70
|
format_unique(node)
|
71
|
-
elsif node.
|
71
|
+
elsif node.is_a? Model::Variable
|
72
72
|
format_variable(node)
|
73
|
-
elsif node.
|
73
|
+
elsif node.is_a? Model::Where
|
74
74
|
format_where(node)
|
75
|
-
elsif node.
|
75
|
+
elsif node.is_a? Model::Expressions::AggregateInitializer
|
76
76
|
format_expressions_aggregate_initializer(node)
|
77
|
-
elsif node.
|
77
|
+
elsif node.is_a? Model::Expressions::AggregateItem
|
78
78
|
format_expressions_aggregate_item(node)
|
79
|
-
elsif node.
|
79
|
+
elsif node.is_a? Model::Expressions::AttributeReference
|
80
80
|
format_expressions_attribute_reference(node)
|
81
|
-
elsif node.
|
81
|
+
elsif node.is_a? Model::Expressions::BinaryExpression
|
82
82
|
format_expressions_binary_expression(node)
|
83
|
-
elsif node.
|
83
|
+
elsif node.is_a? Model::Expressions::Call
|
84
84
|
format_expressions_call(node)
|
85
|
-
elsif node.
|
85
|
+
elsif node.is_a? Model::Expressions::EntityConstructor
|
86
86
|
format_expressions_entity_constructor(node)
|
87
|
-
elsif node.
|
87
|
+
elsif node.is_a? Model::Expressions::GroupReference
|
88
88
|
format_expressions_group_reference(node)
|
89
|
-
elsif node.
|
89
|
+
elsif node.is_a? Model::Expressions::IndexReference
|
90
90
|
format_expressions_index_reference(node)
|
91
|
-
elsif node.
|
91
|
+
elsif node.is_a? Model::Expressions::Interval
|
92
92
|
format_expressions_interval(node)
|
93
|
-
elsif node.
|
93
|
+
elsif node.is_a? Model::Expressions::QueryExpression
|
94
94
|
format_expressions_query_expression(node)
|
95
|
-
elsif node.
|
95
|
+
elsif node.is_a? Model::Expressions::SimpleReference
|
96
96
|
format_expressions_simple_reference(node)
|
97
|
-
elsif node.
|
97
|
+
elsif node.is_a? Model::Expressions::UnaryExpression
|
98
98
|
format_expressions_unary_expression(node)
|
99
|
-
elsif node.
|
99
|
+
elsif node.is_a? Model::Literals::Binary
|
100
100
|
format_literals_binary(node)
|
101
|
-
elsif node.
|
101
|
+
elsif node.is_a? Model::Literals::Integer
|
102
102
|
format_literals_integer(node)
|
103
|
-
elsif node.
|
103
|
+
elsif node.is_a? Model::Literals::Logical
|
104
104
|
format_literals_logical(node)
|
105
|
-
elsif node.
|
105
|
+
elsif node.is_a? Model::Literals::Real
|
106
106
|
format_literals_real(node)
|
107
|
-
elsif node.
|
107
|
+
elsif node.is_a? Model::Literals::String
|
108
108
|
format_literals_string(node)
|
109
|
-
elsif node.
|
109
|
+
elsif node.is_a? Model::Statements::Alias
|
110
110
|
format_statements_alias(node)
|
111
|
-
elsif node.
|
111
|
+
elsif node.is_a? Model::Statements::Assignment
|
112
112
|
format_statements_assignment(node)
|
113
|
-
elsif node.
|
113
|
+
elsif node.is_a? Model::Statements::Call
|
114
114
|
format_statements_call(node)
|
115
|
-
elsif node.
|
115
|
+
elsif node.is_a? Model::Statements::Case
|
116
116
|
format_statements_case(node)
|
117
|
-
elsif node.
|
117
|
+
elsif node.is_a? Model::Statements::CaseAction
|
118
118
|
format_statements_case_action(node)
|
119
|
-
elsif node.
|
119
|
+
elsif node.is_a? Model::Statements::Compound
|
120
120
|
format_statements_compound(node)
|
121
|
-
elsif node.
|
121
|
+
elsif node.is_a? Model::Statements::Escape
|
122
122
|
format_statements_escape(node)
|
123
|
-
elsif node.
|
123
|
+
elsif node.is_a? Model::Statements::If
|
124
124
|
format_statements_if(node)
|
125
|
-
elsif node.
|
125
|
+
elsif node.is_a? Model::Statements::Null
|
126
126
|
format_statements_null(node)
|
127
|
-
elsif node.
|
127
|
+
elsif node.is_a? Model::Statements::Repeat
|
128
128
|
format_statements_repeat(node)
|
129
|
-
elsif node.
|
129
|
+
elsif node.is_a? Model::Statements::Return
|
130
130
|
format_statements_return(node)
|
131
|
-
elsif node.
|
131
|
+
elsif node.is_a? Model::Statements::Skip
|
132
132
|
format_statements_skip(node)
|
133
|
-
elsif node.
|
133
|
+
elsif node.is_a? Model::Types::Aggregate
|
134
134
|
format_types_aggregate(node)
|
135
|
-
elsif node.
|
135
|
+
elsif node.is_a? Model::Types::Array
|
136
136
|
format_types_array(node)
|
137
|
-
elsif node.
|
137
|
+
elsif node.is_a? Model::Types::Bag
|
138
138
|
format_types_bag(node)
|
139
|
-
elsif node.
|
139
|
+
elsif node.is_a? Model::Types::Binary
|
140
140
|
format_types_binary(node)
|
141
|
-
elsif node.
|
141
|
+
elsif node.is_a? Model::Types::Boolean
|
142
142
|
format_types_boolean(node)
|
143
|
-
elsif node.
|
143
|
+
elsif node.is_a? Model::Types::Enumeration
|
144
144
|
format_types_enumeration(node)
|
145
|
-
elsif node.
|
145
|
+
elsif node.is_a? Model::Types::GenericEntity
|
146
146
|
format_types_generic_entity(node)
|
147
|
-
elsif node.
|
147
|
+
elsif node.is_a? Model::Types::Generic
|
148
148
|
format_types_generic(node)
|
149
|
-
elsif node.
|
149
|
+
elsif node.is_a? Model::Types::Integer
|
150
150
|
format_types_integer(node)
|
151
|
-
elsif node.
|
151
|
+
elsif node.is_a? Model::Types::List
|
152
152
|
format_types_list(node)
|
153
|
-
elsif node.
|
153
|
+
elsif node.is_a? Model::Types::Logical
|
154
154
|
format_types_logical(node)
|
155
|
-
elsif node.
|
155
|
+
elsif node.is_a? Model::Types::Number
|
156
156
|
format_types_number(node)
|
157
|
-
elsif node.
|
157
|
+
elsif node.is_a? Model::Types::Real
|
158
158
|
format_types_real(node)
|
159
|
-
elsif node.
|
159
|
+
elsif node.is_a? Model::Types::Select
|
160
160
|
format_types_select(node)
|
161
|
-
elsif node.
|
161
|
+
elsif node.is_a? Model::Types::Set
|
162
162
|
format_types_set(node)
|
163
|
-
elsif node.
|
163
|
+
elsif node.is_a? Model::Types::String
|
164
164
|
format_types_string(node)
|
165
165
|
else
|
166
166
|
puts node.class
|
@@ -233,6 +233,10 @@ module Expressir
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def format_entity(node)
|
236
|
+
explicit_attributes = node.attributes.select{|x| x.kind == Model::Attribute::EXPLICIT}
|
237
|
+
derived_attributes = node.attributes.select{|x| x.kind == Model::Attribute::DERIVED}
|
238
|
+
inverse_attributes = node.attributes.select{|x| x.kind == Model::Attribute::INVERSE}
|
239
|
+
|
236
240
|
[
|
237
241
|
[
|
238
242
|
'ENTITY',
|
@@ -290,19 +294,19 @@ module Expressir
|
|
290
294
|
end,
|
291
295
|
';'
|
292
296
|
].join(''),
|
293
|
-
*if
|
294
|
-
indent(
|
297
|
+
*if explicit_attributes and explicit_attributes.length > 0
|
298
|
+
indent(explicit_attributes.map{|x| format(x)}.join("\n"))
|
295
299
|
end,
|
296
|
-
*if
|
300
|
+
*if derived_attributes and derived_attributes.length > 0
|
297
301
|
indent([
|
298
302
|
'DERIVE',
|
299
|
-
indent(
|
303
|
+
indent(derived_attributes.map{|x| format(x)}.join("\n")),
|
300
304
|
].join("\n"))
|
301
305
|
end,
|
302
|
-
*if
|
306
|
+
*if inverse_attributes and inverse_attributes.length > 0
|
303
307
|
indent([
|
304
308
|
'INVERSE',
|
305
|
-
indent(
|
309
|
+
indent(inverse_attributes.map{|x| format(x)}.join("\n")),
|
306
310
|
].join("\n"))
|
307
311
|
end,
|
308
312
|
*if node.unique and node.unique.length > 0
|
@@ -347,8 +351,20 @@ module Expressir
|
|
347
351
|
format(node.return_type),
|
348
352
|
';'
|
349
353
|
].join(''),
|
350
|
-
*if node.
|
351
|
-
indent(node.
|
354
|
+
*if node.types and node.types.length > 0
|
355
|
+
indent(node.types.map{|x| format(x)}.join("\n"))
|
356
|
+
end,
|
357
|
+
*if node.entities and node.entities.length > 0
|
358
|
+
indent(node.entities.map{|x| format(x)}.join("\n"))
|
359
|
+
end,
|
360
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
361
|
+
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
362
|
+
end,
|
363
|
+
*if node.functions and node.functions.length > 0
|
364
|
+
indent(node.functions.map{|x| format(x)}.join("\n"))
|
365
|
+
end,
|
366
|
+
*if node.procedures and node.procedures.length > 0
|
367
|
+
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
352
368
|
end,
|
353
369
|
*if node.constants and node.constants.length > 0
|
354
370
|
indent([
|
@@ -395,7 +411,7 @@ module Expressir
|
|
395
411
|
"\n",
|
396
412
|
INDENT,
|
397
413
|
'(',
|
398
|
-
node.items.map{|x| format(x)},
|
414
|
+
node.items.map{|x| format(x)}.join(', '),
|
399
415
|
')'
|
400
416
|
].join('')
|
401
417
|
end,
|
@@ -434,8 +450,20 @@ module Expressir
|
|
434
450
|
end,
|
435
451
|
';'
|
436
452
|
].join(''),
|
437
|
-
*if node.
|
438
|
-
indent(node.
|
453
|
+
*if node.types and node.types.length > 0
|
454
|
+
indent(node.types.map{|x| format(x)}.join("\n"))
|
455
|
+
end,
|
456
|
+
*if node.entities and node.entities.length > 0
|
457
|
+
indent(node.entities.map{|x| format(x)}.join("\n"))
|
458
|
+
end,
|
459
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
460
|
+
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
461
|
+
end,
|
462
|
+
*if node.functions and node.functions.length > 0
|
463
|
+
indent(node.functions.map{|x| format(x)}.join("\n"))
|
464
|
+
end,
|
465
|
+
*if node.procedures and node.procedures.length > 0
|
466
|
+
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
439
467
|
end,
|
440
468
|
*if node.constants and node.constants.length > 0
|
441
469
|
indent([
|
@@ -481,8 +509,7 @@ module Expressir
|
|
481
509
|
[
|
482
510
|
*if node.schemas and node.schemas.length > 0
|
483
511
|
node.schemas.map{|node| format(node)}
|
484
|
-
end
|
485
|
-
*format_scope_remarks(node)
|
512
|
+
end
|
486
513
|
].join("\n")
|
487
514
|
end
|
488
515
|
|
@@ -500,8 +527,20 @@ module Expressir
|
|
500
527
|
')',
|
501
528
|
';'
|
502
529
|
].join(''),
|
503
|
-
*if node.
|
504
|
-
indent(node.
|
530
|
+
*if node.types and node.types.length > 0
|
531
|
+
indent(node.types.map{|x| format(x)}.join("\n"))
|
532
|
+
end,
|
533
|
+
*if node.entities and node.entities.length > 0
|
534
|
+
indent(node.entities.map{|x| format(x)}.join("\n"))
|
535
|
+
end,
|
536
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
537
|
+
indent(node.subtype_constraints.map{|x| format(x)}.join("\n"))
|
538
|
+
end,
|
539
|
+
*if node.functions and node.functions.length > 0
|
540
|
+
indent(node.functions.map{|x| format(x)}.join("\n"))
|
541
|
+
end,
|
542
|
+
*if node.procedures and node.procedures.length > 0
|
543
|
+
indent(node.procedures.map{|x| format(x)}.join("\n"))
|
505
544
|
end,
|
506
545
|
*if node.constants and node.constants.length > 0
|
507
546
|
indent([
|
@@ -566,13 +605,29 @@ module Expressir
|
|
566
605
|
].join('')
|
567
606
|
].join("\n")
|
568
607
|
end,
|
569
|
-
*if node.
|
570
|
-
node.
|
608
|
+
*if node.types and node.types.length > 0
|
609
|
+
node.types.map{|x| format(x)}.join("\n")
|
610
|
+
end,
|
611
|
+
*if node.entities and node.entities.length > 0
|
612
|
+
node.entities.map{|x| format(x)}.join("\n")
|
613
|
+
end,
|
614
|
+
*if node.subtype_constraints and node.subtype_constraints.length > 0
|
615
|
+
node.subtype_constraints.map{|x| format(x)}.join("\n")
|
616
|
+
end,
|
617
|
+
*if node.functions and node.functions.length > 0
|
618
|
+
node.functions.map{|x| format(x)}.join("\n")
|
619
|
+
end,
|
620
|
+
*if node.procedures and node.procedures.length > 0
|
621
|
+
node.procedures.map{|x| format(x)}.join("\n")
|
622
|
+
end,
|
623
|
+
*if node.rules and node.rules.length > 0
|
624
|
+
node.rules.map{|x| format(x)}.join("\n")
|
571
625
|
end,
|
572
626
|
[
|
573
627
|
'END_SCHEMA',
|
574
628
|
';'
|
575
|
-
].join('')
|
629
|
+
].join(''),
|
630
|
+
*format_scope_remarks(node)
|
576
631
|
].join("\n")
|
577
632
|
end
|
578
633
|
|
@@ -718,11 +773,11 @@ module Expressir
|
|
718
773
|
|
719
774
|
def format_expressions_binary_expression(node)
|
720
775
|
[
|
721
|
-
*if node.operand1.
|
776
|
+
*if node.operand1.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand1.operator] > OPERATOR_PRECEDENCE[node.operator]
|
722
777
|
'('
|
723
778
|
end,
|
724
779
|
format(node.operand1),
|
725
|
-
*if node.operand1.
|
780
|
+
*if node.operand1.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand1.operator] > OPERATOR_PRECEDENCE[node.operator]
|
726
781
|
')'
|
727
782
|
end,
|
728
783
|
' ',
|
@@ -751,11 +806,11 @@ module Expressir
|
|
751
806
|
when Model::Expressions::BinaryExpression::XOR then 'XOR'
|
752
807
|
end,
|
753
808
|
' ',
|
754
|
-
*if node.operand2.
|
809
|
+
*if node.operand2.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand2.operator] > OPERATOR_PRECEDENCE[node.operator]
|
755
810
|
'('
|
756
811
|
end,
|
757
812
|
format(node.operand2),
|
758
|
-
*if node.operand2.
|
813
|
+
*if node.operand2.is_a? Model::Expressions::BinaryExpression and OPERATOR_PRECEDENCE[node.operand2.operator] > OPERATOR_PRECEDENCE[node.operator]
|
759
814
|
')'
|
760
815
|
end,
|
761
816
|
].join('')
|
@@ -856,11 +911,11 @@ module Expressir
|
|
856
911
|
if node.operator == Model::Expressions::UnaryExpression::NOT
|
857
912
|
' '
|
858
913
|
end,
|
859
|
-
*if node.operand.
|
914
|
+
*if node.operand.is_a? Model::Expressions::BinaryExpression
|
860
915
|
'('
|
861
916
|
end,
|
862
917
|
format(node.operand),
|
863
|
-
*if node.operand.
|
918
|
+
*if node.operand.is_a? Model::Expressions::BinaryExpression
|
864
919
|
')'
|
865
920
|
end
|
866
921
|
].join('')
|
@@ -1226,7 +1281,7 @@ module Expressir
|
|
1226
1281
|
format(node.extension_type)
|
1227
1282
|
].join('')
|
1228
1283
|
end,
|
1229
|
-
*if node.extension_items
|
1284
|
+
*if node.extension_items and node.extension_items.length > 0
|
1230
1285
|
[
|
1231
1286
|
' ',
|
1232
1287
|
'WITH',
|
@@ -1330,7 +1385,7 @@ module Expressir
|
|
1330
1385
|
format(node.extension_type)
|
1331
1386
|
].join('')
|
1332
1387
|
end,
|
1333
|
-
*if node.extension_items
|
1388
|
+
*if node.extension_items and node.extension_items.length > 0
|
1334
1389
|
[
|
1335
1390
|
' ',
|
1336
1391
|
'WITH',
|
@@ -1387,25 +1442,13 @@ module Expressir
|
|
1387
1442
|
str.split("\n").map{|x| "#{INDENT}#{x}"}.join("\n")
|
1388
1443
|
end
|
1389
1444
|
|
1390
|
-
def format_remark_ref(node)
|
1391
|
-
[
|
1392
|
-
*if node.class.method_defined? :parent and node.parent.class.method_defined? :id and node.parent != node
|
1393
|
-
[
|
1394
|
-
format_remark_ref(node.parent),
|
1395
|
-
'.'
|
1396
|
-
].join('')
|
1397
|
-
end,
|
1398
|
-
node.id,
|
1399
|
-
].join('')
|
1400
|
-
end
|
1401
|
-
|
1402
1445
|
def format_remark(node, remark)
|
1403
1446
|
if remark.include?("\n")
|
1404
1447
|
[
|
1405
1448
|
[
|
1406
1449
|
'(*',
|
1407
1450
|
'"',
|
1408
|
-
|
1451
|
+
node.path,
|
1409
1452
|
'"',
|
1410
1453
|
].join(''),
|
1411
1454
|
remark,
|
@@ -1415,7 +1458,7 @@ module Expressir
|
|
1415
1458
|
[
|
1416
1459
|
'--',
|
1417
1460
|
'"',
|
1418
|
-
|
1461
|
+
node.path,
|
1419
1462
|
'"',
|
1420
1463
|
' ',
|
1421
1464
|
remark
|
@@ -1424,7 +1467,7 @@ module Expressir
|
|
1424
1467
|
end
|
1425
1468
|
|
1426
1469
|
def format_remarks(node)
|
1427
|
-
if node.class.method_defined? :remarks
|
1470
|
+
if node.class.method_defined? :remarks
|
1428
1471
|
node.remarks.map do |remark|
|
1429
1472
|
format_remark(node, remark)
|
1430
1473
|
end
|
@@ -1436,13 +1479,7 @@ module Expressir
|
|
1436
1479
|
def format_scope_remarks(node)
|
1437
1480
|
[
|
1438
1481
|
*format_remarks(node),
|
1439
|
-
*
|
1440
|
-
node.children.flat_map do |x|
|
1441
|
-
if x != node
|
1442
|
-
format_scope_remarks(x)
|
1443
|
-
end
|
1444
|
-
end
|
1445
|
-
end
|
1482
|
+
*node.children.select{|x| !x.is_a? Model::EnumerationItem or node.is_a? Model::Type}.flat_map{|x| format_scope_remarks(x)}
|
1446
1483
|
]
|
1447
1484
|
end
|
1448
1485
|
end
|