rley 0.7.05 → 0.7.06

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: 6bac50f391e9fa77fd20e283cea1d15ec7729ba7663f022e0b7c2eaf3dfa4d2d
4
- data.tar.gz: e85f49f87c86c2397a4ebf05b53b9fe4d7fc55ea77829892575c588424f2c789
3
+ metadata.gz: 530d84f2a821ca2a7e9a62dde68b6c70107b9539ca4f50842f035691c6b9f858
4
+ data.tar.gz: fee6189c812d4062ff148d206806bf9816280babce84b311066edf016406e9f7
5
5
  SHA512:
6
- metadata.gz: 0443dcd4ee4c92def8f3ec0d81418f62344ae66d4839b6449e336953cbb34c31209b09389036f7c0a64ae53b04f01e132f0eef44ec16069446c86b82056996af
7
- data.tar.gz: 7e078d135b134924794118386e25fed879e2d85862160e06708b711db15d01560b4ab2562489630125ee395324e5430b3b8354652c139238cc240ff8218bc780
6
+ metadata.gz: c58d32795908e5b570db16519ce9e3506813bee14f3cf914938625c4820dd7a138b6d1cb18991fc340cf4e6a4777e7b57c293e1c5cd47ae81fde2c884581208b
7
+ data.tar.gz: 246245e61c7a2dcda26117f8d3819f85c12dffa0917a400dcff6e22fff805930b9faf4b37c09e0202753bac0f170272db5b818e78c27047bef4a13dc510f94e9
@@ -1,4 +1,7 @@
1
- ### 0.7.05 / 2019-11-117
1
+ ### 0.7.06 / 2019-11-22
2
+ - [FIX] Method `ParseForestBuilder#process_end_entry`: Added a guard expression to prevent nil error.
3
+
4
+ ### 0.7.05 / 2019-11-17
2
5
  - [FIX] Method `GFGParsing#nullable_rule`: issue with nullable productions having at least one member in their rhs.
3
6
 
4
7
  ### 0.7.04 / 2019-08-17
@@ -5,7 +5,7 @@
5
5
 
6
6
  module Rley # Module used as a namespace
7
7
  # The version number of the gem.
8
- Version = '0.7.05'
8
+ Version = '0.7.06'
9
9
 
10
10
  # Brief description of the gem.
11
11
  Description = "Ruby implementation of the Earley's parsing algorithm"
@@ -42,7 +42,7 @@ module Rley # This module is used as a namespace
42
42
  @entry2node = {}
43
43
  @entry2path_to_alt = {}
44
44
  end
45
-
45
+
46
46
  # Notify the builder that the construction is over
47
47
  def done!()
48
48
  result.done!
@@ -65,19 +65,20 @@ module Rley # This module is used as a namespace
65
65
 
66
66
  # Return the current_parent node
67
67
  def curr_parent()
68
- return curr_path.last
68
+ curr_path.last
69
69
  end
70
70
 
71
71
  private
72
72
 
73
73
  def process_start_entry(_anEvent, _anEntry, _anIndex)
74
74
  curr_path.pop
75
+ raise StandardError, "path is nil for #{anEntry}" if curr_path.nil?
75
76
  end
76
77
 
77
78
  def process_end_entry(anEvent, anEntry, anIndex)
78
79
  case anEvent
79
80
  when :visit
80
- # create a node with the non-terminal
81
+ # create a forest node with the non-terminal
81
82
  # with same right extent as curr_entry_set_index
82
83
  # add the new node as first child of current_parent
83
84
  # append the new node to the curr_path
@@ -92,14 +93,15 @@ module Rley # This module is used as a namespace
92
93
  raise StandardError, "path is nil for #{anEntry}" if curr_path.nil?
93
94
 
94
95
  when :revisit
95
- # Retrieve the already existing node corresponding
96
+ # Retrieve the already existing forest node corresponding
96
97
  # to re-visited entry
97
98
  popular = @entry2node[anEntry]
98
99
 
99
100
  # Share with parent (if needed)...
100
- children = curr_parent.subnodes
101
- curr_parent.add_subnode(popular) unless children.include? popular
102
-
101
+ if curr_parent
102
+ children = curr_parent.subnodes
103
+ curr_parent.add_subnode(popular) unless children.include? popular
104
+ end
103
105
  else
104
106
  raise NotImplementedError
105
107
  end
@@ -242,6 +244,7 @@ module Rley # This module is used as a namespace
242
244
  # Add the given node as sub-node of current parent node
243
245
  # Optionally add the node to the current path
244
246
  def add_subnode(aNode, addToPath = true)
247
+ raise StandardError, 'node is nil' if aNode.nil?
245
248
  curr_parent.add_subnode(aNode) unless curr_path.empty?
246
249
  curr_path << aNode if addToPath
247
250
  end
@@ -242,7 +242,7 @@ module Rley # This module is used as a namespace
242
242
  bp.visitee = aContext.curr_entry
243
243
  bp.antecedent_index = 0
244
244
  aContext.backtrack_points << bp
245
-
245
+ # puts "Backtrack size after addition #{aContext.backtrack_points.size}"
246
246
  return bp
247
247
  end
248
248
 
@@ -260,6 +260,7 @@ module Rley # This module is used as a namespace
260
260
  aContext.backtrack_points.pop
261
261
  end
262
262
  # puts "Backtracking to #{bp.visitee}"
263
+ # puts "Backtrack size after backtracking #{aContext.backtrack_points.size}"
263
264
 
264
265
  # Emit a backtrack event
265
266
  return [:backtrack, bp.visitee, aContext.entry_set_index]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.05
4
+ version: 0.7.06
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-17 00:00:00.000000000 Z
11
+ date: 2019-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coveralls