sfp 0.3.13 → 0.3.14

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.13
1
+ 0.3.14
data/lib/sfp/Sfplib.rb CHANGED
@@ -183,17 +183,30 @@ module Sfp
183
183
  @path = path
184
184
  @type = type
185
185
  end
186
+
186
187
  def to_s
187
- (@path.nil? ? "<sfp::undefined[#{type}]>" : "<sfp::undefined[#{type}][#{@path}]>")
188
+ (@path.nil? ? "<sfp::undefined[#{@type}]>" : "<sfp::undefined[#{@type}][#{@path}]>")
188
189
  end
189
190
  end
190
191
 
191
192
  # Instance of this class will be return as the value of an unknown variable
192
193
  # in open-world assumption.
193
194
  class Unknown
194
- attr_accessor :path
195
- def initialize(path=nil); @path = path; end
196
- def to_s; (@path.nil? ? "<sfp::unknown>" : "<sfp::unknown[#{@path}]>"); end
195
+ def self.create(type)
196
+ @@list = {} if !defined? @@list
197
+ return @@list[type] if @@list.has_key?(type)
198
+ (@@list[type] = Unknown.new(nil, type))
199
+ end
200
+
201
+ attr_accessor :path, :type
202
+ def initialize(path=nil, type=nil)
203
+ @path = path
204
+ @type = type
205
+ end
206
+
207
+ def to_s
208
+ (@path.nil? ? "<sfp::unknown[#{@type}]>" : "<sfp::unknown[#{@type}][#{@path}]]>")
209
+ end
197
210
  end
198
211
 
199
212
  class Any
@@ -1612,7 +1612,7 @@ module Sfp
1612
1612
  end
1613
1613
 
1614
1614
  def get_type(name, value, parent)
1615
- return value.type if value.is_a?(Sfp::Undefined)
1615
+ return value.type if value.is_a?(Sfp::Undefined) or value.is_a?(Sfp::Unknown)
1616
1616
 
1617
1617
  type = nil
1618
1618
  if parent.has_key?('_isa')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: antlr3
16
- requirement: &6366680 !ruby/object:Gem::Requirement
16
+ requirement: &9362480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.9.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *6366680
24
+ version_requirements: *9362480
25
25
  description: A Ruby API and script for SFP language parser
26
26
  email: herry13@gmail.com
27
27
  executables: