lib/rley/parser/earley_parser.rb in rley-0.0.07 vs lib/rley/parser/earley_parser.rb in rley-0.0.08
- old
+ new
@@ -18,17 +18,21 @@
# A Hash that defines the mapping: dotted item => next dotted item
# In other words, the 'next_mapping' allows to find the dotted item
# after "advancing" the dot
attr_reader(:next_mapping)
-
+ # @param aGrammar [Grammar] A context-free grammar that defines the language
+ # of the input to be parsed.
def initialize(aGrammar)
@grammar = aGrammar
@dotted_items = build_dotted_items(grammar)
@start_mapping = build_start_mapping(dotted_items)
@next_mapping = build_next_mapping(dotted_items)
end
+ # @param aTokenSequence [Array] Array of Tokens objects returned by a
+ # tokenizer/scanner/lexer.
+ # @return a Parsing object that embeds the parse result.
def parse(aTokenSequence)
result = Parsing.new(start_dotted_item, aTokenSequence)
last_token_index = aTokenSequence.size
(0..last_token_index).each do |i|
result.chart[i].each do |state|