expressir 2.1.10 → 2.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 668feb1be4e33b9d1872eeb84487b2f5d62de3ec01039a44c6c874d359b41a63
4
- data.tar.gz: 5cded4f528912d34d211cdac18a39cdbf5f0a02e0d89e6a4f0e8af84a21a20d0
3
+ metadata.gz: 2bf04861d85e69452aa448d4bb5fd2a26de53a0fc23fd9fe5666d5992ce5e3d6
4
+ data.tar.gz: 75190b477d543c56733746ad7a9a7d66352908d973b92498373190eb038b42da
5
5
  SHA512:
6
- metadata.gz: c304c2bbdfb9f6ccc3111057a5fd9a41f86f53dbf94f91cc94091588e26ca9a73a2d869fb74f10cf07261b493444140e0ee1a8bc743decc34aafca221816c0cd
7
- data.tar.gz: e01761f2d7109ef0d324fd2032d6e2a2ef21effb0a4ba6aa5ce7e3c46336fcf4165d59d93634d698d3b7bcecff924b35036c83c087a01d3c6038a294e3986b2e
6
+ metadata.gz: f154d70ee6c63ef721f70d36870598833e7e3d599d18d93c07afe0d3469932f867721d2787902834bc8de51a1cd5bc17f7219d1215fcac565d417d10af4890fb
7
+ data.tar.gz: 0fdb16662422420c34492b6e7afe5cca362c8e94e6ea92cfd59a97896ef2d010c8106976a80eb0ba67d788122495f986ea468f8d7f31f3cbde8449774421ddb8
data/.rubocop_todo.yml CHANGED
@@ -1,11 +1,65 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2024-11-26 21:06:12 UTC using RuboCop version 1.68.0.
3
+ # on 2025-01-30 03:38:19 UTC using RuboCop version 1.71.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 4
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
12
+ # SupportedStyles: case, end
13
+ Layout/CaseIndentation:
14
+ Exclude:
15
+ - 'lib/expressir/model/model_element.rb'
16
+
17
+ # Offense count: 4
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ Layout/ElseAlignment:
20
+ Exclude:
21
+ - 'lib/expressir/express/formatter.rb'
22
+
23
+ # Offense count: 111
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
26
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
27
+ Layout/EndAlignment:
28
+ Exclude:
29
+ - 'lib/expressir/express/formatter.rb'
30
+ - 'lib/expressir/model/model_element.rb'
31
+
32
+ # Offense count: 2
33
+ # This cop supports safe autocorrection (--autocorrect).
34
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
35
+ # SupportedStyles: special_inside_parentheses, consistent, align_brackets
36
+ Layout/FirstArrayElementIndentation:
37
+ Exclude:
38
+ - 'lib/expressir/express/formatter.rb'
39
+
40
+ # Offense count: 109
41
+ # This cop supports safe autocorrection (--autocorrect).
42
+ # Configuration parameters: Width, AllowedPatterns.
43
+ Layout/IndentationWidth:
44
+ Exclude:
45
+ - 'lib/expressir/express/formatter.rb'
46
+
47
+ # Offense count: 2
48
+ # This cop supports safe autocorrection (--autocorrect).
49
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
50
+ # URISchemes: http, https
51
+ Layout/LineLength:
52
+ Exclude:
53
+ - 'lib/expressir/express/parser.rb'
54
+
55
+ # Offense count: 4
56
+ # This cop supports safe autocorrection (--autocorrect).
57
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
58
+ # SupportedStyles: aligned, indented
59
+ Layout/MultilineOperationIndentation:
60
+ Exclude:
61
+ - 'lib/expressir/express/formatter.rb'
62
+
9
63
  # Offense count: 1
10
64
  # Configuration parameters: AllowedParentClasses.
11
65
  Lint/MissingSuper:
@@ -19,7 +73,8 @@ Lint/ShadowingOuterLocalVariable:
19
73
 
20
74
  # Offense count: 2
21
75
  # This cop supports safe autocorrection (--autocorrect).
22
- # Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
76
+ # Configuration parameters: AutoCorrect, AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
77
+ # NotImplementedExceptions: NotImplementedError
23
78
  Lint/UnusedMethodArgument:
24
79
  Exclude:
25
80
  - 'lib/expressir/express/parser.rb'
@@ -82,3 +137,11 @@ Performance/FixedSize:
82
137
  Style/MissingRespondToMissing:
83
138
  Exclude:
84
139
  - 'lib/expressir/express/visitor.rb'
140
+
141
+ # Offense count: 2
142
+ # This cop supports safe autocorrection (--autocorrect).
143
+ # Configuration parameters: EnforcedStyle.
144
+ # SupportedStyles: single_quotes, double_quotes
145
+ Style/StringLiteralsInInterpolation:
146
+ Exclude:
147
+ - 'lib/expressir/model/model_element.rb'
data/exe/expressir CHANGED
@@ -1,22 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
3
 
4
- # resolve bin path, ignoring symlinks
5
- require "pathname"
6
- bin_file = Pathname.new(__FILE__).realpath
7
-
8
- # add self to libpath
9
- $:.unshift File.expand_path("../../lib", bin_file)
10
-
11
- # Fixes https://github.com/rubygems/rubygems/issues/1420
12
- require "rubygems/specification"
13
-
14
- module Gem
15
- class Specification
16
- def this; self; end
17
- end
18
- end
19
-
20
- # start up the CLI
21
- require "expressir"
4
+ require_relative "../lib/expressir"
22
5
  Expressir::Cli.start(ARGV)
data/exe/expressir-format CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "yaml"
4
- require "expressir"
5
- require "expressir/express/formatter"
6
- require "expressir/express/schema_head_formatter"
7
- require "expressir/express/hyperlink_formatter"
4
+ require_relative "../lib/expressir"
5
+ require_relative "../lib/expressir/express/formatter"
6
+ require_relative "../lib/expressir/express/schema_head_formatter"
7
+ require_relative "../lib/expressir/express/hyperlink_formatter"
8
8
 
9
9
  exp_files = ARGV
10
10
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  require "yaml"
4
4
  require "tempfile"
5
- require "expressir/express/parser"
6
- require "expressir/express/formatter"
7
- require "expressir/express/schema_head_formatter"
8
- require "expressir/express/hyperlink_formatter"
9
- require "expressir/express/cache"
5
+ require_relative "../lib/expressir/express/parser"
6
+ require_relative "../lib/expressir/express/formatter"
7
+ require_relative "../lib/expressir/express/schema_head_formatter"
8
+ require_relative "../lib/expressir/express/hyperlink_formatter"
9
+ require_relative "../lib/expressir/express/cache"
10
10
 
11
11
  exp_files = [
12
12
  # basic test
@@ -1,6 +1,5 @@
1
- require "yaml"
2
1
  require "zlib"
3
- require "expressir/model"
2
+ require_relative "../model"
4
3
 
5
4
  module Expressir
6
5
  module Express
@@ -1,4 +1,4 @@
1
- require "expressir/model"
1
+ require_relative "../model"
2
2
 
3
3
  module Expressir
4
4
  module Express
@@ -40,6 +40,12 @@ module Expressir
40
40
  private_constant :OPERATOR_PRECEDENCE
41
41
  private_constant :SUPERTYPE_OPERATOR_PRECEDENCE
42
42
 
43
+ attr_accessor :no_remarks
44
+
45
+ def initialize(no_remarks: false)
46
+ @no_remarks = no_remarks
47
+ end
48
+
43
49
  # Formats Express model into an Express code
44
50
  # @param [Model::ModelElement] node
45
51
  # @return [String]
@@ -1604,7 +1610,7 @@ module Expressir
1604
1610
  end
1605
1611
 
1606
1612
  def format_remarks(node)
1607
- if node.class.method_defined? :remarks
1613
+ if node.class.method_defined?(:remarks) && !@no_remarks
1608
1614
  node.remarks.map do |remark|
1609
1615
  format_remark(node, remark)
1610
1616
  end
@@ -1,4 +1,4 @@
1
- require "expressir/model"
1
+ require_relative "../model"
2
2
 
3
3
  module Expressir
4
4
  module Express
@@ -1,6 +1,6 @@
1
- require "expressir/express/resolve_references_model_visitor"
2
1
  require "parslet"
3
- require "expressir/model"
2
+ require_relative "resolve_references_model_visitor"
3
+ require_relative "../model"
4
4
 
5
5
  module Expressir
6
6
  module Express
@@ -68,7 +68,7 @@ module Expressir
68
68
  end
69
69
  rule(:aliasStmt) do
70
70
  (tALIAS >> variableId >> tFOR >> generalRef >> qualifier.repeat.as(:qualifier) >>
71
- op_delim >> stmt.repeat(1).as(:stmt) >> tEND_ALIAS >> (op_delim.as(:op_delim2))).as(:aliasStmt)
71
+ op_delim >> stmt.repeat(1).as(:stmt) >> tEND_ALIAS >> (op_delim.as(:op_delim2))).as(:aliasStmt)
72
72
  end
73
73
  rule(:anyKeyword) { KEYWORDS.map { |kw| send("t#{kw}") }.inject(:|) }
74
74
  rule(:arrayType) do
@@ -89,11 +89,9 @@ module Expressir
89
89
  rule(:boundSpec) { (op_leftbracket >> bound1 >> op_colon >> bound2 >> op_rightbracket).as(:boundSpec) }
90
90
  rule(:builtInConstant) { (tCONST_E | tPI | tSELF | op_question_mark).as(:builtInConstant) }
91
91
  rule(:builtInFunction) do
92
- (
93
- tABS | tACOS | tASIN | tATAN | tBLENGTH | tCOS | tEXISTS | tEXP | tFORMAT | tHIBOUND | tHIINDEX | tLENGTH |
94
- tLOBOUND | tLOINDEX | tLOG2 | tLOG10 | tLOG | tNVL | tODD | tROLESOF | tSIN | tSIZEOF | tSQRT | tTAN |
95
- tTYPEOF | tUSEDIN | tVALUE_IN | tVALUE_UNIQUE | tVALUE
96
- ).as(:builtInFunction)
92
+ (tABS | tACOS | tASIN | tATAN | tBLENGTH | tCOS | tEXISTS | tEXP | tFORMAT | tHIBOUND | tHIINDEX | tLENGTH |
93
+ tLOBOUND | tLOINDEX | tLOG2 | tLOG10 | tLOG | tNVL | tODD | tROLESOF | tSIN | tSIZEOF | tSQRT | tTAN |
94
+ tTYPEOF | tUSEDIN | tVALUE_IN | tVALUE_UNIQUE | tVALUE).as(:builtInFunction)
97
95
  end
98
96
  rule(:builtInProcedure) { (tINSERT | tREMOVE).as(:builtInProcedure) }
99
97
  rule(:caseAction) { ((caseLabel >> (op_comma >> caseLabel).repeat).as(:listOf_caseLabel) >> op_colon >> stmt).as(:caseAction) }
@@ -141,10 +139,8 @@ module Expressir
141
139
  rule(:enumerationType) { (tEXTENSIBLE.maybe >> tENUMERATION >> (tOF >> enumerationItems | enumerationExtension).maybe).as(:enumerationType) }
142
140
  rule(:escapeStmt) { (tESCAPE >> op_delim).as(:escapeStmt) }
143
141
  rule(:explicitAttr) do
144
- (
145
- (attributeDecl >> (op_comma >> attributeDecl).repeat).as(:listOf_attributeDecl) >> op_colon >>
146
- tOPTIONAL.maybe >> parameterType >> op_delim
147
- ).as(:explicitAttr)
142
+ ((attributeDecl >> (op_comma >> attributeDecl).repeat).as(:listOf_attributeDecl) >> op_colon >>
143
+ tOPTIONAL.maybe >> parameterType >> op_delim).as(:explicitAttr)
148
144
  end
149
145
  rule(:expression) { (simpleExpression >> (relOpExtended >> simpleExpression.as(:rhs)).maybe).as(:expression) }
150
146
  rule(:factor) { (simpleFactor >> (op_double_asterisk >> simpleFactor.as(:rhs)).maybe).as(:factor) }
@@ -153,9 +149,8 @@ module Expressir
153
149
  rule(:functionDecl) { (functionHead >> algorithmHead >> stmt.repeat(1).as(:stmt) >> tEND_FUNCTION >> op_delim).as(:functionDecl) }
154
150
  rule(:functionHead) do
155
151
  (tFUNCTION >> functionId >>
156
- (op_leftparen >> (formalParameter >> (op_delim >> formalParameter).repeat).as(:listOf_formalParameter) >> op_rightparen).maybe >>
157
- op_colon >> parameterType >> (op_delim.as(:op_delim2))
158
- ).as(:functionHead)
152
+ (op_leftparen >> (formalParameter >> (op_delim >> formalParameter).repeat).as(:listOf_formalParameter) >> op_rightparen).maybe >>
153
+ op_colon >> parameterType >> (op_delim.as(:op_delim2))).as(:functionHead)
159
154
  end
160
155
  rule(:functionId) { simpleId.as(:functionId) }
161
156
  rule(:functionRef) { functionId.as(:functionRef) }
@@ -188,8 +183,7 @@ module Expressir
188
183
  rule(:intervalLow) { simpleExpression.as(:intervalLow) }
189
184
  rule(:interval) do
190
185
  (op_left_curly_brace >> intervalLow >> intervalOp >> intervalItem >> (intervalOp.as(:intervalOp2)) >>
191
- intervalHigh >> op_right_curly_brace
192
- ).as(:interval)
186
+ intervalHigh >> op_right_curly_brace).as(:interval)
193
187
  end
194
188
  rule(:intervalOp) { (op_less_equal | op_less_than).as(:intervalOp) }
195
189
  rule(:inverseAttr) do
@@ -203,9 +197,8 @@ module Expressir
203
197
  rule(:localDecl) { (tLOCAL >> localVariable.repeat(1).as(:localVariable) >> tEND_LOCAL >> op_delim).as(:localDecl) }
204
198
  rule(:localVariable) do
205
199
  ((variableId >> (op_comma >> variableId).repeat).as(:listOf_variableId) >>
206
- op_colon >> parameterType >>
207
- (op_decl >> expression).maybe >> op_delim
208
- ).as(:localVariable)
200
+ op_colon >> parameterType >>
201
+ (op_decl >> expression).maybe >> op_delim).as(:localVariable)
209
202
  end
210
203
  rule(:logicalExpression) { expression.as(:logicalExpression) }
211
204
  rule(:logicalLiteral) { (tFALSE | tTRUE | tUNKNOWN).as(:logicalLiteral) }
@@ -218,10 +211,8 @@ module Expressir
218
211
  rule(:numericExpression) { simpleExpression.as(:numericExpression) }
219
212
  rule(:octet) { hexDigit >> hexDigit }
220
213
  rule(:oneOf) do
221
- (
222
- tONEOF >> op_leftparen >> (supertypeExpression >>
223
- (op_comma >> supertypeExpression).repeat).as(:listOf_supertypeExpression) >> op_rightparen
224
- ).as(:oneOf)
214
+ (tONEOF >> op_leftparen >> (supertypeExpression >>
215
+ (op_comma >> supertypeExpression).repeat).as(:listOf_supertypeExpression) >> op_rightparen).as(:oneOf)
225
216
  end
226
217
  rule(:op_asterisk) { cstr("*").as(:op_asterisk) }
227
218
  rule(:op_colon) { cstr(":").as(:op_colon) }
@@ -264,14 +255,9 @@ module Expressir
264
255
  rule(:procedureDecl) { (procedureHead >> algorithmHead >> stmt.repeat.as(:stmt) >> tEND_PROCEDURE >> op_delim).as(:procedureDecl) }
265
256
  rule(:procedureHeadParameter) { (tVAR.maybe >> formalParameter).as(:procedureHeadParameter) }
266
257
  rule(:procedureHead) do
267
- (
268
- tPROCEDURE >> procedureId >>
269
- (
270
- op_leftparen >> (
271
- procedureHeadParameter >>
272
- (op_delim >> procedureHeadParameter).repeat
273
- ).as(:listOf_procedureHeadParameter) >> op_rightparen
274
- ).maybe >> (op_delim.as(:op_delim2))).as(:procedureHead)
258
+ (tPROCEDURE >> procedureId >>
259
+ (op_leftparen >> (procedureHeadParameter >>
260
+ (op_delim >> procedureHeadParameter).repeat).as(:listOf_procedureHeadParameter) >> op_rightparen).maybe >> (op_delim.as(:op_delim2))).as(:procedureHead)
275
261
  end
276
262
  rule(:procedureId) { simpleId.as(:procedureId) }
277
263
  rule(:procedureRef) { procedureId.as(:procedureRef) }
@@ -285,20 +271,14 @@ module Expressir
285
271
  rule(:realType) { (tREAL >> (op_leftparen >> precisionSpec >> op_rightparen).maybe).as(:realType) }
286
272
  rule(:redeclaredAttribute) { (qualifiedAttribute >> (tRENAMED >> attributeId).maybe).as(:redeclaredAttribute) }
287
273
  rule(:referenceClause) do
288
- (
289
- tREFERENCE >> tFROM >> schemaRef >>
290
- (op_leftparen >> (resourceOrRename >> (
291
- op_comma >> resourceOrRename
292
- ).repeat).as(:listOf_resourceOrRename) >> op_rightparen).maybe >> op_delim
293
- ).as(:referenceClause)
274
+ (tREFERENCE >> tFROM >> schemaRef >>
275
+ (op_leftparen >> (resourceOrRename >> (op_comma >> resourceOrRename).repeat).as(:listOf_resourceOrRename) >> op_rightparen).maybe >> op_delim).as(:referenceClause)
294
276
  end
295
277
  rule(:referencedAttribute) { (attributeRef | qualifiedAttribute).as(:referencedAttribute) }
296
278
  rule(:relOpExtended) { (relOp | tIN | tLIKE).as(:relOpExtended) }
297
279
  rule(:relOp) do
298
- (
299
- op_less_equal | op_greater_equal | op_less_greater | op_less_than | op_greater_than | op_equals |
300
- op_colon_less_greater_colon | op_colon_equals_colon
301
- ).as(:relOp)
280
+ (op_less_equal | op_greater_equal | op_less_greater | op_less_than | op_greater_than | op_equals |
281
+ op_colon_less_greater_colon | op_colon_equals_colon).as(:relOp)
302
282
  end
303
283
  rule(:renameId) { (constantId | entityId | functionId | procedureId | typeId).as(:renameId) }
304
284
  rule(:repeatControl) { (incrementControl.maybe >> whileControl.maybe >> untilControl.maybe).as(:repeatControl) }
@@ -309,10 +289,8 @@ module Expressir
309
289
  rule(:returnStmt) { (tRETURN >> (op_leftparen >> expression >> op_rightparen).maybe >> op_delim).as(:returnStmt) }
310
290
  rule(:ruleDecl) { (ruleHead >> algorithmHead >> stmt.repeat.as(:stmt) >> whereClause >> tEND_RULE >> op_delim).as(:ruleDecl) }
311
291
  rule(:ruleHead) do
312
- (
313
- tRULE >> ruleId >> tFOR >> op_leftparen >>
314
- (entityRef >> (op_comma >> entityRef).repeat).as(:listOf_entityRef) >> op_rightparen >> op_delim
315
- ).as(:ruleHead)
292
+ (tRULE >> ruleId >> tFOR >> op_leftparen >>
293
+ (entityRef >> (op_comma >> entityRef).repeat).as(:listOf_entityRef) >> op_rightparen >> op_delim).as(:ruleHead)
316
294
  end
317
295
  rule(:ruleId) { simpleId.as(:ruleId) }
318
296
  rule(:ruleLabelId) { simpleId.as(:ruleLabelId) }
@@ -320,10 +298,8 @@ module Expressir
320
298
  rule(:ruleRef) { ruleId.as(:ruleRef) }
321
299
  rule(:schemaBodyDeclaration) { (declaration | ruleDecl).as(:schemaBodyDeclaration) }
322
300
  rule(:schemaBody) do
323
- (
324
- interfaceSpecification.repeat.as(:interfaceSpecification) >> constantDecl.maybe >>
325
- schemaBodyDeclaration.repeat.as(:schemaBodyDeclaration)
326
- ).as(:schemaBody)
301
+ (interfaceSpecification.repeat.as(:interfaceSpecification) >> constantDecl.maybe >>
302
+ schemaBodyDeclaration.repeat.as(:schemaBodyDeclaration)).as(:schemaBody)
327
303
  end
328
304
  rule(:schemaDecl) do
329
305
  (tSCHEMA >> schemaId >> schemaVersionId.maybe >> op_delim >> schemaBody >> tEND_SCHEMA >> (op_delim.as(:op_delim2))).as(:schemaDecl)
@@ -339,10 +315,8 @@ module Expressir
339
315
  rule(:sign) { match["+-"] }
340
316
  rule(:simpleExpression) { (term >> (addLikeOp.as(:operator) >> term).as(:item).repeat.as(:rhs)).as(:simpleExpression) }
341
317
  rule(:simpleFactor) do
342
- (
343
- simpleFactorExpression | aggregateInitializer | entityConstructor | interval | queryExpression | stringLiteral |
344
- simpleFactorUnaryExpression | enumerationReference
345
- ).as(:simpleFactor)
318
+ (simpleFactorExpression | aggregateInitializer | entityConstructor | interval | queryExpression | stringLiteral |
319
+ simpleFactorUnaryExpression | enumerationReference).as(:simpleFactor)
346
320
  end
347
321
  rule(:simpleFactorExpression) { (op_leftparen >> expression >> op_rightparen | primary).as(:simpleFactorExpression) }
348
322
  rule(:simpleFactorUnaryExpression) { (unaryOp >> simpleFactorExpression).as(:simpleFactorUnaryExpression) }
@@ -353,10 +327,8 @@ module Expressir
353
327
  rule(:space) { match[" \r\n\t\f"] | embeddedRemark | tailRemark }
354
328
  rule(:spaces) { space.repeat.as(:spaces) }
355
329
  rule(:stmt) do
356
- (
357
- aliasStmt | assignmentStmt | caseStmt | compoundStmt | escapeStmt | ifStmt |
358
- nullStmt | procedureCallStmt | repeatStmt | returnStmt | skipStmt
359
- ).as(:stmt)
330
+ (aliasStmt | assignmentStmt | caseStmt | compoundStmt | escapeStmt | ifStmt |
331
+ nullStmt | procedureCallStmt | repeatStmt | returnStmt | skipStmt).as(:stmt)
360
332
  end
361
333
  rule(:stringLiteral) { (simpleStringLiteral | encodedStringLiteral).as(:stringLiteral) }
362
334
  rule(:stringType) { (tSTRING >> widthSpec.maybe).as(:stringType) }
@@ -399,17 +371,9 @@ module Expressir
399
371
  end
400
372
  rule(:untilControl) { (tUNTIL >> logicalExpression).as(:untilControl) }
401
373
  rule(:useClause) do
402
- (
403
- tUSE >> tFROM >> schemaRef >>
404
- (
405
- op_leftparen >> (
406
- namedTypeOrRename >> (
407
- op_comma >>
408
- namedTypeOrRename
409
- ).repeat
410
- ).as(:listOf_namedTypeOrRename) >> op_rightparen
411
- ).maybe >> op_delim
412
- ).as(:useClause)
374
+ (tUSE >> tFROM >> schemaRef >>
375
+ (op_leftparen >> (namedTypeOrRename >> (op_comma >>
376
+ namedTypeOrRename).repeat).as(:listOf_namedTypeOrRename) >> op_rightparen).maybe >> op_delim).as(:useClause)
413
377
  end
414
378
  rule(:variableId) { simpleId.as(:variableId) }
415
379
  rule(:variableRef) { variableId.as(:variableRef) }
@@ -1,5 +1,5 @@
1
- require "expressir/express/model_visitor"
2
- require "expressir/model"
1
+ require_relative "model_visitor"
2
+ require_relative "../model"
3
3
 
4
4
  module Expressir
5
5
  module Express
@@ -1,4 +1,4 @@
1
- require "expressir/model"
1
+ require_relative "../model"
2
2
  require "set"
3
3
 
4
4
  # reference type is not recognized
@@ -248,7 +248,6 @@ module Expressir
248
248
  ctx.values.map { |item| get_remarks(item, "#{indent} ") }.inject([], :+)
249
249
  when Array
250
250
  ctx.map { |item| get_remarks(item, "#{indent} ") }.inject([], :+)
251
-
252
251
  else
253
252
  if %i[tailRemark embeddedRemark].include?(ctx.name)
254
253
  [get_source_pos(ctx)]
@@ -886,9 +885,9 @@ module Expressir
886
885
 
887
886
  id = visit_if(ctx__entity_head__entity_id)
888
887
  abstract = (ctx__entity_head__subsuper__supertype_constraint__abstract_entity_declaration ||
889
- ctx__entity_head__subsuper__supertype_constraint__abstract_supertype_declaration) && true
888
+ ctx__entity_head__subsuper__supertype_constraint__abstract_supertype_declaration) && true
890
889
  supertype_expression = visit_if(ctx__entity_head__subsuper__supertype_constraint__abstract_supertype_declaration ||
891
- ctx__entity_head__subsuper__supertype_constraint__supertype_rule)
890
+ ctx__entity_head__subsuper__supertype_constraint__supertype_rule)
892
891
  subtype_of = visit_if(ctx__entity_head__subsuper__subtype_declaration, [])
893
892
  attributes = [
894
893
  *visit_if_map_flatten(ctx__entity_body__explicit_attr),
@@ -6,9 +6,9 @@ module Expressir
6
6
  class SchemaDrop < ::Expressir::Liquid::DeclarationDrop
7
7
  include ::Expressir::Liquid::IdentifierDrop
8
8
 
9
- def initialize(model, selected_schemas: nil, options: {}) # rubocop:disable Lint/MissingSuper
9
+ def initialize(model, options: {}) # rubocop:disable Lint/MissingSuper
10
10
  @model = model
11
- @selected_schemas = selected_schemas
11
+ @selected_schemas = options&.delete("selected_schemas")
12
12
  @options = options
13
13
  initialize_identifier(@model)
14
14
  super(model)
@@ -5,9 +5,8 @@ require_relative "declarations/schema_drop"
5
5
  module Expressir
6
6
  module Liquid
7
7
  class RepositoryDrop < ::Expressir::Liquid::ModelElementDrop
8
- def initialize(model, selected_schemas: nil, options: {}) # rubocop:disable Lint/MissingSuper
8
+ def initialize(model, options: {}) # rubocop:disable Lint/MissingSuper
9
9
  @model = model
10
- @selected_schemas = selected_schemas
11
10
  @options = options
12
11
  super(model)
13
12
  end
@@ -17,9 +16,7 @@ module Expressir
17
16
 
18
17
  @model.schemas.map do |item|
19
18
  ::Expressir::Liquid::Declarations::SchemaDrop.new(
20
- item,
21
- selected_schemas: @selected_schemas,
22
- options: @options,
19
+ item, options: @options
23
20
  )
24
21
  end
25
22
  end
@@ -1,17 +1,17 @@
1
1
  require "liquid"
2
2
 
3
- require "expressir/liquid/model_element_drop"
3
+ require_relative "liquid/model_element_drop"
4
4
 
5
- require "expressir/liquid/cache_drop"
6
- require "expressir/liquid/data_type_drop"
7
- require "expressir/liquid/declaration_drop"
8
- require "expressir/liquid/expression_drop"
9
- require "expressir/liquid/literal_drop"
10
- require "expressir/liquid/reference_drop"
11
- require "expressir/liquid/statement_drop"
12
- require "expressir/liquid/supertype_expression_drop"
13
- require "expressir/liquid/identifier_drop"
14
- require "expressir/liquid/repository_drop"
5
+ require_relative "liquid/cache_drop"
6
+ require_relative "liquid/data_type_drop"
7
+ require_relative "liquid/declaration_drop"
8
+ require_relative "liquid/expression_drop"
9
+ require_relative "liquid/literal_drop"
10
+ require_relative "liquid/reference_drop"
11
+ require_relative "liquid/statement_drop"
12
+ require_relative "liquid/supertype_expression_drop"
13
+ require_relative "liquid/identifier_drop"
14
+ require_relative "liquid/repository_drop"
15
15
 
16
16
  Dir[File.join(__dir__, "liquid", "**", "*.rb")].sort.each do |f|
17
17
  require f
@@ -151,19 +151,16 @@ module Expressir
151
151
  end
152
152
 
153
153
  # @return [Liquid::Drop]
154
- def to_liquid(selected_schemas: nil, options: nil)
154
+ def to_liquid(options: nil)
155
155
  klass_name = "#{self.class.name.gsub('::Model::', '::Liquid::')}Drop"
156
156
  klass = Object.const_get(klass_name)
157
- klass.new(self, selected_schemas: selected_schemas, options: options)
157
+ klass.new(self, options: options)
158
158
  end
159
159
 
160
160
  def to_s(no_remarks: false, formatter: nil)
161
- formatter ||= Class.new(Expressir::Express::Formatter) do
162
- if no_remarks
163
- def format_remarks(_node); []; end
164
- end
165
- end
166
- formatter.format(self)
161
+ f = formatter || Express::Formatter.new(no_remarks: no_remarks)
162
+ f.no_remarks = no_remarks
163
+ f.format(self)
167
164
  end
168
165
 
169
166
  # @param [Hash] hash