rley 0.7.06 → 0.7.07
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 +4 -4
- data/.rubocop.yml +18 -12
- data/.simplecov +3 -2
- data/.travis.yml +6 -6
- data/CHANGELOG.md +4 -0
- data/lib/rley/constants.rb +1 -1
- data/lib/rley/parse_rep/parse_forest_builder.rb +2 -0
- data/lib/rley/parse_rep/parse_rep_creator.rb +3 -3
- data/lib/rley/parser/gfg_parsing.rb +1 -0
- data/spec/rley/parse_rep/groucho_spec.rb +3 -5
- data/spec/rley/parser/gfg_parsing_spec.rb +1 -4
- data/spec/rley/parser/parse_walker_factory_spec.rb +7 -7
- data/spec/rley/support/grammar_l0_helper.rb +3 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8743db90e9729925d8de083101f27d1688577e92ad054818c01f8c78d064ff8d
|
4
|
+
data.tar.gz: e341eb57fa04f6e6e2f37f271c2cf42f05762faf614a04dad309073105541ea2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c676f6e8e529eb2cf8349681c36bb60942f9efe4e4533bba34e845855af62e40ab881db9374b1c2ccc047e4769d671565c24d3ee1f61f21f98cadbbbcfa7643f
|
7
|
+
data.tar.gz: 6e6cea550503348f75f8ffb4ed253e3b3a8506f8e45dfa751efb43a47845c9bef2ef036e0905c46cc8cb7ee24fa809514465ef29386481f38dac0f933ff26f66
|
data/.rubocop.yml
CHANGED
@@ -53,20 +53,20 @@ EndOfLine:
|
|
53
53
|
|
54
54
|
IndentationWidth:
|
55
55
|
Enabled: false
|
56
|
-
|
56
|
+
|
57
57
|
Layout/BlockAlignment:
|
58
58
|
Enabled: false
|
59
59
|
|
60
60
|
Layout/ClosingHeredocIndentation:
|
61
61
|
Enabled: false
|
62
|
-
|
63
|
-
|
64
|
-
Layout/
|
62
|
+
|
63
|
+
|
64
|
+
Layout/HeredocIndentation:
|
65
65
|
Enabled: false
|
66
66
|
|
67
67
|
Layout/SpaceInsideArrayLiteralBrackets:
|
68
|
-
Enabled: false
|
69
|
-
|
68
|
+
Enabled: false
|
69
|
+
|
70
70
|
Metrics/AbcSize:
|
71
71
|
Max: 50
|
72
72
|
|
@@ -83,7 +83,10 @@ Metrics/ModuleLength:
|
|
83
83
|
Metrics/PerceivedComplexity:
|
84
84
|
Enabled: true
|
85
85
|
Max: 50
|
86
|
-
|
86
|
+
|
87
|
+
Naming/ClassAndModuleCamelCase:
|
88
|
+
Enabled: false
|
89
|
+
|
87
90
|
# Disable this because it produces false negatives
|
88
91
|
Naming/HeredocDelimiterNaming:
|
89
92
|
Enabled: false
|
@@ -91,7 +94,7 @@ Naming/HeredocDelimiterNaming:
|
|
91
94
|
Naming/MethodName:
|
92
95
|
Enabled: false
|
93
96
|
|
94
|
-
Naming/
|
97
|
+
Naming/MethodParameterName:
|
95
98
|
Enabled: false
|
96
99
|
|
97
100
|
NonNilCheck:
|
@@ -108,13 +111,16 @@ RedundantReturn:
|
|
108
111
|
|
109
112
|
Style/CommentedKeyword:
|
110
113
|
Enabled: false
|
111
|
-
|
112
|
-
Style/ConditionalAssignment:
|
114
|
+
|
115
|
+
Style/ConditionalAssignment:
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
Style/IfUnlessModifier:
|
113
119
|
Enabled: false
|
114
|
-
|
120
|
+
|
115
121
|
Style/Lambda:
|
116
122
|
Enabled: false
|
117
|
-
|
123
|
+
|
118
124
|
Style/MissingRespondToMissing:
|
119
125
|
Enabled: false
|
120
126
|
|
data/.simplecov
CHANGED
data/.travis.yml
CHANGED
@@ -9,13 +9,13 @@ script:
|
|
9
9
|
- bundle exec rake
|
10
10
|
|
11
11
|
rvm:
|
12
|
-
- 2.
|
13
|
-
- 2.
|
14
|
-
- 2.
|
15
|
-
- 2.
|
12
|
+
- 2.7.1
|
13
|
+
- 2.6.6
|
14
|
+
- 2.5.8
|
15
|
+
- 2.4.10
|
16
16
|
- ruby-head
|
17
|
-
- jruby-
|
18
|
-
|
17
|
+
- jruby-head
|
18
|
+
before_install: gem install bundler -v 2.0.2
|
19
19
|
|
20
20
|
matrix:
|
21
21
|
allow_failures:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 0.7.07 / 2020-11-16
|
2
|
+
- Code restyling to please rubocop 0.93.1
|
3
|
+
* [CHANGE] File `.travis.yml`: updated Ruby versions, drop support for Ruby 2.3.x
|
4
|
+
|
1
5
|
### 0.7.06 / 2019-11-22
|
2
6
|
- [FIX] Method `ParseForestBuilder#process_end_entry`: Added a guard expression to prevent nil error.
|
3
7
|
|
data/lib/rley/constants.rb
CHANGED
@@ -155,6 +155,7 @@ module Rley # This module is used as a namespace
|
|
155
155
|
# Restore path
|
156
156
|
@curr_path = entry2path_to_alt[anEntry].dup
|
157
157
|
raise StandardError, 'path is nil' if curr_path.nil?
|
158
|
+
|
158
159
|
create_alternative_node(anEntry)
|
159
160
|
|
160
161
|
when :revisit
|
@@ -245,6 +246,7 @@ module Rley # This module is used as a namespace
|
|
245
246
|
# Optionally add the node to the current path
|
246
247
|
def add_subnode(aNode, addToPath = true)
|
247
248
|
raise StandardError, 'node is nil' if aNode.nil?
|
249
|
+
|
248
250
|
curr_parent.add_subnode(aNode) unless curr_path.empty?
|
249
251
|
curr_path << aNode if addToPath
|
250
252
|
end
|
@@ -32,11 +32,11 @@ module Rley # This module is used as a namespace
|
|
32
32
|
end
|
33
33
|
rescue StopIteration
|
34
34
|
# Do nothing: gobble the exception
|
35
|
-
rescue StandardError =>
|
36
|
-
if
|
35
|
+
rescue StandardError => e
|
36
|
+
if e.message =~ /^Ambiguous/
|
37
37
|
$stderr.puts parsing
|
38
38
|
end
|
39
|
-
raise
|
39
|
+
raise e
|
40
40
|
end
|
41
41
|
|
42
42
|
a_builder.done!
|
@@ -91,6 +91,7 @@ module Rley # This module is used as a namespace
|
|
91
91
|
if succ.dotted_item.production.nullable?
|
92
92
|
succ_entry = apply_rule(start_entry, succ, pos, pos, :nullable_rule)
|
93
93
|
next unless succ_entry.exit_entry?
|
94
|
+
|
94
95
|
apply_rule(succ_entry, end_vertex, pos, pos, :nullable_rule)
|
95
96
|
end
|
96
97
|
end
|
@@ -52,12 +52,10 @@ module Rley # Open this namespace to avoid module qualifier prefixes
|
|
52
52
|
def tokenizer(aText, aGrammar)
|
53
53
|
pos = Rley::Lexical::Position.new(1, 2) # Dummy position
|
54
54
|
tokens = aText.scan(/\S+/).map do |word|
|
55
|
-
|
56
|
-
if
|
57
|
-
raise StandardError, "Word '#{word}' not found in lexicon"
|
58
|
-
end
|
55
|
+
term = Groucho_lexicon[word]
|
56
|
+
raise StandardError, "Word '#{word}' not found in lexicon" if term.nil?
|
59
57
|
|
60
|
-
terminal = aGrammar.name2symbol[
|
58
|
+
terminal = aGrammar.name2symbol[term]
|
61
59
|
Rley::Lexical::Token.new(word, terminal, pos)
|
62
60
|
end
|
63
61
|
|
@@ -252,9 +252,6 @@ SNIPPET
|
|
252
252
|
end
|
253
253
|
|
254
254
|
=begin
|
255
|
-
|
256
|
-
|
257
|
-
|
258
255
|
it 'should retrieve the parse states that expect a given terminal' do
|
259
256
|
item1 = DottedItem.new(prod_A1, 2)
|
260
257
|
item2 = DottedItem.new(prod_A1, 1)
|
@@ -303,7 +300,7 @@ SNIPPET
|
|
303
300
|
|
304
301
|
it 'should give a text representation of itself' do
|
305
302
|
repr = subject.to_s
|
306
|
-
expect(repr).to match
|
303
|
+
expect(repr).to match(/^success\? true/)
|
307
304
|
|
308
305
|
# Let's test the last chart state only
|
309
306
|
expectation = <<REPR
|
@@ -47,13 +47,13 @@ module Rley # Open this namespace to avoid module qualifier prefixes
|
|
47
47
|
# contains a hidden left recursion and a cycle
|
48
48
|
builder = Syntax::GrammarBuilder.new do
|
49
49
|
add_terminals('a', 'b')
|
50
|
-
rule'Phi' => 'S'
|
51
|
-
rule'S' => %w[A T]
|
52
|
-
rule'S' => %w[a T]
|
53
|
-
rule'A' => 'a'
|
54
|
-
rule'A' => %w[B A]
|
55
|
-
rule'B' => []
|
56
|
-
rule'T' => %w[b b b]
|
50
|
+
rule 'Phi' => 'S'
|
51
|
+
rule 'S' => %w[A T]
|
52
|
+
rule 'S' => %w[a T]
|
53
|
+
rule 'A' => 'a'
|
54
|
+
rule 'A' => %w[B A]
|
55
|
+
rule 'B' => []
|
56
|
+
rule 'T' => %w[b b b]
|
57
57
|
end
|
58
58
|
builder.grammar
|
59
59
|
end
|
@@ -78,13 +78,11 @@ module GrammarL0Helper
|
|
78
78
|
word = scanner.scan(/\S+/)
|
79
79
|
break unless word
|
80
80
|
|
81
|
-
|
82
|
-
if
|
83
|
-
raise StandardError, "Word '#{word}' not found in lexicon"
|
84
|
-
end
|
81
|
+
term = lexicon_l0[word]
|
82
|
+
raise StandardError, "Word '#{word}' not found in lexicon" if term.nil?
|
85
83
|
|
86
84
|
pos = Rley::Lexical::Position.new(1, curr_pos + 1)
|
87
|
-
tokens << Rley::Lexical::Token.new(word,
|
85
|
+
tokens << Rley::Lexical::Token.new(word, term, pos)
|
88
86
|
end
|
89
87
|
|
90
88
|
return tokens
|
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.
|
4
|
+
version: 0.7.07
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dimitri Geshef
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coveralls
|
@@ -307,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
307
307
|
requirements:
|
308
308
|
- - ">="
|
309
309
|
- !ruby/object:Gem::Version
|
310
|
-
version: 2.
|
310
|
+
version: 2.4.0
|
311
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
312
312
|
requirements:
|
313
313
|
- - ">="
|