expressir 2.1.21 → 2.1.23

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.
@@ -91,6 +91,8 @@ module Expressir
91
91
  format_declarations_variable(node)
92
92
  when Model::Declarations::WhereRule
93
93
  format_declarations_where_rule(node)
94
+ when Model::Declarations::InformalPropositionRule
95
+ format_declarations_informal_proposition_rule(node)
94
96
  when Model::DataTypes::Aggregate
95
97
  format_data_types_aggregate(node)
96
98
  when Model::DataTypes::Array
@@ -283,9 +285,15 @@ module Expressir
283
285
  derived_attributes = []
284
286
  inverse_attributes = []
285
287
  else
286
- explicit_attributes = node.attributes.select { |x| x.kind == Model::Declarations::Attribute::EXPLICIT }
287
- derived_attributes = node.attributes.select { |x| x.kind == Model::Declarations::Attribute::DERIVED }
288
- inverse_attributes = node.attributes.select { |x| x.kind == Model::Declarations::Attribute::INVERSE }
288
+ explicit_attributes = node.attributes.select do |x|
289
+ x.kind == Model::Declarations::Attribute::EXPLICIT
290
+ end
291
+ derived_attributes = node.attributes.select do |x|
292
+ x.kind == Model::Declarations::Attribute::DERIVED
293
+ end
294
+ inverse_attributes = node.attributes.select do |x|
295
+ x.kind == Model::Declarations::Attribute::INVERSE
296
+ end
289
297
  end
290
298
 
291
299
  [
@@ -393,7 +401,9 @@ module Expressir
393
401
  parameter_indent = INDENT_CHAR * "FUNCTION #{node.id}(".length
394
402
  [
395
403
  "(",
396
- node.parameters.map { |x| format(x) }.join(";\n#{parameter_indent}"),
404
+ node.parameters.map do |x|
405
+ format(x)
406
+ end.join(";\n#{parameter_indent}"),
397
407
  ")",
398
408
  ].join
399
409
  end,
@@ -513,7 +523,9 @@ module Expressir
513
523
  parameter_indent = INDENT_CHAR * "PROCEDURE #{node.id}(".length
514
524
  [
515
525
  "(",
516
- node.parameters.map { |x| format(x) }.join(";\n#{parameter_indent}"),
526
+ node.parameters.map do |x|
527
+ format(x)
528
+ end.join(";\n#{parameter_indent}"),
517
529
  ")",
518
530
  ].join
519
531
  end,
@@ -825,6 +837,18 @@ module Expressir
825
837
  ].join
826
838
  end
827
839
 
840
+ def format_declarations_informal_proposition_rule(node)
841
+ [
842
+ *if node.id
843
+ [
844
+ node.id,
845
+ ":",
846
+ " ",
847
+ ].join
848
+ end,
849
+ ].join
850
+ end
851
+
828
852
  def format_expressions_aggregate_initializer(node)
829
853
  node.items ||= []
830
854
  [
@@ -912,7 +936,7 @@ module Expressir
912
936
  ]
913
937
  end
914
938
 
915
- [format(node.function), params].flatten.join
939
+ [format(node.function), params].join
916
940
  end
917
941
 
918
942
  def format_expressions_interval(node)
@@ -950,7 +974,9 @@ module Expressir
950
974
  "|",
951
975
  " ",
952
976
  format(node.expression),
953
- *format_remarks(node).instance_eval { |x| x&.length&.positive? ? ["\n", *x, "\n"] : x },
977
+ *format_remarks(node).instance_eval do |x|
978
+ x&.length&.positive? ? ["\n", *x, "\n"] : x
979
+ end,
954
980
  ")",
955
981
  ].join
956
982
  end
@@ -1409,7 +1435,9 @@ module Expressir
1409
1435
  "\n",
1410
1436
  indent([
1411
1437
  "(",
1412
- node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
1438
+ node.items.map do |x|
1439
+ format(x)
1440
+ end.join(",\n#{item_indent}"),
1413
1441
  ")",
1414
1442
  ].join),
1415
1443
  ].join
@@ -1425,7 +1453,9 @@ module Expressir
1425
1453
  "\n",
1426
1454
  indent([
1427
1455
  "(",
1428
- node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
1456
+ node.items.map do |x|
1457
+ format(x)
1458
+ end.join(",\n#{item_indent}"),
1429
1459
  ")",
1430
1460
  ].join),
1431
1461
  ].join
@@ -1545,7 +1575,9 @@ module Expressir
1545
1575
  "\n",
1546
1576
  indent([
1547
1577
  "(",
1548
- node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
1578
+ node.items.map do |x|
1579
+ format(x)
1580
+ end.join(",\n#{item_indent}"),
1549
1581
  ")",
1550
1582
  ].join),
1551
1583
  ].join
@@ -1559,7 +1591,9 @@ module Expressir
1559
1591
  "\n",
1560
1592
  indent([
1561
1593
  "(",
1562
- node.items.map { |x| format(x) }.join(",\n#{item_indent}"),
1594
+ node.items.map do |x|
1595
+ format(x)
1596
+ end.join(",\n#{item_indent}"),
1563
1597
  ")",
1564
1598
  ].join),
1565
1599
  ].join
@@ -1627,6 +1661,14 @@ module Expressir
1627
1661
  remark,
1628
1662
  "*)",
1629
1663
  ].join("\n")
1664
+ elsif node.path.nil? && node.id.include?("IP")
1665
+ # Handle inmediate informal propositions
1666
+ [
1667
+ "--",
1668
+ node.id,
1669
+ " ",
1670
+ remark,
1671
+ ].join
1630
1672
  else
1631
1673
  # Handle tail remarks
1632
1674
  [
@@ -1661,7 +1703,7 @@ module Expressir
1661
1703
  # Add tagged remarks
1662
1704
  if node.class.method_defined?(:remarks) && !@no_remarks &&
1663
1705
  !node.remarks.nil?
1664
- remarks.concat(node.remarks.map do |remark|
1706
+ remarks.concat(node.remarks.compact.map do |remark|
1665
1707
  format_remark(node, remark)
1666
1708
  end)
1667
1709
  end
@@ -9,7 +9,8 @@ module Expressir
9
9
  # @!visibility private
10
10
  def self.included(mod)
11
11
  if !mod.superclass.private_method_defined? :format_references_simple_reference
12
- raise Error::FormatterMethodMissingError.new("HyperlinkFormatter", "format_references_simple_reference")
12
+ raise Error::FormatterMethodMissingError.new("HyperlinkFormatter",
13
+ "format_references_simple_reference")
13
14
  end
14
15
  end
15
16