rley 0.8.08 → 0.8.09

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55b425fac78001960b95935a8dc8de88d1c0826bea5fba5fae72455f53cb084a
4
- data.tar.gz: fdf0f9ed39985923134cd3ecc4bdd9325c9aab783437ab1d61a07e333ad3f2eb
3
+ metadata.gz: 9734bc9875c8931a5cd5c5497df1a77a3c938076c86d2748557b8ec901d09de6
4
+ data.tar.gz: 20a2a6a9b88752645cf731f6790b7f89729fb108f13701048a6cc8a2c65521f6
5
5
  SHA512:
6
- metadata.gz: e63b7a5df081fa326b48f7f2e2cedbaf877ed377927e408278e3c8078a30fdcc69714ff234ba98dccc1eb3b05eaea53ebb39846a43e2cb794b883d91ce1c6953
7
- data.tar.gz: e60bc7b045fe8d7203ddf26ecd603646137d43cbbbe79b533b2088c0f7d15bb46bc1dd58ae4d811ba8d78327fdcb0045cfddec4d708a76968d33c1602bf71cf4
6
+ metadata.gz: e203c3d6cf1b4f8b32a16af06ffe2a4548f8a53c37a2677fd13e8b3695a1e482f7d46177b3861d0b5c5b6139827133d09d1213821a7ec91b8dd805fcf3eac4dd
7
+ data.tar.gz: 43be3973376040fed3a9db55207d68171a0a6084ad9a102abcd26f47d60600c8aa9165a134c67b0f443e73e4e0cdd2d5a65e5271f63081a21f83aea0550b4474
data/.rubocop.yml CHANGED
@@ -5,6 +5,9 @@ AllCops:
5
5
  Gemspec/DateAssignment:
6
6
  Enabled: true
7
7
 
8
+ Gemspec/RequireMFA: # new in 1.23
9
+ Enabled: false
10
+
8
11
  Layout/ArgumentAlignment:
9
12
  Enabled: false
10
13
 
@@ -161,6 +164,9 @@ Lint/UnusedMethodArgument:
161
164
  Lint/UselessAccessModifier:
162
165
  Enabled: true
163
166
 
167
+ Lint/UselessRuby2Keywords: # new in 1.23
168
+ Enabled: true
169
+
164
170
  Lint/Void:
165
171
  Enabled: false
166
172
 
@@ -200,6 +206,9 @@ Metrics/ModuleLength:
200
206
  Metrics/PerceivedComplexity:
201
207
  Enabled: false
202
208
 
209
+ Naming/BlockForwarding: # new in 1.24
210
+ Enabled: true
211
+
203
212
  Naming/ConstantName:
204
213
  Enabled: false
205
214
 
@@ -278,6 +287,12 @@ Style/ExpandPathArguments:
278
287
  Style/ExponentialNotation:
279
288
  Enabled: true
280
289
 
290
+ Style/FileRead: # new in 1.24
291
+ Enabled: true
292
+
293
+ Style/FileWrite: # new in 1.24
294
+ Enabled: true
295
+
281
296
  Style/GuardClause:
282
297
  Enabled: false
283
298
 
@@ -302,6 +317,9 @@ Style/InPatternThen:
302
317
  Style/InverseMethods:
303
318
  Enabled: false
304
319
 
320
+ Style/MapToHash: # new in 1.24
321
+ Enabled: true
322
+
305
323
  Style/MissingRespondToMissing:
306
324
  Enabled: false
307
325
 
@@ -326,6 +344,9 @@ Style/NumberedParametersLimit:
326
344
  Style/NumericLiterals:
327
345
  Enabled: false
328
346
 
347
+ Style/OpenStructUse: # new in 1.23
348
+ Enabled: true
349
+
329
350
  Style/QuotedSymbols:
330
351
  Enabled: true
331
352
 
@@ -349,9 +370,9 @@ Style/RegexpLiteral:
349
370
 
350
371
  Style/PercentLiteralDelimiters:
351
372
  Enabled: false
352
-
373
+
353
374
  Style/SelectByRegexp:
354
- Enabled: true
375
+ Enabled: true
355
376
 
356
377
  Style/StderrPuts:
357
378
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,7 +1,14 @@
1
+ ### 0.8.09 / 2022-01-28
2
+ - Added code for coming tutorial
3
+
4
+ * [NEW] Folder `tutorial` contains code used in tutorial (in wiki)
5
+ * [NEW] Folders `TOML\iter_1` .. `TOML\iter_2` contains code for a TOML parser
6
+ * [CHANGE] File `.rubocop.yml` updated to take into account new 1.25 cops.
7
+ * [CHANGE] File `.rubocop.yml` updated to take into account new 1.25 cops.
8
+
1
9
  ### 0.8.08 / 2021-10-31
2
10
  - Fixes in example files, Refactored module `Notation` renamed `to `RGN´
3
11
 
4
-
5
12
  * [CHANGE] Module `Notation` changed to `RGN`.
6
13
 
7
14
  * [FIX] `examples/general/calc_iter1/CalcLexer#initialize` now strips whitespaces at end of expression to parse.
@@ -21,7 +28,7 @@
21
28
 
22
29
  * [NEW] Folder `example\tokenizer` contains an example with a scanner that was generated.
23
30
  * [NEW] Class `Rley::Lexical::Literal` a specialization of Token class for literal tokens.
24
- * [CHANGE] File `.rubocp.yml` updated to take into account new 1.21 and 1.22 cops.
31
+ * [CHANGE] File `.rubocop.yml` updated to take into account new 1.21 and 1.22 cops.
25
32
  * [DELETED] Class `Rley::Parser::ParserTracer` this class was no more in use.
26
33
  * [DELETED] Class `Rley::Syntax::Literal` this class was unused.
27
34
  * [DELETED] Class `Rley::Syntax::VerbatimSymbol` this class was unused.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2021 Dimitri Geshef
1
+ Copyright (c) 2014-2022 Dimitri Geshef
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -458,5 +458,5 @@ standard parser textbooks. Here are a few references (and links) of papers on GF
458
458
 
459
459
  Copyright
460
460
  ---------
461
- Copyright (c) 2014-2020, Dimitri Geshef.
461
+ Copyright (c) 2014-2022, Dimitri Geshef.
462
462
  __Rley__ is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Rley/blob/master/LICENSE.txt) for details.
@@ -5,7 +5,7 @@
5
5
 
6
6
  module Rley # Module used as a namespace
7
7
  # The version number of the gem.
8
- Version = '0.8.08'
8
+ Version = '0.8.09'
9
9
 
10
10
  # Brief description of the gem.
11
11
  Description = "Ruby implementation of the Earley's parsing algorithm"
@@ -36,7 +36,7 @@ module Rley
36
36
 
37
37
  # Abstract method (must be overriden in subclasses).
38
38
  # Part of the 'visitee' role in Visitor design pattern.
39
- # @param _visitor [LoxxyTreeVisitor] the visitor
39
+ # @param _visitor [ASTVisitor] the visitor
40
40
  def accept(_visitor)
41
41
  raise NotImplementedError
42
42
  end
@@ -35,9 +35,9 @@ module Rley
35
35
  @engine.use_grammar(Rley::RGN::RGNGrammar)
36
36
  end
37
37
 
38
- # Parse the given Lox program into a parse tree.
39
- # @param source [String] Lox program to parse
40
- # @return [Rley::ParseTree] A parse tree equivalent to the Lox input.
38
+ # Parse the given RGN snippet into a parse tree.
39
+ # @param source [String] Snippet to parse
40
+ # @return [Rley::ParseTree] A parse tree equivalent to the RGN input.
41
41
  def parse(source)
42
42
  lexer = Tokenizer.new(source)
43
43
  result = engine.parse(lexer.tokens)
@@ -28,7 +28,7 @@ module Rley
28
28
 
29
29
  # Abstract method (must be overriden in subclasses).
30
30
  # Part of the 'visitee' role in Visitor design pattern.
31
- # @param visitor [LoxxyTreeVisitor] the visitor
31
+ # @param visitor [RGN::ASTVisitor] the visitor
32
32
  def accept(visitor)
33
33
  visitor.visit_symbol_node(self)
34
34
  end
@@ -41,15 +41,15 @@ module Rley
41
41
  match_closest repeat
42
42
  ].map { |x| [x, x] }.to_h
43
43
 
44
- # Constructor. Initialize a tokenizer for Lox input.
45
- # @param source [String] Lox text to tokenize.
44
+ # Constructor. Initialize a tokenizer for RGN input.
45
+ # @param source [String] RGN text to tokenize.
46
46
  def initialize(source = nil)
47
47
  @scanner = StringScanner.new('')
48
48
  start_with(source) if source
49
49
  end
50
50
 
51
51
  # Reset the tokenizer and make the given text, the current input.
52
- # @param source [String] Lox text to tokenize.
52
+ # @param source [String] RGN text to tokenize.
53
53
  def start_with(source)
54
54
  @scanner.string = source
55
55
  @lineno = 1
@@ -8,10 +8,6 @@ module Rley # This module is used as a namespace
8
8
  # @return [String] The name of the grammar symbol
9
9
  attr_reader(:name)
10
10
 
11
- # An indicator that tells whether the grammar symbol can generate a
12
- # non-empty string of terminals.
13
- attr_writer(:generative)
14
-
15
11
  # Constructor.
16
12
  # aName [String] The name of the grammar symbol.
17
13
  def initialize(aName)
@@ -7,6 +7,10 @@ module Rley # This module is used as a namespace
7
7
  # A non-terminal symbol (sometimes called a syntactic variable) represents
8
8
  # a composition of terminal or non-terminal symbols
9
9
  class NonTerminal < GrmSymbol
10
+ # An indicator that tells whether the grammar symbol can generate a
11
+ # non-empty string of terminals.
12
+ attr_writer(:generative)
13
+
10
14
  # A non-terminal symbol is nullable if it can match an empty string.
11
15
  attr_writer(:nullable)
12
16
 
@@ -7,25 +7,29 @@ module Rley # This module is used as a namespace
7
7
  # A terminal symbol represents a class of words in the language
8
8
  # defined the grammar.
9
9
  class Terminal < GrmSymbol
10
- # Constructor.
11
- # @param aName [String] The name of the grammar symbol.
12
- def initialize(aName)
13
- super(aName)
14
- self.generative = true
10
+ # An indicator that tells whether the grammar symbol can generate a
11
+ # non-empty string of terminals.
12
+ # @return [TrueClass]
13
+ def generative?
14
+ true
15
15
  end
16
16
 
17
17
  # Return true iff the symbol is a terminal
18
+ # @return [TrueClass]
18
19
  def terminal?
19
- return true
20
+ true
20
21
  end
21
22
 
22
23
  # @return [false] Return true if the symbol derives
23
24
  # the empty string. As terminal symbol corresponds to a input token
24
25
  # it is by definition non-nullable.
26
+ # @return [FalseClass]
25
27
  def nullable?
26
28
  false
27
29
  end
28
30
 
31
+ # Return a readable text representation of the instance
32
+ # @return [String] The symbol name
29
33
  def to_s
30
34
  name
31
35
  end
@@ -22,7 +22,6 @@ require_relative '../support/expectation_helper'
22
22
  require_relative '../../../lib/rley/parser/gfg_earley_parser'
23
23
 
24
24
  module Rley # Open this namespace to avoid module qualifier prefixes
25
- # rubocop: disable Metrics/BlockLength
26
25
  module Parser # Open this namespace to avoid module qualifier prefixes
27
26
  describe GFGEarleyParser do
28
27
  include GrammarABCHelper # Mix-in module with builder for grammar abc
@@ -1038,6 +1037,5 @@ MSG
1038
1037
  end # context
1039
1038
  end # describe
1040
1039
  end # module
1041
- # rubocop: enable Metrics/BlockLength
1042
1040
  end # module
1043
1041
  # End of file
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.8.08
4
+ version: 0.8.09
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Geshef
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-31 00:00:00.000000000 Z
11
+ date: 2022-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -303,7 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  - !ruby/object:Gem::Version
304
304
  version: '0'
305
305
  requirements: []
306
- rubygems_version: 3.1.4
306
+ rubygems_version: 3.3.3
307
307
  signing_key:
308
308
  specification_version: 4
309
309
  summary: Ruby implementation of the Earley's parsing algorithm
@@ -330,14 +330,6 @@ test_files:
330
330
  - spec/rley/lexical/literal_spec.rb
331
331
  - spec/rley/lexical/token_range_spec.rb
332
332
  - spec/rley/lexical/token_spec.rb
333
- - spec/rley/parser/dangling_else_spec.rb
334
- - spec/rley/parser/error_reason_spec.rb
335
- - spec/rley/parser/gfg_chart_spec.rb
336
- - spec/rley/parser/gfg_earley_parser_spec.rb
337
- - spec/rley/parser/gfg_parsing_spec.rb
338
- - spec/rley/parser/parse_entry_set_spec.rb
339
- - spec/rley/parser/parse_entry_spec.rb
340
- - spec/rley/parser/parse_walker_factory_spec.rb
341
333
  - spec/rley/parse_forest_visitor_spec.rb
342
334
  - spec/rley/parse_rep/ambiguous_parse_spec.rb
343
335
  - spec/rley/parse_rep/ast_builder_spec.rb
@@ -347,6 +339,14 @@ test_files:
347
339
  - spec/rley/parse_rep/parse_forest_factory_spec.rb
348
340
  - spec/rley/parse_rep/parse_tree_factory_spec.rb
349
341
  - spec/rley/parse_tree_visitor_spec.rb
342
+ - spec/rley/parser/dangling_else_spec.rb
343
+ - spec/rley/parser/error_reason_spec.rb
344
+ - spec/rley/parser/gfg_chart_spec.rb
345
+ - spec/rley/parser/gfg_earley_parser_spec.rb
346
+ - spec/rley/parser/gfg_parsing_spec.rb
347
+ - spec/rley/parser/parse_entry_set_spec.rb
348
+ - spec/rley/parser/parse_entry_spec.rb
349
+ - spec/rley/parser/parse_walker_factory_spec.rb
350
350
  - spec/rley/ptree/non_terminal_node_spec.rb
351
351
  - spec/rley/ptree/parse_tree_node_spec.rb
352
352
  - spec/rley/ptree/parse_tree_spec.rb