rley 0.8.06 → 0.8.08
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/appveyor.yml +1 -3
- data/examples/NLP/benchmark_pico_en.rb +6 -6
- data/examples/NLP/engtagger.rb +6 -6
- data/examples/general/calc_iter1/calc_lexer.rb +1 -1
- data/examples/general/calc_iter2/calc_lexer.rb +1 -1
- data/examples/general/left.rb +1 -1
- data/examples/general/right.rb +1 -1
- data/examples/tokenizer/loxxy_raw_scanner.rex.rb +3 -0
- data/examples/tokenizer/loxxy_tokenizer.rb +2 -2
- data/examples/tokenizer/run_tokenizer.rb +1 -1
- data/examples/tokenizer/{tokens.yaml → tokens.yml} +0 -0
- data/lib/rley/constants.rb +1 -1
- data/lib/rley/engine.rb +2 -2
- data/lib/rley/interface.rb +3 -3
- data/lib/rley/lexical/token.rb +1 -1
- data/lib/rley/ptree/non_terminal_node.rb +1 -1
- data/lib/rley/rgn/all_notation_nodes.rb +5 -0
- data/lib/rley/{notation → rgn}/ast_builder.rb +19 -12
- data/lib/rley/{notation → rgn}/ast_node.rb +12 -11
- data/lib/rley/{notation → rgn}/ast_visitor.rb +10 -10
- data/lib/rley/rgn/composite_node.rb +28 -0
- data/lib/rley/{notation → rgn}/grammar.rb +1 -1
- data/lib/rley/{notation → rgn}/grammar_builder.rb +86 -124
- data/lib/rley/{notation → rgn}/parser.rb +4 -4
- data/lib/rley/rgn/repetition_node.rb +62 -0
- data/lib/rley/rgn/sequence_node.rb +30 -0
- data/lib/rley/{notation → rgn}/symbol_node.rb +15 -7
- data/lib/rley/{notation → rgn}/tokenizer.rb +1 -1
- data/spec/rley/parser/dangling_else_spec.rb +3 -3
- data/spec/rley/parser/gfg_earley_parser_spec.rb +48 -48
- data/spec/rley/{notation → rgn}/grammar_builder_spec.rb +58 -54
- data/spec/rley/{notation → rgn}/parser_spec.rb +36 -24
- data/spec/rley/rgn/repetition_node_spec.rb +56 -0
- data/spec/rley/rgn/sequence_node_spec.rb +48 -0
- data/spec/rley/rgn/symbol_node_spec.rb +33 -0
- data/spec/rley/{notation → rgn}/tokenizer_spec.rb +2 -2
- data/spec/rley/support/ambiguous_grammar_helper.rb +2 -2
- data/spec/rley/support/grammar_int_seq_helper.rb +2 -2
- metadata +31 -24
- data/lib/rley/notation/all_notation_nodes.rb +0 -4
- data/lib/rley/notation/grouping_node.rb +0 -23
- 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
|