sequitur 0.1.20 → 0.1.22
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 +5 -5
- data/.travis.yml +15 -13
- data/CHANGELOG.md +10 -0
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/appveyor.yml +13 -10
- data/examples/integer_sample.rb +2 -0
- data/examples/porridge.rb +2 -0
- data/examples/simple_case.rb +2 -0
- data/examples/symbol_sample.rb +2 -0
- data/examples/word_sample.rb +2 -0
- data/lib/sequitur.rb +2 -0
- data/lib/sequitur/constants.rb +4 -2
- data/lib/sequitur/digram.rb +2 -0
- data/lib/sequitur/dynamic_grammar.rb +2 -0
- data/lib/sequitur/formatter/base_formatter.rb +2 -0
- data/lib/sequitur/formatter/base_text.rb +2 -0
- data/lib/sequitur/formatter/debug.rb +2 -0
- data/lib/sequitur/grammar_visitor.rb +2 -0
- data/lib/sequitur/production.rb +2 -0
- data/lib/sequitur/production_ref.rb +3 -1
- data/lib/sequitur/sequitur_grammar.rb +3 -1
- data/lib/sequitur/symbol_sequence.rb +2 -0
- data/spec/sequitur/digram_spec.rb +2 -0
- data/spec/sequitur/dynamic_grammar_spec.rb +2 -0
- data/spec/sequitur/formatter/base_text_spec.rb +4 -2
- data/spec/sequitur/formatter/debug_spec.rb +4 -2
- data/spec/sequitur/grammar_visitor_spec.rb +2 -0
- data/spec/sequitur/production_ref_spec.rb +2 -0
- data/spec/sequitur/production_spec.rb +3 -1
- data/spec/sequitur/sequitur_grammar_spec.rb +2 -0
- data/spec/sequitur/symbol_sequence_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- metadata +28 -30
- data/.ruby-version +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8120ed261178fac280e46bcd3cc35edf3717603031738349f5177114b9fe8bc0
|
4
|
+
data.tar.gz: f799bff2dfaa09c0649e6416a789ab684e226e6eb1ccba974db8670932174050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4f16080571ec66e2256898b0f414815d430484ef5221d53e99acf8982da870ddb4a459158005c6f52107ccf7ef52af0e55cdd8a2b4b9982ff6066e189651b0
|
7
|
+
data.tar.gz: 95a95f2f8b5812e3e859b94909432d25f629682b1afa6aed8a6c17439d4e57b3d8abd055f3be3f4e4008a7927de22ee2201174f3ee602fd3c680623b7261c554
|
data/.travis.yml
CHANGED
@@ -1,25 +1,27 @@
|
|
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
|
-
- 2.6.
|
4
|
-
- 2.5.
|
5
|
-
- 2.4.
|
12
|
+
- 2.6.3
|
13
|
+
- 2.5.5
|
14
|
+
- 2.4.6
|
6
15
|
- 2.3.8
|
7
|
-
-
|
8
|
-
- 2.1.10
|
9
|
-
- 2.0.0-p648
|
10
|
-
- ruby-head
|
16
|
+
- ruby-head
|
11
17
|
- jruby-9.1.9.0
|
12
|
-
- jruby-head
|
13
|
-
|
18
|
+
- jruby-head
|
19
|
+
|
14
20
|
matrix:
|
15
21
|
allow_failures:
|
16
|
-
- rvm: jruby
|
17
22
|
- rvm: ruby-head
|
18
23
|
- rvm: jruby-head
|
19
|
-
fast_finish: true
|
20
24
|
|
21
|
-
gemfile:
|
22
|
-
- Gemfile
|
23
25
|
|
24
26
|
# whitelist
|
25
27
|
branches:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [0.1.22] - 2019-08-18
|
2
|
+
- Code refactoring to use string frozen magic comments (as a consequence, srl_ruby runs only on Rubies 2.3 or newer).
|
3
|
+
- Code restyling to please rubocop 0.7.40.
|
4
|
+
|
5
|
+
* [CHANGE] Files `Gemfile`, `.travis.yml`, `appveyor.yml` updated.
|
6
|
+
|
7
|
+
## 0.1.21 - 2019-01-13
|
8
|
+
- Removed Ruby versions older than 2.3 in CI testing because of breaking changes by Bundler 2.0
|
9
|
+
* [CHANGE] Files `Gemfile`, `.travis.yml`, `appveyor.yml` updated.
|
10
|
+
|
1
11
|
### 0.1.20 / 2019-01-03
|
2
12
|
Maintenance release.
|
3
13
|
* [CHANGE] File `.travis.yml`: updated Ruby versions.
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/appveyor.yml
CHANGED
@@ -1,25 +1,28 @@
|
|
1
1
|
version: '{build}'
|
2
|
-
max_jobs:
|
2
|
+
max_jobs: 5
|
3
3
|
environment:
|
4
4
|
matrix:
|
5
|
-
- Ruby_version:
|
5
|
+
- Ruby_version: 26-x64
|
6
|
+
- Ruby_version: 25-x64
|
6
7
|
- Ruby_version: 24-x64
|
7
8
|
- Ruby_version: 23-x64
|
8
|
-
- Ruby_version:
|
9
|
-
- Ruby_version:
|
10
|
-
- Ruby_version: 200-x64
|
11
|
-
- Ruby_version: 25
|
9
|
+
- Ruby_version: 26
|
10
|
+
- Ruby_version: 25
|
12
11
|
- Ruby_version: 24
|
13
12
|
- Ruby_version: 23
|
14
|
-
- Ruby_version: 22
|
15
|
-
- Ruby_version: 21
|
16
|
-
- Ruby_version: 200
|
17
13
|
|
18
14
|
install:
|
19
15
|
- set PATH=C:\Ruby%Ruby_version%\bin;%PATH%
|
16
|
+
- gem update --system
|
17
|
+
- gem install bundler
|
20
18
|
- bundle install --retry=3 --clean --force
|
21
19
|
|
22
20
|
build: off
|
23
21
|
|
22
|
+
before_test:
|
23
|
+
- ruby -v
|
24
|
+
- gem -v
|
25
|
+
- bundle -v
|
26
|
+
|
24
27
|
test_script:
|
25
|
-
- bundle exec rake
|
28
|
+
- bundle exec rake
|
data/examples/integer_sample.rb
CHANGED
data/examples/porridge.rb
CHANGED
data/examples/simple_case.rb
CHANGED
data/examples/symbol_sample.rb
CHANGED
data/examples/word_sample.rb
CHANGED
data/lib/sequitur.rb
CHANGED
data/lib/sequitur/constants.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# File: constants.rb
|
2
4
|
# Purpose: definition of Sequitur constants.
|
3
5
|
|
4
6
|
module Sequitur # Module used as a namespace
|
5
7
|
# The version number of the gem.
|
6
|
-
Version = '0.1.
|
8
|
+
Version = '0.1.22'
|
7
9
|
|
8
10
|
# Brief description of the gem.
|
9
|
-
Description = 'Ruby implementation of the Sequitur algorithm'
|
11
|
+
Description = 'Ruby implementation of the Sequitur algorithm'
|
10
12
|
|
11
13
|
# Constant Sequitur::RootDir contains the absolute path of Sequitur's
|
12
14
|
# start directory. Note: it also ends with a slash character.
|
data/lib/sequitur/digram.rb
CHANGED
data/lib/sequitur/production.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Sequitur # Module for classes implementing the Sequitur algorithm
|
2
4
|
# A production reference is a grammar symbol that may appear in the right-hand
|
3
5
|
# side of a production P1 and that refers to a production P2.
|
@@ -81,7 +83,7 @@ module Sequitur # Module for classes implementing the Sequitur algorithm
|
|
81
83
|
def bind_to(aProduction)
|
82
84
|
return if aProduction == @production
|
83
85
|
|
84
|
-
production
|
86
|
+
production&.decr_refcount
|
85
87
|
unless aProduction.kind_of?(Production)
|
86
88
|
raise StandardError, "Illegal production type #{aProduction.class}"
|
87
89
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'dynamic_grammar'
|
2
4
|
|
3
5
|
|
@@ -111,7 +113,7 @@ class SequiturGrammar < DynamicGrammar
|
|
111
113
|
# Return a production that is used less than twice in the grammar.
|
112
114
|
def detect_useless_production
|
113
115
|
useless = productions.index { |prod| prod.refcount < 2 }
|
114
|
-
useless = nil if useless
|
116
|
+
useless = nil if useless&.zero?
|
115
117
|
|
116
118
|
return useless
|
117
119
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../../spec_helper'
|
2
4
|
require 'stringio'
|
3
5
|
|
@@ -32,11 +34,11 @@ describe BaseText do
|
|
32
34
|
grm
|
33
35
|
end
|
34
36
|
|
35
|
-
let(:destination) { StringIO.new('', 'w') }
|
37
|
+
let(:destination) { StringIO.new(+'', 'w') }
|
36
38
|
|
37
39
|
context 'Standard creation & initialization:' do
|
38
40
|
it 'should be initialized with an IO argument' do
|
39
|
-
expect { BaseText.new(StringIO.new('', 'w')) }.not_to raise_error
|
41
|
+
expect { BaseText.new(StringIO.new(+'', 'w')) }.not_to raise_error
|
40
42
|
end
|
41
43
|
|
42
44
|
it 'should know its output destination' do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../../spec_helper'
|
2
4
|
require 'stringio'
|
3
5
|
|
@@ -32,11 +34,11 @@ describe Debug do
|
|
32
34
|
grm
|
33
35
|
end
|
34
36
|
|
35
|
-
let(:destination) { StringIO.new('', 'w') }
|
37
|
+
let(:destination) { StringIO.new(+'', 'w') }
|
36
38
|
|
37
39
|
context 'Standard creation & initialization:' do
|
38
40
|
it 'should be initialized with an IO argument' do
|
39
|
-
expect { Debug.new(StringIO.new('', 'w')) }.not_to raise_error
|
41
|
+
expect { Debug.new(StringIO.new(+'', 'w')) }.not_to raise_error
|
40
42
|
end
|
41
43
|
|
42
44
|
it 'should know its output destination' do
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative '../spec_helper'
|
2
4
|
|
3
5
|
# Load the class under test
|
@@ -176,7 +178,7 @@ describe Production do
|
|
176
178
|
instance = Production.new
|
177
179
|
symbols = [:a, :b, 'c', :d, :e, 1000, instance]
|
178
180
|
symbols.each { |symb| subject.append_symbol(symb) }
|
179
|
-
expectation = "#{subject.object_id} : "
|
181
|
+
expectation = +"#{subject.object_id} : "
|
180
182
|
expectation << "a b 'c' d e 1000 #{instance.object_id}."
|
181
183
|
expect(subject.to_string).to eq(expectation)
|
182
184
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,113 +1,113 @@
|
|
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.22
|
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-08-18 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
|
-
- - "
|
37
|
+
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 10.0.0
|
40
|
-
- - "
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 10.0.0
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 10.0.0
|
50
|
-
- - "
|
50
|
+
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 10.0.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rspec
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - "
|
57
|
+
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 3.0.0
|
60
|
-
- - "
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 3.0.0
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 3.0.0
|
70
|
-
- - "
|
70
|
+
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 3.0.0
|
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
|
-
- - "
|
97
|
+
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: 0.8.0
|
100
|
-
- - "
|
100
|
+
- - "~>"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: 0.8.0
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: 0.8.0
|
110
|
-
- - "
|
110
|
+
- - "~>"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: 0.8.0
|
113
113
|
description: |
|
@@ -127,7 +127,6 @@ files:
|
|
127
127
|
- ".rspec"
|
128
128
|
- ".rubocop.yml"
|
129
129
|
- ".ruby-gemset"
|
130
|
-
- ".ruby-version"
|
131
130
|
- ".simplecov"
|
132
131
|
- ".travis.yml"
|
133
132
|
- ".yardopts"
|
@@ -180,15 +179,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
179
|
requirements:
|
181
180
|
- - ">="
|
182
181
|
- !ruby/object:Gem::Version
|
183
|
-
version: 2.
|
182
|
+
version: 2.3.0
|
184
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
184
|
requirements:
|
186
185
|
- - ">="
|
187
186
|
- !ruby/object:Gem::Version
|
188
187
|
version: '0'
|
189
188
|
requirements: []
|
190
|
-
|
191
|
-
rubygems_version: 2.6.13
|
189
|
+
rubygems_version: 3.0.3
|
192
190
|
signing_key:
|
193
191
|
specification_version: 4
|
194
192
|
summary: Ruby implementation of the Sequitur algorithm
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.2.3
|