sequitur 0.1.14 → 0.1.15
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.
- checksums.yaml +8 -8
- data/.rubocop.yml +8 -1
- data/CHANGELOG.md +4 -0
- data/lib/sequitur/constants.rb +1 -1
- data/lib/sequitur/production.rb +1 -1
- data/lib/sequitur/sequitur_grammar.rb +3 -4
- data/spec/sequitur/symbol_sequence_spec.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODUxYjgzNjcxM2M5ZWQxZDgxNmE0NjJiM2E5Njc5MzBlY2Q1NDc2Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjRjY2Q2MmRmOWEyZGE2NDI1NWQ2ZDJhZjdlMjE5YzdiMDhkOWI4YQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDI0YzNmOWI4ZTBlZGNjNDkxNmNmNTRhNDJjZDMzMDY4OWE4YmU5YmRjZmJl
|
10
|
+
NzI5MjViMjhhNGYyODkyNGQzNGMyMGFhMjRkNjMyMDBlOTFlN2ZhNzgzYzk1
|
11
|
+
MTgxNjYzYTA4YmFkZWE1ZDlmOTc0MDdkMzJmOGQzMTFiYmEzYWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGI1NWI4NDBlMjhhYzQ3NWUyNDI1MmFkZmI0ZTgzYWRlZWQ1OTZlZWM4Yzg1
|
14
|
+
OTIxMDc4Zjc2NmY1MDExNzQ5OWYyZTkwY2EyZjgwMTczZGFkOGE2YzJkMjAx
|
15
|
+
NGQxMWY2NDBkOTBlNTM1M2I2YWNiNDA1M2U1MjZlMWFjY2RjZTI=
|
data/.rubocop.yml
CHANGED
@@ -11,7 +11,10 @@ AbcSize:
|
|
11
11
|
# This is disabled because some demos use UTF-8
|
12
12
|
AsciiComments:
|
13
13
|
Enabled: false
|
14
|
-
|
14
|
+
|
15
|
+
Attr:
|
16
|
+
Enabled: false
|
17
|
+
|
15
18
|
CaseIndentation:
|
16
19
|
IndentWhenRelativeTo: end
|
17
20
|
IndentOneStep: true
|
@@ -52,6 +55,10 @@ MethodLength:
|
|
52
55
|
Max: 50
|
53
56
|
CountComments: false
|
54
57
|
|
58
|
+
# Avoid modules longer than 400 lines of code
|
59
|
+
ModuleLength:
|
60
|
+
Max: 400
|
61
|
+
|
55
62
|
NonNilCheck:
|
56
63
|
Enabled: false
|
57
64
|
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 0.1.15 / 2015-06-16
|
2
|
+
* [CHANGE] Code re-formatted to please Rubocop 0.32.0
|
3
|
+
* [FIX] File `.rubocop.yml`: change some cop settings.
|
4
|
+
|
1
5
|
### 0.1.14 / 2015-02-06
|
2
6
|
* [CHANGE] Code re-formatted to please Rubocop 0.29
|
3
7
|
* [FIX] File `.rubocop.yml`: removal of setting for obsolete EmptyLinesAroundBody cop.
|
data/lib/sequitur/constants.rb
CHANGED
data/lib/sequitur/production.rb
CHANGED
@@ -208,7 +208,7 @@ class Production
|
|
208
208
|
# p_A.derive_step(p_B)
|
209
209
|
# #Modifies p_A as into: p_A -> a x y b x y c
|
210
210
|
def derive_step(another)
|
211
|
-
(0...rhs.size).to_a.
|
211
|
+
(0...rhs.size).to_a.reverse_each do |index|
|
212
212
|
next unless rhs[index] == another
|
213
213
|
|
214
214
|
rhs.insert_at(index + 1, another.rhs)
|
@@ -111,9 +111,8 @@ class SequiturGrammar < DynamicGrammar
|
|
111
111
|
# Return a production that is used less than twice in the grammar.
|
112
112
|
def detect_useless_production()
|
113
113
|
useless = productions.index { |prod| prod.refcount < 2 }
|
114
|
-
|
115
|
-
|
116
|
-
end
|
114
|
+
useless = nil if useless && useless == 0
|
115
|
+
|
117
116
|
return useless
|
118
117
|
end
|
119
118
|
|
@@ -126,7 +125,7 @@ class SequiturGrammar < DynamicGrammar
|
|
126
125
|
|
127
126
|
# Retrieve production referencing useless one
|
128
127
|
referencing = nil
|
129
|
-
productions.
|
128
|
+
productions.reverse_each do |a_prod|
|
130
129
|
# Next line assumes non-recursive productions
|
131
130
|
next if a_prod == useless_prod
|
132
131
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequitur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|