rley 0.8.06 → 0.8.08

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/appveyor.yml +1 -3
  4. data/examples/NLP/benchmark_pico_en.rb +6 -6
  5. data/examples/NLP/engtagger.rb +6 -6
  6. data/examples/general/calc_iter1/calc_lexer.rb +1 -1
  7. data/examples/general/calc_iter2/calc_lexer.rb +1 -1
  8. data/examples/general/left.rb +1 -1
  9. data/examples/general/right.rb +1 -1
  10. data/examples/tokenizer/loxxy_raw_scanner.rex.rb +3 -0
  11. data/examples/tokenizer/loxxy_tokenizer.rb +2 -2
  12. data/examples/tokenizer/run_tokenizer.rb +1 -1
  13. data/examples/tokenizer/{tokens.yaml → tokens.yml} +0 -0
  14. data/lib/rley/constants.rb +1 -1
  15. data/lib/rley/engine.rb +2 -2
  16. data/lib/rley/interface.rb +3 -3
  17. data/lib/rley/lexical/token.rb +1 -1
  18. data/lib/rley/ptree/non_terminal_node.rb +1 -1
  19. data/lib/rley/rgn/all_notation_nodes.rb +5 -0
  20. data/lib/rley/{notation → rgn}/ast_builder.rb +19 -12
  21. data/lib/rley/{notation → rgn}/ast_node.rb +12 -11
  22. data/lib/rley/{notation → rgn}/ast_visitor.rb +10 -10
  23. data/lib/rley/rgn/composite_node.rb +28 -0
  24. data/lib/rley/{notation → rgn}/grammar.rb +1 -1
  25. data/lib/rley/{notation → rgn}/grammar_builder.rb +86 -124
  26. data/lib/rley/{notation → rgn}/parser.rb +4 -4
  27. data/lib/rley/rgn/repetition_node.rb +62 -0
  28. data/lib/rley/rgn/sequence_node.rb +30 -0
  29. data/lib/rley/{notation → rgn}/symbol_node.rb +15 -7
  30. data/lib/rley/{notation → rgn}/tokenizer.rb +1 -1
  31. data/spec/rley/parser/dangling_else_spec.rb +3 -3
  32. data/spec/rley/parser/gfg_earley_parser_spec.rb +48 -48
  33. data/spec/rley/{notation → rgn}/grammar_builder_spec.rb +58 -54
  34. data/spec/rley/{notation → rgn}/parser_spec.rb +36 -24
  35. data/spec/rley/rgn/repetition_node_spec.rb +56 -0
  36. data/spec/rley/rgn/sequence_node_spec.rb +48 -0
  37. data/spec/rley/rgn/symbol_node_spec.rb +33 -0
  38. data/spec/rley/{notation → rgn}/tokenizer_spec.rb +2 -2
  39. data/spec/rley/support/ambiguous_grammar_helper.rb +2 -2
  40. data/spec/rley/support/grammar_int_seq_helper.rb +2 -2
  41. metadata +31 -24
  42. data/lib/rley/notation/all_notation_nodes.rb +0 -4
  43. data/lib/rley/notation/grouping_node.rb +0 -23
  44. data/lib/rley/notation/sequence_node.rb +0 -35
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'sequence_node'
4
-
5
- module Rley
6
- module Notation
7
- # A syntax node representing an expression bracketed by parentheses.
8
- class GroupingNode < SequenceNode
9
- # @param aPosition [Rley::Lexical::Position] Start position.
10
- # @param sequence [Array<ASTNode>] sequence of AST nodes
11
- # @param theRepetition [Symbol] indicates how many times the symbol can be repeated
12
- def initialize(aPosition, sequence, theRepetition = nil)
13
- super(aPosition, sequence, theRepetition)
14
- end
15
-
16
- # Part of the 'visitee' role in Visitor design pattern.
17
- # @param visitor [Notation::ASTVisitor] the visitor
18
- def accept(visitor)
19
- visitor.visit_grouping_node(self)
20
- end
21
- end # class
22
- end # module
23
- end # module
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'ast_node'
4
-
5
- module Rley
6
- module Notation
7
- # A syntax node for a sequence of AST nodes
8
- class SequenceNode < ASTNode
9
- # @return [Array<ASTNode>]
10
- attr_reader :subnodes
11
-
12
- attr_accessor :constraints
13
-
14
- # @param aPosition [Rley::Lexical::Position] Start position.
15
- # @param sequence [Array<ASTNode>] sequence of AST nodes
16
- # @param theRepetition [Symbol] indicates how many times the symbol can be repeated
17
- def initialize(aPosition, sequence, theRepetition = nil)
18
- super(aPosition)
19
- @subnodes = sequence
20
- self.repetition = theRepetition if theRepetition
21
- @constraints = []
22
- end
23
-
24
- def size
25
- subnodes.size
26
- end
27
-
28
- # Part of the 'visitee' role in Visitor design pattern.
29
- # @param visitor [Notation::ASTVisitor] the visitor
30
- def accept(visitor)
31
- visitor.visit_sequence_node(self)
32
- end
33
- end # class
34
- end # module
35
- end # module