rley 0.7.02 → 0.7.03
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +10 -6
- data/CHANGELOG.md +7 -0
- data/lib/rley/constants.rb +1 -1
- data/lib/rley/lexical/token_range.rb +1 -1
- data/lib/rley/parser/parse_entry.rb +6 -1
- data/lib/rley/parser/parse_entry_set.rb +10 -2
- data/lib/rley/parser/parse_state.rb +1 -1
- data/lib/rley/syntax/symbol_seq.rb +1 -1
- data/spec/rley/parser/parse_entry_set_spec.rb +1 -1
- metadata +33 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a63420880d532cd1ad4bcef4ff01cbe51de63734f5e30ecc8ffc34338079a3da
|
4
|
+
data.tar.gz: 0712f56c42b467cbe571c069e5c856817a856c73eb3608531517b28f61f9682a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1d6824b1e67e3a6b12f262b6e8badc8036fb09cd503de1866834400d23fa815120d71cf5474bd1fef61249836f319f121cc3cf61aff1cef001f7f122d0877e4
|
7
|
+
data.tar.gz: '081b167f0616abc747e9e90fbf24025e57d1442cd34699e5afd55224042264c4c15f3bcdac1e29b9760f2deba38f113f26da4d119886fc57f099395bd88407a3'
|
data/.travis.yml
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
language: ruby
|
2
|
+
dist: trusty
|
3
|
+
|
4
|
+
before_install:
|
5
|
+
- gem update --system
|
6
|
+
- gem install bundler
|
7
|
+
|
8
|
+
script:
|
9
|
+
- bundle exec rake
|
10
|
+
|
2
11
|
rvm:
|
3
12
|
- 2.6.0
|
4
13
|
- 2.5.3
|
@@ -7,18 +16,13 @@ rvm:
|
|
7
16
|
- ruby-head
|
8
17
|
- jruby-9.1.9.0
|
9
18
|
- jruby-head
|
19
|
+
|
10
20
|
matrix:
|
11
21
|
allow_failures:
|
12
22
|
- rvm: 2.6.0
|
13
23
|
- rvm: ruby-head
|
14
24
|
- rvm: jruby-head
|
15
25
|
|
16
|
-
before_install:
|
17
|
-
- gem update --system
|
18
|
-
- gem install bundler
|
19
|
-
|
20
|
-
gemfile:
|
21
|
-
- Gemfile
|
22
26
|
|
23
27
|
# whitelist
|
24
28
|
branches:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### 0.7.03 / 2019-07-21
|
2
|
+
- Minor refactoring for parsing speed improvement.
|
3
|
+
* [CHANGE] Replacing comparison with object_id by `equal?` method
|
4
|
+
* [CHANGE] Method `ParseEntry#hash` added
|
5
|
+
* [CHANGE] Class `ParseEntrySet` added new Hash attribute in order to speed up membership testing.
|
6
|
+
|
7
|
+
|
1
8
|
### 0.7.02 / 2019-01-13
|
2
9
|
- Removed Ruby versions older than 2.3 in CI testing because of breaking changes by Bundler 2.0
|
3
10
|
* [CHANGE] Files `Gemfile`, `.travis.yml`, `appveyor.yml` updated.
|
data/lib/rley/constants.rb
CHANGED
@@ -48,11 +48,16 @@ module Rley # This module is used as a namespace
|
|
48
48
|
|
49
49
|
# Equality comparison. A parse entry behaves as a value object.
|
50
50
|
def ==(other)
|
51
|
-
return true if
|
51
|
+
return true if equal? other
|
52
52
|
|
53
53
|
result = (vertex == other.vertex) && (origin == other.origin)
|
54
54
|
return result
|
55
55
|
end
|
56
|
+
|
57
|
+
def hash
|
58
|
+
@my_hash ||= "#{vertex.object_id}-#{origin}".hash
|
59
|
+
@my_hash
|
60
|
+
end
|
56
61
|
|
57
62
|
# Returns true iff the vertex is a start vertex (i.e. of the form: .X)
|
58
63
|
def start_entry?()
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'forwardable' # For the Delegation pattern
|
2
|
+
require 'set'
|
2
3
|
|
3
4
|
require_relative '../syntax/terminal'
|
4
5
|
require_relative '../syntax/non_terminal'
|
@@ -11,12 +12,16 @@ module Rley # This module is used as a namespace
|
|
11
12
|
extend Forwardable
|
12
13
|
def_delegators :entries, :empty?, :size, :first, :last, :pop, :each
|
13
14
|
|
14
|
-
# @return [Array<ParseEntry>] The
|
15
|
+
# @return [Array<ParseEntry>] The array of parse entries
|
15
16
|
attr_reader :entries
|
17
|
+
|
18
|
+
# @return [Hash] A Hash with pairs { hash of ParseEntry => ParseEntry }
|
19
|
+
attr_reader :membership
|
16
20
|
|
17
21
|
# Constructor.
|
18
22
|
def initialize()
|
19
23
|
@entries = []
|
24
|
+
@membership = {}
|
20
25
|
@entries4term = Hash.new { |hash, key| hash[key] = [] }
|
21
26
|
@entries4n_term = Hash.new { |hash, key| hash[key] = [] }
|
22
27
|
end
|
@@ -55,11 +60,14 @@ module Rley # This module is used as a namespace
|
|
55
60
|
# @return [ParseEntry] the passed parse entry if it pushes it
|
56
61
|
def push_entry(anEntry)
|
57
62
|
# TODO: control overhead next line
|
58
|
-
match = entries.find { |entry| entry == anEntry }
|
63
|
+
#match = entries.find { |entry| entry == anEntry }
|
64
|
+
entry_key = anEntry.hash
|
65
|
+
match = membership.fetch(entry_key, false)
|
59
66
|
if match
|
60
67
|
result = match
|
61
68
|
else
|
62
69
|
@entries << anEntry
|
70
|
+
membership[entry_key] = anEntry
|
63
71
|
expecting = anEntry.next_symbol
|
64
72
|
add_lookup4symbol(anEntry) if expecting
|
65
73
|
result = anEntry
|
@@ -14,7 +14,7 @@ module Rley # This module is used as a namespace
|
|
14
14
|
|
15
15
|
# Equality comparison. A parse state behaves as a value object.
|
16
16
|
def ==(other)
|
17
|
-
return true if
|
17
|
+
return true if equal?(other)
|
18
18
|
|
19
19
|
result = (dotted_rule == other.dotted_rule) &&
|
20
20
|
(origin == other.origin)
|
@@ -21,7 +21,7 @@ module Rley # This module is used as a namespace
|
|
21
21
|
# @param other [SymbolSeq|Array]
|
22
22
|
# @return [Boolean]
|
23
23
|
def ==(other)
|
24
|
-
return true if other
|
24
|
+
return true if equal?(other)
|
25
25
|
|
26
26
|
case other
|
27
27
|
when SymbolSeq then result = other.members == members
|
@@ -48,7 +48,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
|
|
48
48
|
|
49
49
|
context 'Provided services:' do
|
50
50
|
it 'should accept the addition of an entry' do
|
51
|
-
# Case: first time
|
51
|
+
# Case: first time entry addition
|
52
52
|
expect(subject.push_entry(entry1)).to eq(entry1)
|
53
53
|
expect(subject).not_to be_empty
|
54
54
|
|
metadata
CHANGED
@@ -1,115 +1,115 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.03
|
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
|
+
date: 2019-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0.7'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 0.7.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0.7'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.7'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 0.7.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.7'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rake
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '10.0'
|
40
37
|
- - ">="
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: 10.0.0
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '10.0'
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "~>"
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '10.0'
|
50
47
|
- - ">="
|
51
48
|
- !ruby/object:Gem::Version
|
52
49
|
version: 10.0.0
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '10.0'
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rspec
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "~>"
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
version: '3.5'
|
60
57
|
- - ">="
|
61
58
|
- !ruby/object:Gem::Version
|
62
59
|
version: 3.5.0
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.5'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "~>"
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '3.5'
|
70
67
|
- - ">="
|
71
68
|
- !ruby/object:Gem::Version
|
72
69
|
version: 3.5.0
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '3.5'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: rubygems
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- - "~>"
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: '2.0'
|
80
77
|
- - ">="
|
81
78
|
- !ruby/object:Gem::Version
|
82
79
|
version: 2.0.0
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.0'
|
90
87
|
- - ">="
|
91
88
|
- !ruby/object:Gem::Version
|
92
89
|
version: 2.0.0
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2.0'
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: simplecov
|
95
95
|
requirement: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '0.1'
|
100
97
|
- - ">="
|
101
98
|
- !ruby/object:Gem::Version
|
102
99
|
version: 0.1.0
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.1'
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0.1'
|
110
107
|
- - ">="
|
111
108
|
- !ruby/object:Gem::Version
|
112
109
|
version: 0.1.0
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0.1'
|
113
113
|
description: A general parser using the Earley algorithm.
|
114
114
|
email: famished.tiger@yahoo.com
|
115
115
|
executables: []
|
@@ -315,8 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
315
|
- !ruby/object:Gem::Version
|
316
316
|
version: '0'
|
317
317
|
requirements: []
|
318
|
-
|
319
|
-
rubygems_version: 2.6.13
|
318
|
+
rubygems_version: 3.0.2
|
320
319
|
signing_key:
|
321
320
|
specification_version: 4
|
322
321
|
summary: Ruby implementation of the Earley's parsing algorithm
|