rley 0.6.00 → 0.6.01
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 +8 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -1
- data/examples/NLP/benchmark_pico_en.rb +6 -10
- data/examples/NLP/nano_eng/nano_en_demo.rb +2 -2
- data/examples/NLP/nano_eng/nano_grammar.rb +1 -2
- data/examples/data_formats/JSON/json_ast_builder.rb +8 -8
- data/examples/general/SRL/lib/ast_builder.rb +74 -72
- data/examples/general/SRL/lib/grammar.rb +2 -2
- data/examples/general/SRL/lib/regex/abstract_method.rb +28 -28
- data/examples/general/SRL/lib/regex/alternation.rb +21 -25
- data/examples/general/SRL/lib/regex/anchor.rb +6 -9
- data/examples/general/SRL/lib/regex/atomic_expression.rb +10 -15
- data/examples/general/SRL/lib/regex/capturing_group.rb +15 -14
- data/examples/general/SRL/lib/regex/char_class.rb +10 -13
- data/examples/general/SRL/lib/regex/char_range.rb +45 -46
- data/examples/general/SRL/lib/regex/char_shorthand.rb +8 -9
- data/examples/general/SRL/lib/regex/character.rb +196 -191
- data/examples/general/SRL/lib/regex/compound_expression.rb +47 -50
- data/examples/general/SRL/lib/regex/concatenation.rb +23 -27
- data/examples/general/SRL/lib/regex/expression.rb +53 -56
- data/examples/general/SRL/lib/regex/lookaround.rb +23 -20
- data/examples/general/SRL/lib/regex/match_option.rb +26 -28
- data/examples/general/SRL/lib/regex/monadic_expression.rb +20 -23
- data/examples/general/SRL/lib/regex/multiplicity.rb +17 -20
- data/examples/general/SRL/lib/regex/non_capturing_group.rb +9 -12
- data/examples/general/SRL/lib/regex/polyadic_expression.rb +51 -55
- data/examples/general/SRL/lib/regex/quantifiable.rb +14 -20
- data/examples/general/SRL/lib/regex/repetition.rb +20 -23
- data/examples/general/SRL/lib/regex/wildcard.rb +15 -19
- data/examples/general/SRL/lib/regex_repr.rb +1 -1
- data/examples/general/SRL/lib/tokenizer.rb +2 -2
- data/examples/general/SRL/spec/integration_spec.rb +17 -12
- data/examples/general/SRL/spec/regex/character_spec.rb +160 -153
- data/examples/general/SRL/spec/regex/multiplicity_spec.rb +27 -31
- data/examples/general/SRL/spec/spec_helper.rb +1 -1
- data/examples/general/SRL/spec/tokenizer_spec.rb +25 -27
- data/examples/general/calc_iter1/calc_ast_builder.rb +10 -10
- data/examples/general/calc_iter2/calc_ast_builder.rb +7 -9
- data/examples/general/calc_iter2/calc_ast_nodes.rb +5 -6
- data/examples/general/calc_iter2/calc_lexer.rb +3 -5
- data/examples/general/calc_iter2/spec/calculator_spec.rb +16 -14
- data/examples/general/left.rb +8 -8
- data/examples/general/right.rb +8 -8
- data/lib/rley/constants.rb +1 -1
- data/lib/rley/engine.rb +16 -20
- data/lib/rley/formatter/json.rb +1 -1
- data/lib/rley/gfg/grm_flow_graph.rb +1 -1
- data/lib/rley/gfg/item_vertex.rb +6 -5
- data/lib/rley/gfg/vertex.rb +3 -3
- data/lib/rley/lexical/token.rb +4 -3
- data/lib/rley/parse_rep/ast_base_builder.rb +4 -3
- data/lib/rley/parse_rep/parse_rep_creator.rb +1 -1
- data/lib/rley/parse_rep/parse_tree_builder.rb +3 -2
- data/lib/rley/parser/error_reason.rb +1 -1
- data/lib/rley/parser/gfg_chart.rb +6 -6
- data/lib/rley/parser/gfg_parsing.rb +19 -19
- data/lib/rley/parser/parse_entry.rb +3 -3
- data/lib/rley/parser/parse_entry_set.rb +1 -1
- data/lib/rley/parser/parse_walker_factory.rb +15 -15
- data/lib/rley/syntax/grammar.rb +1 -1
- data/lib/rley/syntax/grammar_builder.rb +2 -2
- data/lib/rley/syntax/production.rb +4 -3
- data/lib/rley/syntax/symbol_seq.rb +2 -2
- data/spec/rley/base/grm_items_builder_spec.rb +1 -1
- data/spec/rley/engine_spec.rb +3 -6
- data/spec/rley/formatter/asciitree_spec.rb +0 -1
- data/spec/rley/formatter/bracket_notation_spec.rb +0 -1
- data/spec/rley/formatter/debug_spec.rb +2 -3
- data/spec/rley/gfg/grm_flow_graph_spec.rb +19 -19
- data/spec/rley/parse_rep/ast_builder_spec.rb +12 -12
- data/spec/rley/parser/gfg_earley_parser_spec.rb +1 -1
- data/spec/rley/parser/parse_entry_set_spec.rb +5 -5
- data/spec/rley/parser/parse_state_spec.rb +8 -3
- data/spec/rley/parser/parse_tracer_spec.rb +3 -1
- data/spec/rley/parser/parse_walker_factory_spec.rb +1 -1
- data/spec/rley/ptree/parse_tree_node_spec.rb +1 -1
- data/spec/rley/syntax/grammar_builder_spec.rb +1 -1
- data/spec/rley/syntax/grammar_spec.rb +1 -1
- metadata +2 -3
- data/spec/rley/support/ast_builder.rb +0 -403
data/examples/general/left.rb
CHANGED
@@ -8,8 +8,8 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
8
8
|
add_terminals('DOT')
|
9
9
|
|
10
10
|
# Grammar with left recursive rule.
|
11
|
-
|
12
|
-
|
11
|
+
rule 'l_dots' => []
|
12
|
+
rule 'l_dots' => %w[l_dots DOT]
|
13
13
|
end
|
14
14
|
|
15
15
|
# And now, let's build the grammar...
|
@@ -17,12 +17,12 @@ grammar = builder.grammar
|
|
17
17
|
|
18
18
|
# Highly simplified tokenizer implementation.
|
19
19
|
def tokenizer(aText, aGrammar)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
tokens = aText.scan(/\./).map do |dot|
|
21
|
+
terminal = aGrammar.name2symbol['DOT']
|
22
|
+
Rley::Lexical::Token.new(dot, terminal)
|
23
|
+
end
|
24
24
|
|
25
|
-
|
25
|
+
return tokens
|
26
26
|
end
|
27
27
|
|
28
28
|
input_to_parse = '.' * 500 # Input = 500 consecutive dots
|
@@ -35,4 +35,4 @@ puts "Parsing successful? #{result.success?}"
|
|
35
35
|
unless result.success?
|
36
36
|
puts result.failure_reason.message
|
37
37
|
exit(1)
|
38
|
-
end
|
38
|
+
end
|
data/examples/general/right.rb
CHANGED
@@ -8,8 +8,8 @@ builder = Rley::Syntax::GrammarBuilder.new do
|
|
8
8
|
add_terminals('DOT')
|
9
9
|
|
10
10
|
# Grammar with right recursive rule.
|
11
|
-
|
12
|
-
|
11
|
+
rule 'r_dots' => []
|
12
|
+
rule 'r_dots' => %w[DOT r_dots]
|
13
13
|
end
|
14
14
|
|
15
15
|
# And now, let's build the grammar...
|
@@ -17,12 +17,12 @@ grammar = builder.grammar
|
|
17
17
|
|
18
18
|
# Highly simplified tokenizer implementation.
|
19
19
|
def tokenizer(aText, aGrammar)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
tokens = aText.scan(/\./).map do |dot|
|
21
|
+
terminal = aGrammar.name2symbol['DOT']
|
22
|
+
Rley::Lexical::Token.new(dot, terminal)
|
23
|
+
end
|
24
24
|
|
25
|
-
|
25
|
+
return tokens
|
26
26
|
end
|
27
27
|
|
28
28
|
input_to_parse = '.' * 500 # Input = 500 consecutive dots
|
@@ -35,4 +35,4 @@ puts "Parsing successful? #{result.success?}"
|
|
35
35
|
unless result.success?
|
36
36
|
puts result.failure_reason.message
|
37
37
|
exit(1)
|
38
|
-
end
|
38
|
+
end
|
data/lib/rley/constants.rb
CHANGED
data/lib/rley/engine.rb
CHANGED
@@ -22,11 +22,9 @@ module Rley # This module is used as a namespace
|
|
22
22
|
attr_reader :grammar
|
23
23
|
|
24
24
|
# Constructor.
|
25
|
-
|
26
|
-
def initialize(&aConfigBlock)
|
25
|
+
def initialize()
|
27
26
|
@configuration = EngineConfig.new
|
28
|
-
|
29
|
-
yield configuration if block_given?
|
27
|
+
yield configuration if block_given?
|
30
28
|
end
|
31
29
|
|
32
30
|
# Factory method.
|
@@ -48,12 +46,11 @@ module Rley # This module is used as a namespace
|
|
48
46
|
def parse(aTokenizer)
|
49
47
|
tokens = []
|
50
48
|
aTokenizer.each do |a_token|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
49
|
+
next unless a_token
|
50
|
+
term_name = a_token.terminal
|
51
|
+
term_symb = grammar.name2symbol[term_name]
|
52
|
+
a_token.instance_variable_set(:@terminal, term_symb)
|
53
|
+
tokens << a_token
|
57
54
|
end
|
58
55
|
parser = build_parser(grammar)
|
59
56
|
return parser.parse(tokens)
|
@@ -89,14 +86,14 @@ module Rley # This module is used as a namespace
|
|
89
86
|
# Convert raw parse result into a parse forest representation
|
90
87
|
# @param aRawParse [Parser::GFGParsing]
|
91
88
|
# def to_pforest(aRawParse)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
89
|
+
# factory = ParseRep::ParseForestFactory.new(aRawParse)
|
90
|
+
# if configuration.repr_builder == :default
|
91
|
+
# result = factory.create(nil)
|
92
|
+
# else
|
93
|
+
# result = factory.create(configuration.repr_builder)
|
94
|
+
# end
|
95
|
+
|
96
|
+
# return result
|
100
97
|
# end
|
101
98
|
|
102
99
|
# Build a visitor for the given parse tree
|
@@ -109,7 +106,7 @@ module Rley # This module is used as a namespace
|
|
109
106
|
# @param aPTree[SPPF::ParseForest]
|
110
107
|
# @return [ParseForestVisitor]
|
111
108
|
# def pforest_visitor(aPForest)
|
112
|
-
|
109
|
+
# return Rley::ParseForestVisitor.new(aPForest)
|
113
110
|
# end
|
114
111
|
|
115
112
|
protected
|
@@ -119,4 +116,3 @@ module Rley # This module is used as a namespace
|
|
119
116
|
end
|
120
117
|
end # class
|
121
118
|
end # module
|
122
|
-
|
data/lib/rley/formatter/json.rb
CHANGED
@@ -63,7 +63,7 @@ module Rley # This module is used as a namespace
|
|
63
63
|
# production.
|
64
64
|
# @return [String]
|
65
65
|
def inspect()
|
66
|
-
result = "#<#{self.class.name}:#{
|
66
|
+
result = "#<#{self.class.name}:#{object_id}"
|
67
67
|
result << ' @vertices=['
|
68
68
|
list = vertices.map { |v| "#<#{v.selfie}>" }
|
69
69
|
result << list.join(', ')
|
data/lib/rley/gfg/item_vertex.rb
CHANGED
@@ -4,13 +4,13 @@ require_relative 'vertex'
|
|
4
4
|
|
5
5
|
module Rley # This module is used as a namespace
|
6
6
|
module GFG # This module is used as a namespace
|
7
|
-
# Specialization of Vertex class. Represents a
|
7
|
+
# Specialization of Vertex class. Represents a
|
8
8
|
# vertex in a grammar flow graph associated to a given dotted item.
|
9
9
|
# Responsibilities (in addition to inherited ones):
|
10
10
|
# - Know its related non-terminal symbol
|
11
11
|
class ItemVertex < Vertex
|
12
12
|
# Link to the dotted item object
|
13
|
-
# @return [DottedItem] The corresponding dotted item
|
13
|
+
# @return [DottedItem] The corresponding dotted item
|
14
14
|
attr_reader :dotted_item
|
15
15
|
|
16
16
|
# Optional link to a "shortcut" edge.
|
@@ -65,16 +65,17 @@ module Rley # This module is used as a namespace
|
|
65
65
|
end
|
66
66
|
|
67
67
|
# Return the symbol after the dot.
|
68
|
-
# @return [Syntax::GrmSymbol, NilClass] Next grammar symbol otherwise nil.
|
68
|
+
# @return [Syntax::GrmSymbol, NilClass] Next grammar symbol otherwise nil.
|
69
69
|
def next_symbol()
|
70
70
|
return dotted_item.next_symbol
|
71
71
|
end
|
72
72
|
|
73
73
|
# Return the non-terminal symbol at the left-hand side of the production
|
74
|
-
# @return [Syntax::GrmSymbol]
|
74
|
+
# @return [Syntax::GrmSymbol]
|
75
|
+
# The non-terminal symbol at left side of production.
|
75
76
|
def lhs()
|
76
77
|
return dotted_item.lhs
|
77
|
-
end
|
78
|
+
end
|
78
79
|
end # class
|
79
80
|
end # module
|
80
81
|
end # module
|
data/lib/rley/gfg/vertex.rb
CHANGED
@@ -35,7 +35,7 @@ module Rley # This module is used as a namespace
|
|
35
35
|
result = '#<'
|
36
36
|
result << selfie
|
37
37
|
edges.each { |e| result << e.inspect }
|
38
|
-
result << specific_inspect
|
38
|
+
result << specific_inspect
|
39
39
|
result << '>'
|
40
40
|
|
41
41
|
return result
|
@@ -45,8 +45,8 @@ module Rley # This module is used as a namespace
|
|
45
45
|
# vertex without the edges.
|
46
46
|
# @return [String]
|
47
47
|
def selfie()
|
48
|
-
result = "#{self.class.name}:#{
|
49
|
-
result << %Q
|
48
|
+
result = "#{self.class.name}:#{object_id}"
|
49
|
+
result << %Q( label="#{label}")
|
50
50
|
return result
|
51
51
|
end
|
52
52
|
|
data/lib/rley/lexical/token.rb
CHANGED
@@ -7,20 +7,21 @@ module Rley # This module is used as a namespace
|
|
7
7
|
# Say, that in a particular language, the lexeme 'foo' is an occurrence
|
8
8
|
# of the terminal symbol IDENTIFIER. Then the lexer will return a Token
|
9
9
|
# object that states the fact that 'foo' is indeed an IDENTIFIER. Basically,
|
10
|
-
# a Token is a pair (lexeme, terminal): it asserts that a given lexeme
|
10
|
+
# a Token is a pair (lexeme, terminal): it asserts that a given lexeme
|
11
11
|
# is an instance of given terminal symbol.
|
12
12
|
class Token
|
13
13
|
# The sequence of character(s) from the input stream that is an occurrence
|
14
14
|
# of the related terminal symbol.
|
15
15
|
# @return [String] Input substring that is an instance of the terminal.
|
16
16
|
attr_reader(:lexeme)
|
17
|
-
|
17
|
+
|
18
18
|
# @return [Syntax::Terminal] Terminal symbol corresponding to the lexeme.
|
19
19
|
attr_reader(:terminal)
|
20
20
|
|
21
21
|
# Constructor.
|
22
22
|
# @param theLexeme [String] the lexeme (= piece of text from input)
|
23
|
-
# @param aTerminal [Syntax::Terminal]
|
23
|
+
# @param aTerminal [Syntax::Terminal]
|
24
|
+
# The terminal symbol corresponding to the lexeme.
|
24
25
|
def initialize(theLexeme, aTerminal)
|
25
26
|
raise 'Internal error: nil terminal symbol detected' if aTerminal.nil?
|
26
27
|
@lexeme = theLexeme
|
@@ -85,7 +85,7 @@ module Rley # This module is used as a namespace
|
|
85
85
|
# Factory method for creating a node object for the given
|
86
86
|
# input token.
|
87
87
|
# @param aTerminal [Syntax::Production] Relevant production rule
|
88
|
-
# @param aTerminal [Syntax::Terminal] Terminal
|
88
|
+
# @param aTerminal [Syntax::Terminal] Terminal associated with the token
|
89
89
|
# @param aTokenPosition [Integer] Position of token in the input stream
|
90
90
|
# @param aToken [Lexical::Token] The input token
|
91
91
|
def new_leaf_node(aProduction, aTerminal, aTokenPosition, aToken)
|
@@ -107,7 +107,7 @@ module Rley # This module is used as a namespace
|
|
107
107
|
# @param theChildren [Array] Children nodes (one per rhs symbol)
|
108
108
|
def new_parent_node(aProduction, aRange, theTokens, theChildren)
|
109
109
|
mth_name = method_name(aProduction.name)
|
110
|
-
if
|
110
|
+
if respond_to?(mth_name, true)
|
111
111
|
node = send(mth_name, aProduction, aRange, theTokens, theChildren)
|
112
112
|
else
|
113
113
|
# Default action...
|
@@ -117,7 +117,8 @@ module Rley # This module is used as a namespace
|
|
117
117
|
when 1
|
118
118
|
return_first_child(aRange, theTokens, theChildren)
|
119
119
|
else
|
120
|
-
|
120
|
+
msg = "Don't know production '#{aProduction.name}'"
|
121
|
+
raise StandardError, msg
|
121
122
|
end
|
122
123
|
end
|
123
124
|
return node
|
@@ -100,7 +100,7 @@ module Rley # This module is used as a namespace
|
|
100
100
|
non_terminal = entry2nonterm(anEntry)
|
101
101
|
# Create raw node and push onto stack
|
102
102
|
push_raw_node(range, non_terminal)
|
103
|
-
#when :revisit
|
103
|
+
# when :revisit
|
104
104
|
# # TODO: design specification
|
105
105
|
else
|
106
106
|
raise NotImplementedError, "Cannot handle event #{anEvent}"
|
@@ -135,7 +135,8 @@ module Rley # This module is used as a namespace
|
|
135
135
|
process_middle_entry(anEntry, anIndex)
|
136
136
|
end
|
137
137
|
else
|
138
|
-
|
138
|
+
msg_prefix = "Internal Error '#{anEvent}', "
|
139
|
+
$stderr.puts msg_prefix + "entry: #{anEntry}, index: #{anIndex}"
|
139
140
|
raise NotImplementedError
|
140
141
|
end
|
141
142
|
end
|
@@ -13,7 +13,7 @@ module Rley # This module is used as a namespace
|
|
13
13
|
attr_reader(:sets)
|
14
14
|
|
15
15
|
# @param tokenCount [Integer] The number of lexemes in the input to parse.
|
16
|
-
# @param aGFGraph [GFG::GrmFlowGraph] The GFG for the grammar in use.
|
16
|
+
# @param aGFGraph [GFG::GrmFlowGraph] The GFG for the grammar in use.
|
17
17
|
def initialize(tokenCount, aGFGraph)
|
18
18
|
@sets = Array.new(tokenCount + 1) { |_| ParseEntrySet.new }
|
19
19
|
push_entry(aGFGraph.start_vertex, 0, 0, :start_rule)
|
@@ -74,11 +74,11 @@ module Rley # This module is used as a namespace
|
|
74
74
|
# Retrieve all the end entries (i.e. of the form
|
75
75
|
last_entries = sets[last_index].entries.select(&:end_entry?)
|
76
76
|
# last_entries.each_with_index do |entry, index|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
# if entry.nil?
|
78
|
+
# puts "Nil entry at index #{index}"
|
79
|
+
# else
|
80
|
+
# puts entry
|
81
|
+
# end
|
82
82
|
# end
|
83
83
|
|
84
84
|
# ... now find the end vertex for start symbol and with origin at zero.
|
@@ -9,11 +9,11 @@ module Rley # This module is used as a namespace
|
|
9
9
|
module Parser # This module is used as a namespace
|
10
10
|
class GFGParsing
|
11
11
|
# The link to the grammar flow graph
|
12
|
-
# @return [GFG::GrmFlowGraph] The GFG that drives the parsing
|
12
|
+
# @return [GFG::GrmFlowGraph] The GFG that drives the parsing
|
13
13
|
attr_reader(:gf_graph)
|
14
14
|
|
15
15
|
# The link to the chart object
|
16
|
-
# @return [GFGChart]
|
16
|
+
# @return [GFGChart]
|
17
17
|
attr_reader(:chart)
|
18
18
|
|
19
19
|
# The sequence of input token to parse
|
@@ -54,16 +54,16 @@ module Rley # This module is used as a namespace
|
|
54
54
|
pos = aPosition
|
55
55
|
size_before = chart[pos].size
|
56
56
|
apply_rule(anEntry, start_vertex, pos, pos, :call_rule)
|
57
|
-
|
57
|
+
|
58
58
|
if next_symbol.nullable? && anEntry.dotted_entry?
|
59
59
|
size_after = chart[pos].size
|
60
60
|
# ...apply the Nullable rule
|
61
61
|
nullable_rule(anEntry, aPosition) if size_after == size_before
|
62
|
-
end
|
62
|
+
end
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
# Let the current sigma set be the ith parse entry set.
|
66
|
-
# This method is invoked when a dotted entry is added
|
66
|
+
# This method is invoked when a dotted entry is added
|
67
67
|
# to the parse entry set of the from [A => alpha . B beta, k]
|
68
68
|
# and B is nullable
|
69
69
|
# Then the entry [A => alpha B . beta, k] is added to the current
|
@@ -78,8 +78,8 @@ module Rley # This module is used as a namespace
|
|
78
78
|
|
79
79
|
# first pos == origin
|
80
80
|
# second pos == position
|
81
|
-
apply_rule(end_entry, next_vertex, anEntry.origin, pos, :nullable_rule)
|
82
|
-
end
|
81
|
+
apply_rule(end_entry, next_vertex, anEntry.origin, pos, :nullable_rule)
|
82
|
+
end
|
83
83
|
|
84
84
|
# Let the current sigma set be the ith parse entry set.
|
85
85
|
# This method is invoked when an entry is added to a parse entry set
|
@@ -156,7 +156,7 @@ module Rley # This module is used as a namespace
|
|
156
156
|
apply_rule(ntry, vertex_after_terminal, origin, pos, :scan_rule)
|
157
157
|
end
|
158
158
|
end
|
159
|
-
|
159
|
+
|
160
160
|
return true
|
161
161
|
end
|
162
162
|
|
@@ -165,7 +165,7 @@ module Rley # This module is used as a namespace
|
|
165
165
|
def success?()
|
166
166
|
return false if @failure_reason
|
167
167
|
return chart.accepting_entry ? true : false
|
168
|
-
end
|
168
|
+
end
|
169
169
|
|
170
170
|
# Return true if there are more than one complete state
|
171
171
|
# for the same lhs and same origin in any state set.
|
@@ -179,28 +179,28 @@ module Rley # This module is used as a namespace
|
|
179
179
|
def parse_forest()
|
180
180
|
msg = <<-END_MSG
|
181
181
|
Method Rley::Parser::GFGParsing.parse_forest is deprecated, call
|
182
|
-
Rley::Engine::to_pforest. It will be removed April 1st
|
183
|
-
or version 0.6.1 (whichever is first)
|
182
|
+
Rley::Engine::to_pforest. It will be removed April 1st
|
183
|
+
or version 0.6.1 (whichever is first)
|
184
184
|
END_MSG
|
185
|
-
#
|
185
|
+
# warn(msg)
|
186
186
|
factory = ParseRep::ParseForestFactory.new(self)
|
187
187
|
|
188
188
|
return factory.create
|
189
189
|
end
|
190
|
-
|
190
|
+
|
191
191
|
# Factory method. Builds a ParseTree from the parse result.
|
192
192
|
# @return [ParseTree]
|
193
193
|
def parse_tree(aBuilder = nil)
|
194
194
|
msg = <<-END_MSG
|
195
195
|
Method Rley::Parser::GFGParsing.parse_tree is deprecated, call
|
196
|
-
Rley::Engine::to_ptree. It will be removed April 1st
|
197
|
-
or version 0.6.1 (whichever is first)
|
196
|
+
Rley::Engine::to_ptree. It will be removed April 1st
|
197
|
+
or version 0.6.1 (whichever is first)
|
198
198
|
END_MSG
|
199
|
-
|
199
|
+
warn(msg)
|
200
200
|
factory = ParseRep::ParseTreeFactory.new(self)
|
201
201
|
|
202
202
|
return factory.create(aBuilder)
|
203
|
-
end
|
203
|
+
end
|
204
204
|
|
205
205
|
# Retrieve the very first parse entry added to the chart.
|
206
206
|
# This entry corresponds to the start vertex of the GF graph
|
@@ -225,7 +225,7 @@ END_MSG
|
|
225
225
|
# A notification that the parsing reached an end
|
226
226
|
def done()
|
227
227
|
# Parse not successful and no reason identified
|
228
|
-
# Assuming that parse failed because of a premature end
|
228
|
+
# Assuming that parse failed because of a premature end
|
229
229
|
premature_end unless success? || failure_reason
|
230
230
|
end
|
231
231
|
|