expressir 2.1.16 → 2.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/expressir/express/formatter.rb +135 -135
- data/lib/expressir/express/parser.rb +2 -2
- data/lib/expressir/express/visitor.rb +9 -9
- data/lib/expressir/model/model_element.rb +1 -1
- data/lib/expressir/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 277a743bb27aa72bee152d4c503292790212510a8d8b9d6fbd05b195408a5f8c
|
4
|
+
data.tar.gz: 97b97c970b4a965aeed7ee237b5fcebeda4f26e7d86b163c02b692affbd76082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ae77121b551d8105486602383ee9b3b0596dd83ad3890b2c799182a9e6947488466a9a453205eb5b3791597e00a66f6754cd56946e5025c27f6a845eb756276
|
7
|
+
data.tar.gz: 8f611d2ce48adc92acee4eaa9af7b048baf92dfef08a265780e93f98d3b273a271b97a0f13b7492bb977075e98a863590f391c407a7a1ad1a707a3b24c40d24e
|
@@ -217,26 +217,26 @@ module Expressir
|
|
217
217
|
[
|
218
218
|
format(node.supertype_attribute),
|
219
219
|
" ",
|
220
|
-
].join
|
220
|
+
].join
|
221
221
|
end,
|
222
222
|
*if node.supertype_attribute && node.id
|
223
223
|
[
|
224
224
|
"RENAMED",
|
225
225
|
" ",
|
226
|
-
].join
|
226
|
+
].join
|
227
227
|
end,
|
228
228
|
*if node.id
|
229
229
|
[
|
230
230
|
node.id,
|
231
231
|
" ",
|
232
|
-
].join
|
232
|
+
].join
|
233
233
|
end,
|
234
234
|
":",
|
235
235
|
*if node.optional
|
236
236
|
[
|
237
237
|
" ",
|
238
238
|
"OPTIONAL",
|
239
|
-
].join
|
239
|
+
].join
|
240
240
|
end,
|
241
241
|
" ",
|
242
242
|
format(node.type),
|
@@ -246,17 +246,17 @@ module Expressir
|
|
246
246
|
":=",
|
247
247
|
" ",
|
248
248
|
format(node.expression),
|
249
|
-
].join
|
249
|
+
].join
|
250
250
|
elsif node.kind == Model::Declarations::Attribute::INVERSE
|
251
251
|
[
|
252
252
|
" ",
|
253
253
|
"FOR",
|
254
254
|
" ",
|
255
255
|
format(node.expression),
|
256
|
-
].join
|
256
|
+
].join
|
257
257
|
end,
|
258
258
|
";",
|
259
|
-
].join
|
259
|
+
].join
|
260
260
|
end
|
261
261
|
|
262
262
|
def format_declarations_constant(node)
|
@@ -271,7 +271,7 @@ module Expressir
|
|
271
271
|
" ",
|
272
272
|
format(node.expression),
|
273
273
|
";",
|
274
|
-
].join
|
274
|
+
].join
|
275
275
|
end
|
276
276
|
|
277
277
|
def format_declarations_entity(node)
|
@@ -297,8 +297,8 @@ module Expressir
|
|
297
297
|
"ABSTRACT",
|
298
298
|
" ",
|
299
299
|
"SUPERTYPE",
|
300
|
-
].join
|
301
|
-
].join
|
300
|
+
].join),
|
301
|
+
].join
|
302
302
|
end,
|
303
303
|
*if node.abstract && node.supertype_expression
|
304
304
|
[
|
@@ -313,8 +313,8 @@ module Expressir
|
|
313
313
|
"(",
|
314
314
|
format(node.supertype_expression),
|
315
315
|
")",
|
316
|
-
].join
|
317
|
-
].join
|
316
|
+
].join),
|
317
|
+
].join
|
318
318
|
end,
|
319
319
|
*if !node.abstract && node.supertype_expression
|
320
320
|
[
|
@@ -327,8 +327,8 @@ module Expressir
|
|
327
327
|
"(",
|
328
328
|
format(node.supertype_expression),
|
329
329
|
")",
|
330
|
-
].join
|
331
|
-
].join
|
330
|
+
].join),
|
331
|
+
].join
|
332
332
|
end,
|
333
333
|
*if node.subtype_of&.length&.positive?
|
334
334
|
[
|
@@ -341,11 +341,11 @@ module Expressir
|
|
341
341
|
"(",
|
342
342
|
node.subtype_of.map { |x| format(x) }.join(", "),
|
343
343
|
")",
|
344
|
-
].join
|
345
|
-
].join
|
344
|
+
].join),
|
345
|
+
].join
|
346
346
|
end,
|
347
347
|
";",
|
348
|
-
].join
|
348
|
+
].join,
|
349
349
|
*if explicit_attributes&.length&.positive?
|
350
350
|
indent(explicit_attributes.map { |x| format(x) }.join("\n"))
|
351
351
|
end,
|
@@ -376,7 +376,7 @@ module Expressir
|
|
376
376
|
[
|
377
377
|
"END_ENTITY",
|
378
378
|
";",
|
379
|
-
].join
|
379
|
+
].join,
|
380
380
|
].join("\n")
|
381
381
|
end
|
382
382
|
|
@@ -392,14 +392,14 @@ module Expressir
|
|
392
392
|
"(",
|
393
393
|
node.parameters.map { |x| format(x) }.join(";\n#{parameter_indent}"),
|
394
394
|
")",
|
395
|
-
].join
|
395
|
+
].join
|
396
396
|
end,
|
397
397
|
" ",
|
398
398
|
":",
|
399
399
|
" ",
|
400
400
|
format(node.return_type),
|
401
401
|
";",
|
402
|
-
].join
|
402
|
+
].join,
|
403
403
|
*if node.types&.length&.positive?
|
404
404
|
indent(node.types.map { |x| format(x) }.join("\n"))
|
405
405
|
end,
|
@@ -422,7 +422,7 @@ module Expressir
|
|
422
422
|
[
|
423
423
|
"END_CONSTANT",
|
424
424
|
";",
|
425
|
-
].join
|
425
|
+
].join,
|
426
426
|
].join("\n"))
|
427
427
|
end,
|
428
428
|
*if node.variables&.length&.positive?
|
@@ -432,7 +432,7 @@ module Expressir
|
|
432
432
|
[
|
433
433
|
"END_LOCAL",
|
434
434
|
";",
|
435
|
-
].join
|
435
|
+
].join,
|
436
436
|
].join("\n"))
|
437
437
|
end,
|
438
438
|
*if node.statements&.length&.positive?
|
@@ -441,7 +441,7 @@ module Expressir
|
|
441
441
|
[
|
442
442
|
"END_FUNCTION",
|
443
443
|
";",
|
444
|
-
].join
|
444
|
+
].join,
|
445
445
|
].join("\n")
|
446
446
|
end
|
447
447
|
|
@@ -463,11 +463,11 @@ module Expressir
|
|
463
463
|
"(",
|
464
464
|
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
465
465
|
")",
|
466
|
-
].join
|
467
|
-
].join
|
466
|
+
].join),
|
467
|
+
].join
|
468
468
|
end,
|
469
469
|
";",
|
470
|
-
].join
|
470
|
+
].join
|
471
471
|
end
|
472
472
|
|
473
473
|
def format_declarations_interface_item(node)
|
@@ -481,7 +481,7 @@ module Expressir
|
|
481
481
|
node.id,
|
482
482
|
]
|
483
483
|
end,
|
484
|
-
].join
|
484
|
+
].join
|
485
485
|
end
|
486
486
|
|
487
487
|
def format_declarations_parameter(node)
|
@@ -490,14 +490,14 @@ module Expressir
|
|
490
490
|
[
|
491
491
|
"VAR",
|
492
492
|
" ",
|
493
|
-
].join
|
493
|
+
].join
|
494
494
|
end,
|
495
495
|
node.id,
|
496
496
|
" ",
|
497
497
|
":",
|
498
498
|
" ",
|
499
499
|
format(node.type),
|
500
|
-
].join
|
500
|
+
].join
|
501
501
|
end
|
502
502
|
|
503
503
|
def format_declarations_procedure(node)
|
@@ -512,10 +512,10 @@ module Expressir
|
|
512
512
|
"(",
|
513
513
|
node.parameters.map { |x| format(x) }.join(";\n#{parameter_indent}"),
|
514
514
|
")",
|
515
|
-
].join
|
515
|
+
].join
|
516
516
|
end,
|
517
517
|
";",
|
518
|
-
].join
|
518
|
+
].join,
|
519
519
|
*if node.types&.length&.positive?
|
520
520
|
indent(node.types.map { |x| format(x) }.join("\n"))
|
521
521
|
end,
|
@@ -538,7 +538,7 @@ module Expressir
|
|
538
538
|
[
|
539
539
|
"END_CONSTANT",
|
540
540
|
";",
|
541
|
-
].join
|
541
|
+
].join,
|
542
542
|
].join("\n"))
|
543
543
|
end,
|
544
544
|
*if node.variables&.length&.positive?
|
@@ -548,7 +548,7 @@ module Expressir
|
|
548
548
|
[
|
549
549
|
"END_LOCAL",
|
550
550
|
";",
|
551
|
-
].join
|
551
|
+
].join,
|
552
552
|
].join("\n"))
|
553
553
|
end,
|
554
554
|
*if node.statements&.length&.positive?
|
@@ -557,7 +557,7 @@ module Expressir
|
|
557
557
|
[
|
558
558
|
"END_PROCEDURE",
|
559
559
|
";",
|
560
|
-
].join
|
560
|
+
].join,
|
561
561
|
].join("\n")
|
562
562
|
end
|
563
563
|
|
@@ -575,7 +575,7 @@ module Expressir
|
|
575
575
|
node.applies_to.map { |x| format(x) }.join(", "),
|
576
576
|
")",
|
577
577
|
";",
|
578
|
-
].join
|
578
|
+
].join,
|
579
579
|
*if node.types&.length&.positive?
|
580
580
|
indent(node.types.map { |x| format(x) }.join("\n"))
|
581
581
|
end,
|
@@ -598,7 +598,7 @@ module Expressir
|
|
598
598
|
[
|
599
599
|
"END_CONSTANT",
|
600
600
|
";",
|
601
|
-
].join
|
601
|
+
].join,
|
602
602
|
].join("\n"))
|
603
603
|
end,
|
604
604
|
*if node.variables&.length&.positive?
|
@@ -608,7 +608,7 @@ module Expressir
|
|
608
608
|
[
|
609
609
|
"END_LOCAL",
|
610
610
|
";",
|
611
|
-
].join
|
611
|
+
].join,
|
612
612
|
].join("\n"))
|
613
613
|
end,
|
614
614
|
*if node.statements&.length&.positive?
|
@@ -623,7 +623,7 @@ module Expressir
|
|
623
623
|
[
|
624
624
|
"END_RULE",
|
625
625
|
";",
|
626
|
-
].join
|
626
|
+
].join,
|
627
627
|
].join("\n")
|
628
628
|
end
|
629
629
|
|
@@ -637,10 +637,10 @@ module Expressir
|
|
637
637
|
[
|
638
638
|
" ",
|
639
639
|
format(node.version),
|
640
|
-
].join
|
640
|
+
].join
|
641
641
|
end,
|
642
642
|
";",
|
643
|
-
].join
|
643
|
+
].join,
|
644
644
|
*if node.interfaces&.length&.positive?
|
645
645
|
[
|
646
646
|
"",
|
@@ -659,7 +659,7 @@ module Expressir
|
|
659
659
|
[
|
660
660
|
"END_CONSTANT",
|
661
661
|
";",
|
662
|
-
].join
|
662
|
+
].join,
|
663
663
|
].join("\n")
|
664
664
|
end,
|
665
665
|
*if node.types&.length&.positive?
|
@@ -694,7 +694,7 @@ module Expressir
|
|
694
694
|
[
|
695
695
|
"END_SCHEMA",
|
696
696
|
";",
|
697
|
-
].join
|
697
|
+
].join,
|
698
698
|
*format_scope_remarks(node),
|
699
699
|
].join("\n")
|
700
700
|
end
|
@@ -704,7 +704,7 @@ module Expressir
|
|
704
704
|
"'",
|
705
705
|
node.value,
|
706
706
|
"'",
|
707
|
-
].join
|
707
|
+
].join
|
708
708
|
end
|
709
709
|
|
710
710
|
def format_declarations_subtype_constraint(node)
|
@@ -718,14 +718,14 @@ module Expressir
|
|
718
718
|
" ",
|
719
719
|
format(node.applies_to),
|
720
720
|
";",
|
721
|
-
].join
|
721
|
+
].join,
|
722
722
|
*if node.abstract
|
723
723
|
indent([
|
724
724
|
"ABSTRACT",
|
725
725
|
" ",
|
726
726
|
"SUPERTYPE",
|
727
727
|
";",
|
728
|
-
].join
|
728
|
+
].join)
|
729
729
|
end,
|
730
730
|
*if node.total_over&.length&.positive?
|
731
731
|
indent([
|
@@ -734,18 +734,18 @@ module Expressir
|
|
734
734
|
node.total_over.map { |x| format(x) }.join(", "),
|
735
735
|
")",
|
736
736
|
";",
|
737
|
-
].join
|
737
|
+
].join)
|
738
738
|
end,
|
739
739
|
*if node.supertype_expression
|
740
740
|
indent([
|
741
741
|
format(node.supertype_expression),
|
742
742
|
";",
|
743
|
-
].join
|
743
|
+
].join)
|
744
744
|
end,
|
745
745
|
[
|
746
746
|
"END_SUBTYPE_CONSTRAINT",
|
747
747
|
";",
|
748
|
-
].join
|
748
|
+
].join,
|
749
749
|
].join("\n")
|
750
750
|
end
|
751
751
|
|
@@ -760,7 +760,7 @@ module Expressir
|
|
760
760
|
" ",
|
761
761
|
format(node.underlying_type),
|
762
762
|
";",
|
763
|
-
].join
|
763
|
+
].join,
|
764
764
|
*if node.where_rules&.length&.positive?
|
765
765
|
[
|
766
766
|
"WHERE",
|
@@ -770,7 +770,7 @@ module Expressir
|
|
770
770
|
[
|
771
771
|
"END_TYPE",
|
772
772
|
";",
|
773
|
-
].join
|
773
|
+
].join,
|
774
774
|
].join("\n")
|
775
775
|
end
|
776
776
|
|
@@ -782,11 +782,11 @@ module Expressir
|
|
782
782
|
node.id,
|
783
783
|
":",
|
784
784
|
" ",
|
785
|
-
].join
|
785
|
+
].join
|
786
786
|
end,
|
787
787
|
node.attributes.map { |x| format(x) }.join(", "),
|
788
788
|
";",
|
789
|
-
].join
|
789
|
+
].join
|
790
790
|
end
|
791
791
|
|
792
792
|
def format_declarations_variable(node)
|
@@ -802,10 +802,10 @@ module Expressir
|
|
802
802
|
":=",
|
803
803
|
" ",
|
804
804
|
format(node.expression),
|
805
|
-
].join
|
805
|
+
].join
|
806
806
|
end,
|
807
807
|
";",
|
808
|
-
].join
|
808
|
+
].join
|
809
809
|
end
|
810
810
|
|
811
811
|
def format_declarations_where_rule(node)
|
@@ -815,11 +815,11 @@ module Expressir
|
|
815
815
|
node.id,
|
816
816
|
":",
|
817
817
|
" ",
|
818
|
-
].join
|
818
|
+
].join
|
819
819
|
end,
|
820
820
|
format(node.expression),
|
821
821
|
";",
|
822
|
-
].join
|
822
|
+
].join
|
823
823
|
end
|
824
824
|
|
825
825
|
def format_expressions_aggregate_initializer(node)
|
@@ -828,7 +828,7 @@ module Expressir
|
|
828
828
|
"[",
|
829
829
|
node.items.map { |x| format(x) }.join(", "),
|
830
830
|
"]",
|
831
|
-
].join
|
831
|
+
].join
|
832
832
|
end
|
833
833
|
|
834
834
|
def format_expressions_aggregate_initializer_item(node)
|
@@ -836,7 +836,7 @@ module Expressir
|
|
836
836
|
format(node.expression),
|
837
837
|
":",
|
838
838
|
format(node.repetition),
|
839
|
-
].join
|
839
|
+
].join
|
840
840
|
end
|
841
841
|
|
842
842
|
def format_expressions_binary_expression(node)
|
@@ -885,7 +885,7 @@ module Expressir
|
|
885
885
|
*if op2_bin_exp
|
886
886
|
")"
|
887
887
|
end,
|
888
|
-
].join
|
888
|
+
].join
|
889
889
|
end
|
890
890
|
|
891
891
|
def format_expressions_entity_constructor(node)
|
@@ -895,7 +895,7 @@ module Expressir
|
|
895
895
|
"(",
|
896
896
|
node.parameters.map { |x| format(x) }.join(", "),
|
897
897
|
")",
|
898
|
-
].join
|
898
|
+
].join
|
899
899
|
end
|
900
900
|
|
901
901
|
def format_expressions_function_call(node)
|
@@ -909,7 +909,7 @@ module Expressir
|
|
909
909
|
]
|
910
910
|
end
|
911
911
|
|
912
|
-
[format(node.function), params].flatten.join
|
912
|
+
[format(node.function), params].flatten.join
|
913
913
|
end
|
914
914
|
|
915
915
|
def format_expressions_interval(node)
|
@@ -931,7 +931,7 @@ module Expressir
|
|
931
931
|
" ",
|
932
932
|
format(node.high),
|
933
933
|
"}",
|
934
|
-
].join
|
934
|
+
].join
|
935
935
|
end
|
936
936
|
|
937
937
|
def format_expressions_query_expression(node)
|
@@ -949,7 +949,7 @@ module Expressir
|
|
949
949
|
format(node.expression),
|
950
950
|
*format_remarks(node).instance_eval { |x| x&.length&.positive? ? ["\n", *x, "\n"] : x },
|
951
951
|
")",
|
952
|
-
].join
|
952
|
+
].join
|
953
953
|
end
|
954
954
|
|
955
955
|
def format_expressions_unary_expression(node)
|
@@ -969,14 +969,14 @@ module Expressir
|
|
969
969
|
*if node.operand.is_a? Model::Expressions::BinaryExpression
|
970
970
|
")"
|
971
971
|
end,
|
972
|
-
].join
|
972
|
+
].join
|
973
973
|
end
|
974
974
|
|
975
975
|
def format_literals_binary(node)
|
976
976
|
[
|
977
977
|
"%",
|
978
978
|
node.value,
|
979
|
-
].join
|
979
|
+
].join
|
980
980
|
end
|
981
981
|
|
982
982
|
def format_literals_integer(node)
|
@@ -1001,13 +1001,13 @@ module Expressir
|
|
1001
1001
|
"\"",
|
1002
1002
|
node.value,
|
1003
1003
|
"\"",
|
1004
|
-
].join
|
1004
|
+
].join
|
1005
1005
|
else
|
1006
1006
|
[
|
1007
1007
|
"'",
|
1008
1008
|
node.value,
|
1009
1009
|
"'",
|
1010
|
-
].join
|
1010
|
+
].join
|
1011
1011
|
end
|
1012
1012
|
end
|
1013
1013
|
|
@@ -1016,7 +1016,7 @@ module Expressir
|
|
1016
1016
|
format(node.ref),
|
1017
1017
|
".",
|
1018
1018
|
format(node.attribute),
|
1019
|
-
].join
|
1019
|
+
].join
|
1020
1020
|
end
|
1021
1021
|
|
1022
1022
|
def format_references_group_reference(node)
|
@@ -1024,7 +1024,7 @@ module Expressir
|
|
1024
1024
|
format(node.ref),
|
1025
1025
|
"\\",
|
1026
1026
|
format(node.entity),
|
1027
|
-
].join
|
1027
|
+
].join
|
1028
1028
|
end
|
1029
1029
|
|
1030
1030
|
def format_references_index_reference(node)
|
@@ -1036,10 +1036,10 @@ module Expressir
|
|
1036
1036
|
[
|
1037
1037
|
":",
|
1038
1038
|
format(node.index2),
|
1039
|
-
].join
|
1039
|
+
].join
|
1040
1040
|
end,
|
1041
1041
|
"]",
|
1042
|
-
].join
|
1042
|
+
].join
|
1043
1043
|
end
|
1044
1044
|
|
1045
1045
|
def format_references_simple_reference(node)
|
@@ -1057,7 +1057,7 @@ module Expressir
|
|
1057
1057
|
" ",
|
1058
1058
|
format(node.expression),
|
1059
1059
|
";",
|
1060
|
-
].join
|
1060
|
+
].join,
|
1061
1061
|
*if node.statements&.length&.positive?
|
1062
1062
|
indent(node.statements.map { |x| format(x) }.join("\n"))
|
1063
1063
|
end,
|
@@ -1065,7 +1065,7 @@ module Expressir
|
|
1065
1065
|
[
|
1066
1066
|
"END_ALIAS",
|
1067
1067
|
";",
|
1068
|
-
].join
|
1068
|
+
].join,
|
1069
1069
|
].join("\n")
|
1070
1070
|
end
|
1071
1071
|
|
@@ -1077,7 +1077,7 @@ module Expressir
|
|
1077
1077
|
" ",
|
1078
1078
|
format(node.expression),
|
1079
1079
|
";",
|
1080
|
-
].join
|
1080
|
+
].join
|
1081
1081
|
end
|
1082
1082
|
|
1083
1083
|
def format_statements_procedure_call(node)
|
@@ -1088,10 +1088,10 @@ module Expressir
|
|
1088
1088
|
"(",
|
1089
1089
|
node.parameters.map { |x| format(x) }.join(", "),
|
1090
1090
|
")",
|
1091
|
-
].join
|
1091
|
+
].join
|
1092
1092
|
end,
|
1093
1093
|
";",
|
1094
|
-
].join
|
1094
|
+
].join
|
1095
1095
|
end
|
1096
1096
|
|
1097
1097
|
def format_statements_case(node)
|
@@ -1102,7 +1102,7 @@ module Expressir
|
|
1102
1102
|
format(node.expression),
|
1103
1103
|
" ",
|
1104
1104
|
"OF",
|
1105
|
-
].join
|
1105
|
+
].join,
|
1106
1106
|
*if node.actions&.length&.positive?
|
1107
1107
|
node.actions.map { |x| format(x) }
|
1108
1108
|
end,
|
@@ -1112,14 +1112,14 @@ module Expressir
|
|
1112
1112
|
"OTHERWISE",
|
1113
1113
|
" ",
|
1114
1114
|
":",
|
1115
|
-
].join
|
1115
|
+
].join,
|
1116
1116
|
indent(format(node.otherwise_statement)),
|
1117
1117
|
]
|
1118
1118
|
end,
|
1119
1119
|
[
|
1120
1120
|
"END_CASE",
|
1121
1121
|
";",
|
1122
|
-
].join
|
1122
|
+
].join,
|
1123
1123
|
].join("\n")
|
1124
1124
|
end
|
1125
1125
|
|
@@ -1130,7 +1130,7 @@ module Expressir
|
|
1130
1130
|
node.labels.map { |x| format(x) }.join(", "),
|
1131
1131
|
" ",
|
1132
1132
|
":",
|
1133
|
-
].join
|
1133
|
+
].join,
|
1134
1134
|
indent(format(node.statement)),
|
1135
1135
|
].join("\n")
|
1136
1136
|
end
|
@@ -1145,7 +1145,7 @@ module Expressir
|
|
1145
1145
|
[
|
1146
1146
|
"END",
|
1147
1147
|
";",
|
1148
|
-
].join
|
1148
|
+
].join,
|
1149
1149
|
].join("\n")
|
1150
1150
|
end
|
1151
1151
|
|
@@ -1153,7 +1153,7 @@ module Expressir
|
|
1153
1153
|
[
|
1154
1154
|
"ESCAPE",
|
1155
1155
|
";",
|
1156
|
-
].join
|
1156
|
+
].join
|
1157
1157
|
end
|
1158
1158
|
|
1159
1159
|
def format_statements_if(node)
|
@@ -1164,7 +1164,7 @@ module Expressir
|
|
1164
1164
|
format(node.expression),
|
1165
1165
|
" ",
|
1166
1166
|
"THEN",
|
1167
|
-
].join
|
1167
|
+
].join,
|
1168
1168
|
*if node.statements&.length&.positive?
|
1169
1169
|
indent(node.statements.map { |x| format(x) }.join("\n"))
|
1170
1170
|
end,
|
@@ -1177,7 +1177,7 @@ module Expressir
|
|
1177
1177
|
[
|
1178
1178
|
"END_IF",
|
1179
1179
|
";",
|
1180
|
-
].join
|
1180
|
+
].join,
|
1181
1181
|
].join("\n")
|
1182
1182
|
end
|
1183
1183
|
|
@@ -1208,9 +1208,9 @@ module Expressir
|
|
1208
1208
|
"BY",
|
1209
1209
|
" ",
|
1210
1210
|
format(node.increment),
|
1211
|
-
].join
|
1211
|
+
].join
|
1212
1212
|
end,
|
1213
|
-
].join
|
1213
|
+
].join
|
1214
1214
|
end,
|
1215
1215
|
*if node.while_expression
|
1216
1216
|
[
|
@@ -1218,7 +1218,7 @@ module Expressir
|
|
1218
1218
|
"WHILE",
|
1219
1219
|
" ",
|
1220
1220
|
format(node.while_expression),
|
1221
|
-
].join
|
1221
|
+
].join
|
1222
1222
|
end,
|
1223
1223
|
*if node.until_expression
|
1224
1224
|
[
|
@@ -1226,10 +1226,10 @@ module Expressir
|
|
1226
1226
|
"UNTIL",
|
1227
1227
|
" ",
|
1228
1228
|
format(node.until_expression),
|
1229
|
-
].join
|
1229
|
+
].join
|
1230
1230
|
end,
|
1231
1231
|
";",
|
1232
|
-
].join
|
1232
|
+
].join,
|
1233
1233
|
*if node.statements&.length&.positive?
|
1234
1234
|
indent(node.statements.map { |x| format(x) }.join("\n"))
|
1235
1235
|
end,
|
@@ -1237,7 +1237,7 @@ module Expressir
|
|
1237
1237
|
[
|
1238
1238
|
"END_REPEAT",
|
1239
1239
|
";",
|
1240
|
-
].join
|
1240
|
+
].join,
|
1241
1241
|
].join("\n")
|
1242
1242
|
end
|
1243
1243
|
|
@@ -1250,17 +1250,17 @@ module Expressir
|
|
1250
1250
|
"(",
|
1251
1251
|
format(node.expression),
|
1252
1252
|
")",
|
1253
|
-
].join
|
1253
|
+
].join
|
1254
1254
|
end,
|
1255
1255
|
";",
|
1256
|
-
].join
|
1256
|
+
].join
|
1257
1257
|
end
|
1258
1258
|
|
1259
1259
|
def format_statements_skip(_node)
|
1260
1260
|
[
|
1261
1261
|
"SKIP",
|
1262
1262
|
";",
|
1263
|
-
].join
|
1263
|
+
].join
|
1264
1264
|
end
|
1265
1265
|
|
1266
1266
|
def format_supertype_expressions_binary_supertype_expression(node)
|
@@ -1290,7 +1290,7 @@ module Expressir
|
|
1290
1290
|
*if op2_higher_precedence
|
1291
1291
|
")"
|
1292
1292
|
end,
|
1293
|
-
].join
|
1293
|
+
].join
|
1294
1294
|
end
|
1295
1295
|
|
1296
1296
|
def format_supertype_expressions_oneof_supertype_expression(node)
|
@@ -1300,7 +1300,7 @@ module Expressir
|
|
1300
1300
|
"(",
|
1301
1301
|
node.operands.map { |x| format(x) }.join(", "),
|
1302
1302
|
")",
|
1303
|
-
].join
|
1303
|
+
].join
|
1304
1304
|
end
|
1305
1305
|
|
1306
1306
|
def format_data_types_aggregate(_node)
|
@@ -1318,7 +1318,7 @@ module Expressir
|
|
1318
1318
|
":",
|
1319
1319
|
format(node.bound2),
|
1320
1320
|
"]",
|
1321
|
-
].join
|
1321
|
+
].join
|
1322
1322
|
end,
|
1323
1323
|
" ",
|
1324
1324
|
"OF",
|
@@ -1326,17 +1326,17 @@ module Expressir
|
|
1326
1326
|
[
|
1327
1327
|
" ",
|
1328
1328
|
"OPTIONAL",
|
1329
|
-
].join
|
1329
|
+
].join
|
1330
1330
|
end,
|
1331
1331
|
*if node.unique
|
1332
1332
|
[
|
1333
1333
|
" ",
|
1334
1334
|
"UNIQUE",
|
1335
|
-
].join
|
1335
|
+
].join
|
1336
1336
|
end,
|
1337
1337
|
" ",
|
1338
1338
|
format(node.base_type),
|
1339
|
-
].join
|
1339
|
+
].join
|
1340
1340
|
end
|
1341
1341
|
|
1342
1342
|
def format_data_types_bag(node)
|
@@ -1350,13 +1350,13 @@ module Expressir
|
|
1350
1350
|
":",
|
1351
1351
|
format(node.bound2),
|
1352
1352
|
"]",
|
1353
|
-
].join
|
1353
|
+
].join
|
1354
1354
|
end,
|
1355
1355
|
" ",
|
1356
1356
|
"OF",
|
1357
1357
|
" ",
|
1358
1358
|
format(node.base_type),
|
1359
|
-
].join
|
1359
|
+
].join
|
1360
1360
|
end
|
1361
1361
|
|
1362
1362
|
def format_data_types_binary(node)
|
@@ -1368,15 +1368,15 @@ module Expressir
|
|
1368
1368
|
"(",
|
1369
1369
|
format(node.width),
|
1370
1370
|
")",
|
1371
|
-
].join
|
1371
|
+
].join
|
1372
1372
|
end,
|
1373
1373
|
*if node.fixed
|
1374
1374
|
[
|
1375
1375
|
" ",
|
1376
1376
|
"FIXED",
|
1377
|
-
].join
|
1377
|
+
].join
|
1378
1378
|
end,
|
1379
|
-
].join
|
1379
|
+
].join
|
1380
1380
|
end
|
1381
1381
|
|
1382
1382
|
def format_data_types_boolean(_node)
|
@@ -1389,7 +1389,7 @@ module Expressir
|
|
1389
1389
|
[
|
1390
1390
|
"EXTENSIBLE",
|
1391
1391
|
" ",
|
1392
|
-
].join
|
1392
|
+
].join
|
1393
1393
|
end,
|
1394
1394
|
"ENUMERATION",
|
1395
1395
|
*if node.based_on
|
@@ -1408,10 +1408,10 @@ module Expressir
|
|
1408
1408
|
"(",
|
1409
1409
|
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
1410
1410
|
")",
|
1411
|
-
].join
|
1412
|
-
].join
|
1411
|
+
].join),
|
1412
|
+
].join
|
1413
1413
|
end,
|
1414
|
-
].join
|
1414
|
+
].join
|
1415
1415
|
else
|
1416
1416
|
[
|
1417
1417
|
*if node.items&.length&.positive?
|
@@ -1424,12 +1424,12 @@ module Expressir
|
|
1424
1424
|
"(",
|
1425
1425
|
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
1426
1426
|
")",
|
1427
|
-
].join
|
1428
|
-
].join
|
1427
|
+
].join),
|
1428
|
+
].join
|
1429
1429
|
end,
|
1430
|
-
].join
|
1430
|
+
].join
|
1431
1431
|
end,
|
1432
|
-
].join
|
1432
|
+
].join
|
1433
1433
|
end
|
1434
1434
|
|
1435
1435
|
def format_data_types_enumeration_item(node)
|
@@ -1445,7 +1445,7 @@ module Expressir
|
|
1445
1445
|
node.id,
|
1446
1446
|
]
|
1447
1447
|
end,
|
1448
|
-
].join
|
1448
|
+
].join
|
1449
1449
|
end
|
1450
1450
|
|
1451
1451
|
def format_data_types_generic(node)
|
@@ -1457,7 +1457,7 @@ module Expressir
|
|
1457
1457
|
node.id,
|
1458
1458
|
]
|
1459
1459
|
end,
|
1460
|
-
].join
|
1460
|
+
].join
|
1461
1461
|
end
|
1462
1462
|
|
1463
1463
|
def format_data_types_integer(_node)
|
@@ -1475,7 +1475,7 @@ module Expressir
|
|
1475
1475
|
":",
|
1476
1476
|
format(node.bound2),
|
1477
1477
|
"]",
|
1478
|
-
].join
|
1478
|
+
].join
|
1479
1479
|
end,
|
1480
1480
|
" ",
|
1481
1481
|
"OF",
|
@@ -1483,11 +1483,11 @@ module Expressir
|
|
1483
1483
|
[
|
1484
1484
|
" ",
|
1485
1485
|
"UNIQUE",
|
1486
|
-
].join
|
1486
|
+
].join
|
1487
1487
|
end,
|
1488
1488
|
" ",
|
1489
1489
|
format(node.base_type),
|
1490
|
-
].join
|
1490
|
+
].join
|
1491
1491
|
end
|
1492
1492
|
|
1493
1493
|
def format_data_types_logical(_node)
|
@@ -1507,9 +1507,9 @@ module Expressir
|
|
1507
1507
|
"(",
|
1508
1508
|
format(node.precision),
|
1509
1509
|
")",
|
1510
|
-
].join
|
1510
|
+
].join
|
1511
1511
|
end,
|
1512
|
-
].join
|
1512
|
+
].join
|
1513
1513
|
end
|
1514
1514
|
|
1515
1515
|
def format_data_types_select(node)
|
@@ -1519,13 +1519,13 @@ module Expressir
|
|
1519
1519
|
[
|
1520
1520
|
"EXTENSIBLE",
|
1521
1521
|
" ",
|
1522
|
-
].join
|
1522
|
+
].join
|
1523
1523
|
end,
|
1524
1524
|
*if node.generic_entity
|
1525
1525
|
[
|
1526
1526
|
"GENERIC_ENTITY",
|
1527
1527
|
" ",
|
1528
|
-
].join
|
1528
|
+
].join
|
1529
1529
|
end,
|
1530
1530
|
"SELECT",
|
1531
1531
|
*if node.based_on
|
@@ -1544,10 +1544,10 @@ module Expressir
|
|
1544
1544
|
"(",
|
1545
1545
|
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
1546
1546
|
")",
|
1547
|
-
].join
|
1548
|
-
].join
|
1547
|
+
].join),
|
1548
|
+
].join
|
1549
1549
|
end,
|
1550
|
-
].join
|
1550
|
+
].join
|
1551
1551
|
else
|
1552
1552
|
[
|
1553
1553
|
*if node.items&.length&.positive?
|
@@ -1558,12 +1558,12 @@ module Expressir
|
|
1558
1558
|
"(",
|
1559
1559
|
node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
|
1560
1560
|
")",
|
1561
|
-
].join
|
1562
|
-
].join
|
1561
|
+
].join),
|
1562
|
+
].join
|
1563
1563
|
end,
|
1564
|
-
].join
|
1564
|
+
].join
|
1565
1565
|
end,
|
1566
|
-
].join
|
1566
|
+
].join
|
1567
1567
|
end
|
1568
1568
|
|
1569
1569
|
def format_data_types_set(node)
|
@@ -1577,13 +1577,13 @@ module Expressir
|
|
1577
1577
|
":",
|
1578
1578
|
format(node.bound2),
|
1579
1579
|
"]",
|
1580
|
-
].join
|
1580
|
+
].join
|
1581
1581
|
end,
|
1582
1582
|
" ",
|
1583
1583
|
"OF",
|
1584
1584
|
" ",
|
1585
1585
|
format(node.base_type),
|
1586
|
-
].join
|
1586
|
+
].join
|
1587
1587
|
end
|
1588
1588
|
|
1589
1589
|
def format_data_types_string(node)
|
@@ -1595,15 +1595,15 @@ module Expressir
|
|
1595
1595
|
"(",
|
1596
1596
|
format(node.width),
|
1597
1597
|
")",
|
1598
|
-
].join
|
1598
|
+
].join
|
1599
1599
|
end,
|
1600
1600
|
*if node.fixed
|
1601
1601
|
[
|
1602
1602
|
" ",
|
1603
1603
|
"FIXED",
|
1604
|
-
].join
|
1604
|
+
].join
|
1605
1605
|
end,
|
1606
|
-
].join
|
1606
|
+
].join
|
1607
1607
|
end
|
1608
1608
|
|
1609
1609
|
def indent(str)
|
@@ -1620,7 +1620,7 @@ module Expressir
|
|
1620
1620
|
'"',
|
1621
1621
|
node.path || node.id,
|
1622
1622
|
'"',
|
1623
|
-
].join
|
1623
|
+
].join,
|
1624
1624
|
remark,
|
1625
1625
|
"*)",
|
1626
1626
|
].join("\n")
|
@@ -1632,7 +1632,7 @@ module Expressir
|
|
1632
1632
|
'"',
|
1633
1633
|
" ",
|
1634
1634
|
remark,
|
1635
|
-
].join
|
1635
|
+
].join
|
1636
1636
|
end
|
1637
1637
|
end
|
1638
1638
|
|
@@ -32,7 +32,7 @@ module Expressir
|
|
32
32
|
].freeze
|
33
33
|
|
34
34
|
def keyword_rule(str)
|
35
|
-
key_chars = str.to_s.split(
|
35
|
+
key_chars = str.to_s.split("")
|
36
36
|
key_chars
|
37
37
|
.collect! { |char| match("[#{char}#{char.downcase}]") }
|
38
38
|
.reduce(:>>) >> match["a-zA-Z0-9_"].absent?
|
@@ -347,7 +347,7 @@ module Expressir
|
|
347
347
|
rule(:supertypeRule) { (tSUPERTYPE >> subtypeConstraint).as(:supertypeRule) }
|
348
348
|
rule(:supertypeTerm) { (entityRef | oneOf | op_leftparen >> supertypeExpression >> op_rightparen).as(:supertypeTerm) }
|
349
349
|
rule(:syntax) { (spaces.as(:spaces) >> schemaDecl.repeat(1).as(:schemaDecl) >> spaces.as(:trailer)).as(:syntax) }
|
350
|
-
rule(:tailRemark) { (str("--") >> (str("\n").absent? >> any).repeat >> str("\n")).as(:tailRemark) }
|
350
|
+
rule(:tailRemark) { (str("--") >> (str("\n").absent? >> any).repeat >> str("\n").maybe).as(:tailRemark) }
|
351
351
|
rule(:term) { (factor >> (multiplicationLikeOp >> factor).as(:item).repeat.as(:rhs)).as(:term) }
|
352
352
|
rule(:totalOver) do
|
353
353
|
(tTOTAL_OVER >> op_leftparen >> (entityRef >> (op_comma >> entityRef).repeat).as(:listOf_entityRef) >> op_rightparen >> op_delim).as(:totalOver)
|
@@ -252,9 +252,9 @@ module Expressir
|
|
252
252
|
def get_remarks(ctx, indent = "")
|
253
253
|
case ctx
|
254
254
|
when Ctx
|
255
|
-
ctx.values.
|
255
|
+
ctx.values.sum([]) { |item| get_remarks(item, "#{indent} ") }
|
256
256
|
when Array
|
257
|
-
ctx.
|
257
|
+
ctx.sum([]) { |item| get_remarks(item, "#{indent} ") }
|
258
258
|
else
|
259
259
|
if %i[tailRemark embeddedRemark].include?(ctx.name)
|
260
260
|
[get_source_pos(ctx)]
|
@@ -2100,7 +2100,7 @@ module Expressir
|
|
2100
2100
|
value = value.value
|
2101
2101
|
|
2102
2102
|
items = if value.start_with?("{") && value.end_with?("}")
|
2103
|
-
parts = value.sub(/^\{/, "").sub(/\}$/, "").split
|
2103
|
+
parts = value.sub(/^\{/, "").sub(/\}$/, "").split
|
2104
2104
|
parts.map do |part|
|
2105
2105
|
if match = part.match(/^(.+)\((\d+)\)$/)
|
2106
2106
|
Model::Declarations::SchemaVersionItem.new(
|
@@ -2186,8 +2186,8 @@ module Expressir
|
|
2186
2186
|
if ctx__term
|
2187
2187
|
if ctx__term.length >= 2
|
2188
2188
|
if ctx__add_like_op && (ctx__add_like_op.length == ctx__term.length - 1)
|
2189
|
-
operands = ctx__term.map(
|
2190
|
-
operators = ctx__add_like_op.map(
|
2189
|
+
operands = ctx__term.map { |item| visit(item) }
|
2190
|
+
operators = ctx__add_like_op.map { |item| visit(item) }
|
2191
2191
|
|
2192
2192
|
handle_binary_expression(operands, operators)
|
2193
2193
|
else
|
@@ -2365,7 +2365,7 @@ module Expressir
|
|
2365
2365
|
if ctx__supertype_factor
|
2366
2366
|
if ctx__supertype_factor.length >= 2
|
2367
2367
|
if ctx__ANDOR && (ctx__ANDOR.length == ctx__supertype_factor.length - 1)
|
2368
|
-
operands = ctx__supertype_factor.map(
|
2368
|
+
operands = ctx__supertype_factor.map { |item| visit(item) }
|
2369
2369
|
operators = ctx__ANDOR.map { Model::SupertypeExpressions::BinarySupertypeExpression::ANDOR }
|
2370
2370
|
|
2371
2371
|
handle_binary_supertype_expression(operands, operators)
|
@@ -2387,7 +2387,7 @@ module Expressir
|
|
2387
2387
|
if ctx__supertype_term
|
2388
2388
|
if ctx__supertype_term.length >= 2
|
2389
2389
|
if ctx__AND && (ctx__AND.length == ctx__supertype_term.length - 1)
|
2390
|
-
operands = ctx__supertype_term.map(
|
2390
|
+
operands = ctx__supertype_term.map { |item| visit(item) }
|
2391
2391
|
operators = ctx__AND.map { Model::SupertypeExpressions::BinarySupertypeExpression::AND }
|
2392
2392
|
|
2393
2393
|
handle_binary_supertype_expression(operands, operators)
|
@@ -2433,8 +2433,8 @@ module Expressir
|
|
2433
2433
|
if ctx__factor
|
2434
2434
|
if ctx__factor.length >= 2
|
2435
2435
|
if ctx__multiplication_like_op && (ctx__multiplication_like_op.length == ctx__factor.length - 1)
|
2436
|
-
operands = ctx__factor.map(
|
2437
|
-
operators = ctx__multiplication_like_op.map(
|
2436
|
+
operands = ctx__factor.map { |item| visit(item) }
|
2437
|
+
operators = ctx__multiplication_like_op.map { |item| visit(item) }
|
2438
2438
|
|
2439
2439
|
handle_binary_expression(operands, operators)
|
2440
2440
|
else
|
@@ -198,7 +198,7 @@ module Expressir
|
|
198
198
|
def find(path)
|
199
199
|
return self if path.empty?
|
200
200
|
|
201
|
-
path_parts = path.safe_downcase.split(
|
201
|
+
path_parts = path.safe_downcase.split(".").map do |current_path|
|
202
202
|
_, _, current_path = current_path.rpartition(":") # ignore prefix
|
203
203
|
current_path
|
204
204
|
end
|
data/lib/expressir/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: expressir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|