rley 0.4.06 → 0.4.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +22 -13
  3. data/.travis.yml +8 -7
  4. data/CHANGELOG.md +9 -0
  5. data/README.md +9 -10
  6. data/examples/NLP/mini_en_demo.rb +7 -7
  7. data/examples/data_formats/JSON/cli_options.rb +5 -6
  8. data/examples/data_formats/JSON/{JSON_demo.rb → json_demo.rb} +2 -2
  9. data/examples/data_formats/JSON/{JSON_grammar.rb → json_grammar.rb} +10 -10
  10. data/examples/data_formats/JSON/{JSON_lexer.rb → json_lexer.rb} +17 -22
  11. data/examples/data_formats/JSON/{JSON_parser.rb → json_parser.rb} +2 -2
  12. data/examples/general/calc/calc_demo.rb +1 -1
  13. data/examples/general/calc/calc_grammar.rb +5 -5
  14. data/examples/general/calc/calc_lexer.rb +14 -17
  15. data/examples/general/calc/calc_parser.rb +2 -2
  16. data/lib/rley/constants.rb +1 -1
  17. data/lib/rley/formatter/asciitree.rb +15 -16
  18. data/lib/rley/formatter/bracket_notation.rb +3 -6
  19. data/lib/rley/formatter/debug.rb +0 -1
  20. data/lib/rley/formatter/json.rb +0 -1
  21. data/lib/rley/gfg/grm_flow_graph.rb +11 -10
  22. data/lib/rley/parse_forest_visitor.rb +0 -3
  23. data/lib/rley/parse_tree_visitor.rb +0 -3
  24. data/lib/rley/parser/error_reason.rb +1 -5
  25. data/lib/rley/parser/gfg_chart.rb +2 -2
  26. data/lib/rley/parser/gfg_earley_parser.rb +1 -2
  27. data/lib/rley/parser/gfg_parsing.rb +3 -7
  28. data/lib/rley/parser/parse_entry.rb +0 -1
  29. data/lib/rley/parser/parse_entry_set.rb +15 -16
  30. data/lib/rley/parser/parse_forest_builder.rb +8 -23
  31. data/lib/rley/parser/parse_state.rb +1 -1
  32. data/lib/rley/parser/parse_tree_builder.rb +2 -30
  33. data/lib/rley/parser/parse_tree_factory.rb +1 -1
  34. data/lib/rley/parser/parse_walker_factory.rb +3 -6
  35. data/lib/rley/parser/state_set.rb +0 -1
  36. data/lib/rley/ptree/parse_tree.rb +0 -1
  37. data/lib/rley/ptree/terminal_node.rb +4 -1
  38. data/lib/rley/rley_error.rb +1 -1
  39. data/lib/rley/sppf/composite_node.rb +0 -1
  40. data/lib/rley/sppf/parse_forest.rb +0 -1
  41. data/lib/rley/syntax/grammar.rb +5 -9
  42. data/lib/rley/syntax/grammar_builder.rb +8 -11
  43. data/lib/rley/syntax/grm_symbol.rb +0 -1
  44. data/lib/rley/syntax/production.rb +5 -4
  45. data/lib/rley/tokens/token_range.rb +0 -1
  46. data/spec/rley/formatter/bracket_notation_spec.rb +3 -1
  47. data/spec/rley/gfg/grm_flow_graph_spec.rb +15 -46
  48. data/spec/rley/gfg/item_vertex_spec.rb +1 -1
  49. data/spec/rley/parse_forest_visitor_spec.rb +1 -1
  50. data/spec/rley/parse_tree_visitor_spec.rb +2 -2
  51. data/spec/rley/parser/error_reason_spec.rb +19 -14
  52. data/spec/rley/parser/gfg_chart_spec.rb +1 -1
  53. data/spec/rley/parser/gfg_earley_parser_spec.rb +15 -15
  54. data/spec/rley/parser/gfg_parsing_spec.rb +3 -3
  55. data/spec/rley/parser/groucho_spec.rb +6 -7
  56. data/spec/rley/parser/parse_forest_builder_spec.rb +5 -5
  57. data/spec/rley/parser/parse_forest_factory_spec.rb +5 -5
  58. data/spec/rley/parser/parse_state_spec.rb +8 -0
  59. data/spec/rley/parser/parse_tracer_spec.rb +1 -1
  60. data/spec/rley/parser/parse_tree_builder_spec.rb +26 -29
  61. data/spec/rley/parser/parse_tree_factory_spec.rb +5 -5
  62. data/spec/rley/parser/parse_walker_factory_spec.rb +5 -5
  63. data/spec/rley/ptree/parse_tree_node_spec.rb +2 -2
  64. data/spec/rley/ptree/terminal_node_spec.rb +1 -1
  65. data/spec/rley/support/ambiguous_grammar_helper.rb +1 -1
  66. data/spec/rley/support/expectation_helper.rb +0 -1
  67. data/spec/rley/support/grammar_abc_helper.rb +1 -1
  68. data/spec/rley/support/grammar_ambig01_helper.rb +2 -3
  69. data/spec/rley/support/grammar_b_expr_helper.rb +2 -2
  70. data/spec/rley/support/grammar_l0_helper.rb +7 -8
  71. data/spec/rley/support/grammar_pb_helper.rb +3 -4
  72. data/spec/rley/support/grammar_sppf_helper.rb +4 -4
  73. data/spec/rley/syntax/grammar_builder_spec.rb +5 -4
  74. data/spec/rley/syntax/grammar_spec.rb +10 -11
  75. data/spec/rley/syntax/symbol_seq_spec.rb +2 -2
  76. data/spec/rley/syntax/terminal_spec.rb +1 -1
  77. metadata +31 -31
@@ -25,10 +25,10 @@ module Rley # This module is used as a namespace
25
25
  # @example Building a tiny English grammar
26
26
  # builder = Rley::Syntax::GrammarBuilder.new do
27
27
  # add_terminals('n', 'v', 'adj', 'det')
28
- # rule 'S' => %w(NP VP)
29
- # rule 'VP' => %w(v NP)
30
- # rule 'NP' => %w(det n)
31
- # rule 'NP' => %w(adj NP)
28
+ # rule 'S' => %w[NP VP]
29
+ # rule 'VP' => %w[v NP]
30
+ # rule 'NP' => %w[det n]
31
+ # rule 'NP' => %w[adj NP]
32
32
  # end
33
33
  # tiny_eng = builder.grammar
34
34
  def initialize(&aBlock)
@@ -54,7 +54,6 @@ module Rley # This module is used as a namespace
54
54
  symbols.merge!(new_symbs)
55
55
  end
56
56
 
57
-
58
57
  # Add a production rule in the grammar given one
59
58
  # key-value pair of the form: String => Array.
60
59
  # Where the key is the name of the non-terminal appearing in the
@@ -64,10 +63,10 @@ module Rley # This module is used as a namespace
64
63
  # @example Equivalent call syntaxes
65
64
  # builder.add_production('A' => ['a', 'A', 'c'])
66
65
  # builder.rule('A' => ['a', 'A', 'c']) # 'rule' is a synonym
67
- # builder.rule('A' => %w(a A c)) # Use %w syntax for Array of String
68
- # builder.rule 'A' => %w(a A c) # Call parentheses are optional
69
- # @param aProductionRepr [Hash{String, Array<String>}] A Hash-based representation
70
- # of a production.
66
+ # builder.rule('A' => %w[a A c]) # Use %w syntax for Array of String
67
+ # builder.rule 'A' => %w[a A c] # Call parentheses are optional
68
+ # @param aProductionRepr [Hash{String, Array<String>}]
69
+ # A Hash-based representation of a production.
71
70
  # @return [void]
72
71
  def add_production(aProductionRepr)
73
72
  aProductionRepr.each_pair do |(lhs_name, rhs_repr)|
@@ -138,7 +137,6 @@ module Rley # This module is used as a namespace
138
137
  return symbs
139
138
  end
140
139
 
141
-
142
140
  # If the argument is already a grammar symbol object then it is
143
141
  # returned as is. Otherwise, the argument is treated as a name
144
142
  # for a new instance of the given class.
@@ -165,7 +163,6 @@ module Rley # This module is used as a namespace
165
163
  end
166
164
  return symbols[aSymbolName]
167
165
  end
168
-
169
166
  end # class
170
167
  end # module
171
168
  end # module
@@ -32,7 +32,6 @@ module Rley # This module is used as a namespace
32
32
  def generative?()
33
33
  return @generative
34
34
  end
35
-
36
35
  end # class
37
36
  end # module
38
37
  end # module
@@ -10,14 +10,15 @@ module Rley # This module is used as a namespace
10
10
  # in other words every occurrence of the LHS can be substituted to
11
11
  # corresponding RHS.
12
12
  class Production
13
- # The right-hand side (rhs) consists of a sequence of grammar symbols
13
+ # @return [SymbolSeq] The right-hand side (rhs).
14
14
  attr_reader(:rhs)
15
15
 
16
- # The left-hand side of the rule. It must be a non-terminal symbol
16
+ # @return [NonTerminal] The left-hand side of the rule.
17
17
  attr_reader(:lhs)
18
18
 
19
- # A production is generative when all of its rhs members are generative (that as, they
20
- # can each generate/derive a non-empty string of terminals).
19
+ # @return [Boolean ]A production is generative when all of its
20
+ # rhs members are generative (that is, they can each generate/derive
21
+ # a non-empty string of terminals).
21
22
  attr_writer(:generative)
22
23
 
23
24
  # Provide common alternate names to lhs and rhs accessors
@@ -21,7 +21,6 @@ module Rley # This module is used as a namespace
21
21
  assign_high(aRangeRep)
22
22
  end
23
23
 
24
-
25
24
  def ==(other)
26
25
  return true if object_id == other.object_id
27
26
 
@@ -61,7 +61,9 @@ module Rley # Re-open the module to get rid of qualified names
61
61
 
62
62
  context 'Standard creation & initialization:' do
63
63
  it 'should be initialized with an IO argument' do
64
- expect { BracketNotation.new(StringIO.new('', 'w')) }.not_to raise_error
64
+ expect do
65
+ BracketNotation.new(StringIO.new('', 'w'))
66
+ end.not_to raise_error
65
67
  end
66
68
 
67
69
  it 'should know its output destination' do
@@ -165,7 +165,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
165
165
  builder.add_production('S' => 'B')
166
166
  builder.add_production('A' => 'a')
167
167
  # There is no edge between .B and B => B . b => non-generative
168
- builder.add_production('B' => %w(B b))
168
+ builder.add_production('B' => %w[B b])
169
169
 
170
170
  # Non-terminal symbol C is unreachable
171
171
  builder.add_production('C' => 'c')
@@ -181,18 +181,18 @@ module Rley # Open this namespace to avoid module qualifier prefixes
181
181
  end
182
182
 
183
183
  expected = [
184
- '.S',
185
- 'S => . A',
186
- '.A',
187
- 'A => . a A c',
188
- 'A => a . A c',
189
- 'A => a A . c',
190
- 'A => a A c .',
191
- 'A.',
192
- 'A => . b',
193
- 'A => b .',
194
- 'S.'
195
- ]
184
+ '.S',
185
+ 'S => . A',
186
+ '.A',
187
+ 'A => . a A c',
188
+ 'A => a . A c',
189
+ 'A => a A . c',
190
+ 'A => a A c .',
191
+ 'A.',
192
+ 'A => . b',
193
+ 'A => b .',
194
+ 'S.'
195
+ ]
196
196
  expect(result).to eq(expected)
197
197
  end
198
198
 
@@ -214,42 +214,11 @@ module Rley # Open this namespace to avoid module qualifier prefixes
214
214
  expect(nterm).not_to be_undefined
215
215
  end
216
216
 
217
- unreachable = grammar.non_terminals.select do |nterm|
218
- nterm.unreachable?
219
- end
217
+ unreachable = grammar.non_terminals.select(&:unreachable?)
220
218
  expect(unreachable.size).to eq(1)
221
219
  expect(unreachable[0].name).to eq('C')
222
220
  end
223
- end # context
224
-
225
- =begin
226
- context 'Grammar without undefined symbols:' do
227
- it 'should mark all its nonterminals as not undefined' do
228
- nonterms = subject.non_terminals
229
- nonterms.each do |nterm|
230
- expect(nterm).not_to be_undefined
231
- end
232
- end
233
- end # context
234
-
235
- context 'Grammar with undefined symbols:' do
236
- subject do
237
- productions = [prod_S, prod_A1, prod_A2, prod_A3]
238
- Grammar.new(productions)
239
- end
240
-
241
- it 'should detect its nonterminals that are undefined' do
242
- nonterms = subject.non_terminals
243
- culprits = nonterms.select do |nterm|
244
- nterm.undefined?
245
- end
246
-
247
- expect(culprits.size).to eq(1)
248
- expect(culprits[0]).to eq(nt_C)
249
- end
250
- end # context
251
- =end
252
-
221
+ end # context
253
222
  end # describe
254
223
  end # module
255
224
  end # module
@@ -114,7 +114,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
114
114
  it 'should reject an invalid shortcut edge' do
115
115
  err = StandardError
116
116
  err_msg = 'Invalid shortcut argument'
117
- expect { subject.shortcut = 'invalid'}.to raise_error(err, err_msg)
117
+ expect { subject.shortcut = 'invalid' }.to raise_error(err, err_msg)
118
118
  end
119
119
  end # context
120
120
  end # describe
@@ -27,7 +27,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
27
27
  end
28
28
 
29
29
  let(:sample_tokens) do
30
- build_token_sequence(%w(a b b b), grammar_sppf)
30
+ build_token_sequence(%w[a b b b], grammar_sppf)
31
31
  end
32
32
 
33
33
  # A forest with just a root node
@@ -238,8 +238,8 @@ module Rley # Open this namespace to avoid module qualifier prefixes
238
238
  expectations = [
239
239
  [:before_ptree, [grm_abc_ptree1]],
240
240
  # TODO: fix this test
241
- #[:before_subnodes, [root, children]],
242
- #[:before_non_terminal, [root]],
241
+ # [:before_subnodes, [root, children]],
242
+ # [:before_non_terminal, [root]],
243
243
 
244
244
  # [:before_non_terminal, [big_a_1]],
245
245
  # [:before_subnodes, [big_a_1, big_a_1_children]],
@@ -36,15 +36,17 @@ module Rley # Open this namespace to avoid module qualifier prefixes
36
36
  describe ExpectationNotMet do
37
37
  let(:err_token) { double('fake-token') }
38
38
  let(:terminals) do
39
- ['PLUS', 'LPAREN'].map { |name| Syntax::Terminal.new(name) }
39
+ %w[PLUS LPAREN].map { |name| Syntax::Terminal.new(name) }
40
40
  end
41
41
 
42
42
  # Default instantiation rule
43
- subject { ExpectationNotMet.new(3, err_token, terminals) }
43
+ subject { ExpectationNotMet.new(3, err_token, terminals) }
44
44
 
45
45
  context 'Initialization:' do
46
46
  it 'should be created with arguments' do
47
- expect { ExpectationNotMet.new(3, err_token, terminals) }.not_to raise_error
47
+ expect do
48
+ ExpectationNotMet.new(3, err_token, terminals)
49
+ end.not_to raise_error
48
50
  end
49
51
 
50
52
  it 'should know the error position' do
@@ -57,21 +59,22 @@ module Rley # Open this namespace to avoid module qualifier prefixes
57
59
  end # context
58
60
  end # describe
59
61
 
60
-
61
62
  describe UnexpectedToken do
62
- let(:err_lexeme) { '-'}
63
+ let(:err_lexeme) { '-' }
63
64
  let(:err_terminal) { Syntax::Terminal.new('MINUS') }
64
65
  let(:err_token) { Tokens::Token.new(err_lexeme, err_terminal) }
65
66
  let(:terminals) do
66
- ['PLUS', 'LPAREN'].map { |name| Syntax::Terminal.new(name) }
67
+ %w[PLUS LPAREN].map { |name| Syntax::Terminal.new(name) }
67
68
  end
68
69
 
69
70
  # Default instantiation rule
70
- subject { UnexpectedToken.new(3, err_token, terminals) }
71
+ subject { UnexpectedToken.new(3, err_token, terminals) }
71
72
 
72
73
  context 'Initialization:' do
73
74
  it 'should be created with arguments' do
74
- expect { UnexpectedToken.new(3, err_token, terminals) }.not_to raise_error
75
+ expect do
76
+ UnexpectedToken.new(3, err_token, terminals)
77
+ end.not_to raise_error
75
78
  end
76
79
  end # context
77
80
 
@@ -85,22 +88,24 @@ MSG_END
85
88
  expect(subject.message).to eq(text.chomp)
86
89
  end
87
90
  end # context
88
- end #describe
91
+ end # describe
89
92
 
90
93
  describe PrematureInputEnd do
91
- let(:err_lexeme) { '+'}
94
+ let(:err_lexeme) { '+' }
92
95
  let(:err_terminal) { Syntax::Terminal.new('PLUS') }
93
96
  let(:err_token) { Tokens::Token.new(err_lexeme, err_terminal) }
94
97
  let(:terminals) do
95
- ['INT', 'LPAREN'].map { |name| Syntax::Terminal.new(name) }
98
+ %w[INT LPAREN].map { |name| Syntax::Terminal.new(name) }
96
99
  end
97
100
 
98
101
  # Default instantiation rule
99
- subject { PrematureInputEnd.new(3, err_token, terminals) }
102
+ subject { PrematureInputEnd.new(3, err_token, terminals) }
100
103
 
101
104
  context 'Initialization:' do
102
105
  it 'should be created with arguments' do
103
- expect { PrematureInputEnd.new(3, err_token, terminals) }.not_to raise_error
106
+ expect do
107
+ PrematureInputEnd.new(3, err_token, terminals)
108
+ end.not_to raise_error
104
109
  end
105
110
  end # context
106
111
 
@@ -117,4 +122,4 @@ MSG_END
117
122
  end # describe
118
123
  end # module
119
124
  end # module
120
- # End of file
125
+ # End of file
@@ -38,7 +38,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
38
38
  end
39
39
 
40
40
  let(:token_seq) do
41
- literals = %w(a a b c c)
41
+ literals = %w[a a b c c]
42
42
  literals.map { |lexeme| Tokens::Token.new(lexeme, nil) }
43
43
  end
44
44
 
@@ -33,7 +33,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
33
33
  end
34
34
 
35
35
  let(:grm1_tokens) do
36
- build_token_sequence(%w(a a b c c), grammar_abc)
36
+ build_token_sequence(%w[a a b c c], grammar_abc)
37
37
  end
38
38
 
39
39
 
@@ -116,7 +116,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
116
116
  'A => . b | 0' # start rule
117
117
  ]
118
118
  compare_entry_texts(parse_result.chart[0], expected)
119
- expected_terminals(parse_result.chart[0], %w(a b))
119
+ expected_terminals(parse_result.chart[0], %w[a b])
120
120
 
121
121
  ######################
122
122
  # Expectation chart[1]:
@@ -129,7 +129,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
129
129
  entry_set_1 = parse_result.chart[1]
130
130
  expect(entry_set_1.entries.size).to eq(4)
131
131
  compare_entry_texts(entry_set_1, expected)
132
- expected_terminals(parse_result.chart[1], %w(a b))
132
+ expected_terminals(parse_result.chart[1], %w[a b])
133
133
 
134
134
  ######################
135
135
  # Expectation chart[2]:
@@ -142,7 +142,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
142
142
  entry_set_2 = parse_result.chart[2]
143
143
  expect(entry_set_2.entries.size).to eq(4)
144
144
  compare_entry_texts(entry_set_2, expected)
145
- expected_terminals(parse_result.chart[2], %w(a b))
145
+ expected_terminals(parse_result.chart[2], %w[a b])
146
146
 
147
147
  ######################
148
148
  # Expectation chart[3]:
@@ -154,7 +154,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
154
154
  entry_set_3 = parse_result.chart[3]
155
155
  expect(entry_set_3.entries.size).to eq(3)
156
156
  compare_entry_texts(entry_set_3, expected)
157
- expected_terminals(parse_result.chart[3], %w(c))
157
+ expected_terminals(parse_result.chart[3], ['c'])
158
158
 
159
159
 
160
160
  ######################
@@ -167,7 +167,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
167
167
  entry_set_4 = parse_result.chart[4]
168
168
  expect(entry_set_4.entries.size).to eq(3)
169
169
  compare_entry_texts(entry_set_4, expected)
170
- expected_terminals(parse_result.chart[4], %w(c))
170
+ expected_terminals(parse_result.chart[4], ['c'])
171
171
 
172
172
  ######################
173
173
  # Expectation chart[5]:
@@ -286,7 +286,7 @@ module Rley # Open this namespace to avoid module qualifier prefixes
286
286
 
287
287
  builder = Syntax::GrammarBuilder.new
288
288
  builder.add_terminals(t_x)
289
- builder.add_production('Ss' => %w(A A x))
289
+ builder.add_production('Ss' => %w[A A x])
290
290
  builder.add_production('A' => [])
291
291
  tokens = [ Tokens::Token.new('x', t_x) ]
292
292
 
@@ -331,8 +331,8 @@ module Rley # Open this namespace to avoid module qualifier prefixes
331
331
  builder = Syntax::GrammarBuilder.new do
332
332
  add_terminals(t_int, t_plus, t_star)
333
333
  rule 'P' => 'S'
334
- rule 'S' => %w(S + S)
335
- rule 'S' => %w(S * S)
334
+ rule 'S' => %w[S + S]
335
+ rule 'S' => %w[S * S]
336
336
  rule 'S' => 'L'
337
337
  rule 'L' => 'integer'
338
338
  end
@@ -555,14 +555,14 @@ module Rley # Open this namespace to avoid module qualifier prefixes
555
555
 
556
556
  it 'should parse an invalid simple input' do
557
557
  # Parse an erroneous input (b is missing)
558
- wrong = build_token_sequence(%w(a a c c), grammar_abc)
558
+ wrong = build_token_sequence(%w[a a c c], grammar_abc)
559
559
  parse_result = subject.parse(wrong)
560
560
  expect(parse_result.success?).to eq(false)
561
561
  err_msg = <<-MSG
562
562
  Syntax error at or near token 3 >>>c<<<
563
563
  Expected one of: ['a', 'b'], found a 'c' instead.
564
564
  MSG
565
- expect(parse_result.failure_reason.message).to eq(err_msg.chomp)
565
+ expect(parse_result.failure_reason.message).to eq(err_msg.chomp)
566
566
  end
567
567
 
568
568
  it 'should report error when no input provided but was required' do
@@ -729,7 +729,7 @@ MSG
729
729
  builder = Syntax::GrammarBuilder.new do
730
730
  add_terminals(t_a, t_star, t_slash)
731
731
  rule 'Z' => 'E'
732
- rule 'E' => %w(E Q F)
732
+ rule 'E' => %w[E Q F]
733
733
  rule 'E' => 'F'
734
734
  rule 'F' => t_a
735
735
  rule 'Q' => t_star
@@ -737,7 +737,7 @@ MSG
737
737
  rule 'Q' => [] # Empty production
738
738
  end
739
739
 
740
- tokens = build_token_sequence(%w(a a / a), builder.grammar)
740
+ tokens = build_token_sequence(%w[a a / a], builder.grammar)
741
741
  instance = GFGEarleyParser.new(builder.grammar)
742
742
  expect { instance.parse(tokens) }.not_to raise_error
743
743
  parse_result = instance.parse(tokens)
@@ -843,10 +843,10 @@ MSG
843
843
  # input tokens
844
844
  builder = Syntax::GrammarBuilder.new
845
845
  builder.add_terminals('a')
846
- builder.add_production('S' => %w(a S))
846
+ builder.add_production('S' => %w[a S])
847
847
  builder.add_production('S' => [])
848
848
  grammar = builder.grammar
849
- tokens = build_token_sequence(%w(a a a a), grammar)
849
+ tokens = build_token_sequence(%w[a a a a], grammar)
850
850
 
851
851
  instance = GFGEarleyParser.new(grammar)
852
852
  parse_result = instance.parse(tokens)
@@ -42,10 +42,10 @@ module Rley # Open this namespace to avoid module qualifier prefixes
42
42
  end
43
43
 
44
44
  let(:grm1_tokens) do
45
- build_token_sequence(%w(a a b c c), grm1)
45
+ build_token_sequence(%w[a a b c c], grm1)
46
46
  end
47
47
 
48
- let(:grm1_token_b) { build_token_sequence(%w(b), grm1) }
48
+ let(:grm1_token_b) { build_token_sequence(['b'], grm1) }
49
49
 
50
50
  # Helper method. Create an array of dotted items
51
51
  # from the abc grammar
@@ -297,7 +297,7 @@ SNIPPET
297
297
  end
298
298
 
299
299
  let(:token_seq1) do
300
- %w(a a b c c).map do |letter|
300
+ %w[a a b c c].map do |letter|
301
301
  Tokens::Token.new(letter, sample_grammar1.name2symbol[letter])
302
302
  end
303
303
  end