expressir 0.2.9-x86-linux → 0.2.10-x86-linux

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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/lib/expressir/express_exp/formatter.rb +71 -16
  3. data/lib/expressir/express_exp/visitor.rb +95 -41
  4. data/lib/expressir/model.rb +2 -0
  5. data/lib/expressir/model/attribute.rb +3 -1
  6. data/lib/expressir/model/constant.rb +3 -1
  7. data/lib/expressir/model/entity.rb +11 -21
  8. data/lib/expressir/model/enumeration_item.rb +3 -1
  9. data/lib/expressir/model/expressions/aggregate_initializer.rb +2 -2
  10. data/lib/expressir/model/expressions/aggregate_item.rb +1 -1
  11. data/lib/expressir/model/expressions/attribute_reference.rb +1 -1
  12. data/lib/expressir/model/expressions/binary_expression.rb +1 -1
  13. data/lib/expressir/model/expressions/call.rb +2 -2
  14. data/lib/expressir/model/expressions/entity_constructor.rb +2 -2
  15. data/lib/expressir/model/expressions/group_reference.rb +1 -1
  16. data/lib/expressir/model/expressions/index_reference.rb +1 -1
  17. data/lib/expressir/model/expressions/interval.rb +1 -1
  18. data/lib/expressir/model/expressions/query_expression.rb +3 -1
  19. data/lib/expressir/model/expressions/simple_reference.rb +1 -1
  20. data/lib/expressir/model/expressions/unary_expression.rb +1 -1
  21. data/lib/expressir/model/function.rb +32 -38
  22. data/lib/expressir/model/identifier.rb +1 -2
  23. data/lib/expressir/model/informal_proposition.rb +3 -1
  24. data/lib/expressir/model/interface.rb +2 -2
  25. data/lib/expressir/model/literals/binary.rb +1 -1
  26. data/lib/expressir/model/literals/integer.rb +1 -1
  27. data/lib/expressir/model/literals/logical.rb +1 -1
  28. data/lib/expressir/model/literals/real.rb +1 -1
  29. data/lib/expressir/model/literals/string.rb +1 -1
  30. data/lib/expressir/model/model_element.rb +67 -0
  31. data/lib/expressir/model/parameter.rb +3 -1
  32. data/lib/expressir/model/procedure.rb +33 -39
  33. data/lib/expressir/model/renamed_ref.rb +1 -1
  34. data/lib/expressir/model/repository.rb +3 -3
  35. data/lib/expressir/model/rule.rb +34 -40
  36. data/lib/expressir/model/schema.rb +35 -48
  37. data/lib/expressir/model/scope.rb +0 -3
  38. data/lib/expressir/model/statements/alias.rb +4 -2
  39. data/lib/expressir/model/statements/assignment.rb +1 -1
  40. data/lib/expressir/model/statements/call.rb +2 -2
  41. data/lib/expressir/model/statements/case.rb +2 -2
  42. data/lib/expressir/model/statements/case_action.rb +2 -2
  43. data/lib/expressir/model/statements/compound.rb +2 -2
  44. data/lib/expressir/model/statements/escape.rb +1 -1
  45. data/lib/expressir/model/statements/if.rb +3 -3
  46. data/lib/expressir/model/statements/null.rb +1 -1
  47. data/lib/expressir/model/statements/repeat.rb +4 -2
  48. data/lib/expressir/model/statements/return.rb +1 -1
  49. data/lib/expressir/model/statements/skip.rb +1 -1
  50. data/lib/expressir/model/subtype_constraint.rb +3 -1
  51. data/lib/expressir/model/type.rb +7 -5
  52. data/lib/expressir/model/types/aggregate.rb +3 -1
  53. data/lib/expressir/model/types/array.rb +1 -1
  54. data/lib/expressir/model/types/bag.rb +1 -1
  55. data/lib/expressir/model/types/binary.rb +1 -1
  56. data/lib/expressir/model/types/boolean.rb +1 -1
  57. data/lib/expressir/model/types/enumeration.rb +3 -3
  58. data/lib/expressir/model/types/generic.rb +3 -1
  59. data/lib/expressir/model/types/generic_entity.rb +3 -1
  60. data/lib/expressir/model/types/integer.rb +1 -1
  61. data/lib/expressir/model/types/list.rb +1 -1
  62. data/lib/expressir/model/types/logical.rb +1 -1
  63. data/lib/expressir/model/types/number.rb +1 -1
  64. data/lib/expressir/model/types/real.rb +1 -1
  65. data/lib/expressir/model/types/select.rb +3 -3
  66. data/lib/expressir/model/types/set.rb +1 -1
  67. data/lib/expressir/model/types/string.rb +1 -1
  68. data/lib/expressir/model/unique.rb +4 -2
  69. data/lib/expressir/model/variable.rb +3 -1
  70. data/lib/expressir/model/where.rb +3 -1
  71. data/lib/expressir/version.rb +1 -1
  72. data/original/examples/syntax/remark_formatted.exp +0 -5
  73. data/original/examples/syntax/simple.exp +3 -0
  74. data/original/examples/syntax/syntax.exp +189 -181
  75. data/original/examples/syntax/syntax_formatted.exp +346 -792
  76. data/spec/expressir/express_exp/head_source_spec.rb +1 -4
  77. data/spec/expressir/express_exp/parse_remark_spec.rb +3 -3
  78. data/spec/expressir/express_exp/parse_syntax_spec.rb +1583 -1578
  79. data/spec/expressir/express_exp/source_spec.rb +1 -4
  80. data/spec/expressir/model/model_element_spec.rb +59 -0
  81. data/spec/expressir/model/{find_spec.rb → scope_spec.rb} +1 -1
  82. metadata +6 -3
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Assignment
4
+ class Assignment < ModelElement
5
5
  attr_accessor :ref
6
6
  attr_accessor :expression
7
7
 
@@ -1,13 +1,13 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Call
4
+ class Call < ModelElement
5
5
  attr_accessor :ref
6
6
  attr_accessor :parameters
7
7
 
8
8
  def initialize(options = {})
9
9
  @ref = options[:ref]
10
- @parameters = options[:parameters]
10
+ @parameters = options.fetch(:parameters, [])
11
11
  end
12
12
  end
13
13
  end
@@ -1,14 +1,14 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Case
4
+ class Case < ModelElement
5
5
  attr_accessor :expression
6
6
  attr_accessor :actions
7
7
  attr_accessor :otherwise_statement
8
8
 
9
9
  def initialize(options = {})
10
10
  @expression = options[:expression]
11
- @actions = options[:actions]
11
+ @actions = options.fetch(:actions, [])
12
12
  @otherwise_statement = options[:otherwise_statement]
13
13
  end
14
14
  end
@@ -1,12 +1,12 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class CaseAction
4
+ class CaseAction < ModelElement
5
5
  attr_accessor :labels
6
6
  attr_accessor :statement
7
7
 
8
8
  def initialize(options = {})
9
- @labels = options[:labels]
9
+ @labels = options.fetch(:labels, [])
10
10
  @statement = options[:statement]
11
11
  end
12
12
  end
@@ -1,11 +1,11 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Compound
4
+ class Compound < ModelElement
5
5
  attr_accessor :statements
6
6
 
7
7
  def initialize(options = {})
8
- @statements = options[:statements]
8
+ @statements = options.fetch(:statements, [])
9
9
  end
10
10
  end
11
11
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Escape
4
+ class Escape < ModelElement
5
5
  end
6
6
  end
7
7
  end
@@ -1,15 +1,15 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class If
4
+ class If < ModelElement
5
5
  attr_accessor :expression
6
6
  attr_accessor :statements
7
7
  attr_accessor :else_statements
8
8
 
9
9
  def initialize(options = {})
10
10
  @expression = options[:expression]
11
- @statements = options[:statements]
12
- @else_statements = options[:else_statements]
11
+ @statements = options.fetch(:statements, [])
12
+ @else_statements = options.fetch(:else_statements, [])
13
13
  end
14
14
  end
15
15
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Null
4
+ class Null < ModelElement
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Repeat
4
+ class Repeat < ModelElement
5
5
  include Scope
6
6
  include Identifier
7
7
 
@@ -14,13 +14,15 @@ module Expressir
14
14
 
15
15
  def initialize(options = {})
16
16
  @id = options[:id]
17
+ @remarks = options.fetch(:remarks, [])
18
+ @source = options[:source]
17
19
 
18
20
  @bound1 = options[:bound1]
19
21
  @bound2 = options[:bound2]
20
22
  @increment = options[:increment]
21
23
  @while_expression = options[:while_expression]
22
24
  @until_expression = options[:until_expression]
23
- @statements = options[:statements]
25
+ @statements = options.fetch(:statements, [])
24
26
  end
25
27
 
26
28
  def children
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Return
4
+ class Return < ModelElement
5
5
  attr_accessor :expression
6
6
 
7
7
  def initialize(options = {})
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Statements
4
- class Skip
4
+ class Skip < ModelElement
5
5
  end
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class SubtypeConstraint
3
+ class SubtypeConstraint < ModelElement
4
4
  include Scope
5
5
  include Identifier
6
6
 
@@ -11,6 +11,8 @@ module Expressir
11
11
 
12
12
  def initialize(options = {})
13
13
  @id = options[:id]
14
+ @remarks = options.fetch(:remarks, [])
15
+ @source = options[:source]
14
16
 
15
17
  @applies_to = options[:applies_to]
16
18
  @abstract = options[:abstract]
@@ -1,6 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class Type
3
+ class Type < ModelElement
4
4
  include Scope
5
5
  include Identifier
6
6
 
@@ -10,10 +10,12 @@ module Expressir
10
10
 
11
11
  def initialize(options = {})
12
12
  @id = options[:id]
13
+ @remarks = options.fetch(:remarks, [])
14
+ @source = options[:source]
13
15
 
14
16
  @type = options[:type]
15
- @where = options[:where]
16
- @informal_propositions = options[:informal_propositions]
17
+ @where = options.fetch(:where, [])
18
+ @informal_propositions = options.fetch(:informal_propositions, [])
17
19
  end
18
20
 
19
21
  def children
@@ -23,8 +25,8 @@ module Expressir
23
25
  @type.items
24
26
  end
25
27
  ])
26
- items.push(*@where) if @where
27
- items.push(*@informal_propositions) if @informal_propositions
28
+ items.push(*@where)
29
+ items.push(*@informal_propositions)
28
30
  items
29
31
  end
30
32
  end
@@ -1,13 +1,15 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Aggregate
4
+ class Aggregate < ModelElement
5
5
  include Identifier
6
6
 
7
7
  attr_accessor :base_type
8
8
 
9
9
  def initialize(options = {})
10
10
  @id = options[:id]
11
+ @remarks = options.fetch(:remarks, [])
12
+ @source = options[:source]
11
13
 
12
14
  @base_type = options[:base_type]
13
15
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Array
4
+ class Array < ModelElement
5
5
  attr_accessor :bound1
6
6
  attr_accessor :bound2
7
7
  attr_accessor :optional
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Bag
4
+ class Bag < ModelElement
5
5
  attr_accessor :bound1
6
6
  attr_accessor :bound2
7
7
  attr_accessor :base_type
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Binary
4
+ class Binary < ModelElement
5
5
  attr_accessor :width
6
6
  attr_accessor :fixed
7
7
 
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Boolean
4
+ class Boolean < ModelElement
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Enumeration
4
+ class Enumeration < ModelElement
5
5
  attr_accessor :extensible
6
6
  attr_accessor :items
7
7
  attr_accessor :extension_type
@@ -9,9 +9,9 @@ module Expressir
9
9
 
10
10
  def initialize(options = {})
11
11
  @extensible = options[:extensible]
12
- @items = options[:items]
12
+ @items = options.fetch(:items, [])
13
13
  @extension_type = options[:extension_type]
14
- @extension_items = options[:extension_items]
14
+ @extension_items = options.fetch(:extension_items, [])
15
15
  end
16
16
  end
17
17
  end
@@ -1,11 +1,13 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Generic
4
+ class Generic < ModelElement
5
5
  include Identifier
6
6
 
7
7
  def initialize(options = {})
8
8
  @id = options[:id]
9
+ @remarks = options.fetch(:remarks, [])
10
+ @source = options[:source]
9
11
  end
10
12
  end
11
13
  end
@@ -1,11 +1,13 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class GenericEntity
4
+ class GenericEntity < ModelElement
5
5
  include Identifier
6
6
 
7
7
  def initialize(options = {})
8
8
  @id = options[:id]
9
+ @remarks = options.fetch(:remarks, [])
10
+ @source = options[:source]
9
11
  end
10
12
  end
11
13
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Integer
4
+ class Integer < ModelElement
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class List
4
+ class List < ModelElement
5
5
  attr_accessor :bound1
6
6
  attr_accessor :bound2
7
7
  attr_accessor :unique
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Logical
4
+ class Logical < ModelElement
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Number
4
+ class Number < ModelElement
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Real
4
+ class Real < ModelElement
5
5
  attr_accessor :precision
6
6
 
7
7
  def initialize(options = {})
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Select
4
+ class Select < ModelElement
5
5
  attr_accessor :extensible
6
6
  attr_accessor :generic_entity
7
7
  attr_accessor :items
@@ -11,9 +11,9 @@ module Expressir
11
11
  def initialize(options = {})
12
12
  @extensible = options[:extensible]
13
13
  @generic_entity = options[:generic_entity]
14
- @items = options[:items]
14
+ @items = options.fetch(:items, [])
15
15
  @extension_type = options[:extension_type]
16
- @extension_items = options[:extension_items]
16
+ @extension_items = options.fetch(:extension_items, [])
17
17
  end
18
18
  end
19
19
  end
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class Set
4
+ class Set < ModelElement
5
5
  attr_accessor :bound1
6
6
  attr_accessor :bound2
7
7
  attr_accessor :base_type
@@ -1,7 +1,7 @@
1
1
  module Expressir
2
2
  module Model
3
3
  module Types
4
- class String
4
+ class String < ModelElement
5
5
  attr_accessor :width
6
6
  attr_accessor :fixed
7
7
 
@@ -1,14 +1,16 @@
1
1
  module Expressir
2
2
  module Model
3
- class Unique
3
+ class Unique < ModelElement
4
4
  include Identifier
5
5
 
6
6
  attr_accessor :attributes
7
7
 
8
8
  def initialize(options = {})
9
9
  @id = options[:id]
10
+ @remarks = options.fetch(:remarks, [])
11
+ @source = options[:source]
10
12
 
11
- @attributes = options[:attributes]
13
+ @attributes = options.fetch(:attributes, [])
12
14
  end
13
15
  end
14
16
  end
@@ -1,6 +1,6 @@
1
1
  module Expressir
2
2
  module Model
3
- class Variable
3
+ class Variable < ModelElement
4
4
  include Identifier
5
5
 
6
6
  attr_accessor :type
@@ -8,6 +8,8 @@ module Expressir
8
8
 
9
9
  def initialize(options = {})
10
10
  @id = options[:id]
11
+ @remarks = options.fetch(:remarks, [])
12
+ @source = options[:source]
11
13
 
12
14
  @type = options[:type]
13
15
  @expression = options[:expression]