Large diffs are not rendered by default.

@@ -15,7 +15,7 @@ insert
out_in_tagged_out_memory
end

creation {PACKRAT_GRAMMAR}
creation {PACKRAT_INTERNAL}
make

feature {ANY}
@@ -9,10 +9,10 @@ insert
default_create, is_equal
end

creation {PACKRAT_GRAMMAR}
creation {PACKRAT_INTERNAL}
default_create

feature {PACKRAT_GRAMMAR}
feature {PACKRAT_INTERNAL}
next (buffer: MINI_PARSER_BUFFER): like Current is
do
buffer.next
@@ -3,28 +3,233 @@
--
deferred class PACKRAT_REDUCER

insert
PACKRAT

feature {PACKRAT_GRAMMAR}
reduce_alternative (nonterminal_name: FIXED_STRING) is
reduce_nonterminal_def is
deferred
end

reduce_grammar is
deferred
end

reduce_pattern_first_alternative is
deferred
end

reduce_pattern_alternative is
deferred
end

reduce_pattern is
deferred
end

reduce_pattern_map (alt: PACKRAT_ALTERNATIVE) is
deferred
end

reduce_alternative_lookahead is
deferred
end

reduce_alternative_suffix_tag is
deferred
end

reduce_alternative_tag is
deferred
end

reduce_alternative is
deferred
end

reduce_quantifier is
deferred
end

reduce_suffix is
deferred
end

reduce_primary_as_nested_pattern is
deferred
end

reduce_primary_as_any is
deferred
end

reduce_primary_as_literal is
deferred
end

reduce_primay_as_charclass is
deferred
end

reduce_primary_as_nonterminal is
deferred
end

reduce_literal_start is
deferred
end

reduce_literal_string is
deferred
end

reduce_literal is
deferred
end

reduce_tag_start is
deferred
end

reduce_tag_string is
deferred
end

reduce_tag is
deferred
end

reduce_charclass_start is
deferred
end

reduce_charclass_range is
deferred
end

reduce_charclass_char is
deferred
end

reduce_charclass_class is
deferred
end

reduce_charclass is
deferred
end

reduce_nonterminal_name is
deferred
end

reduce_nonterminal is
deferred
end

reduce_space is
deferred
end

reduce_image_left_arrow (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_slash (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_not_and (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_star_plus_why (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_open_paren (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_close_paren (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_anychar (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_letter (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_string (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_quote (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_hyphen (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_image_dot (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_pattern (nonterminal_name: FIXED_STRING) is
reduce_image_open_bracket (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_positive_lookahead (nonterminal_name: FIXED_STRING) is
reduce_image_close_bracket (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_negative_lookahead (nonterminal_name: FIXED_STRING) is
reduce_image_open_curly (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_loop (nonterminal_name: FIXED_STRING; quantifier: INTEGER_8) is
reduce_image_close_curly (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

reduce_with_tag (nonterminal_name, tag: FIXED_STRING) is
reduce_image_space (image: PARSER_IMAGE) is
require
image /= Void
deferred
end

@@ -0,0 +1,2 @@
descending/
packrat/
File renamed without changes.
@@ -1,5 +1 @@
log.new
time_info.txt
*.o
*.id
*.[ch]
eiffeltest
@@ -1,8 +1,5 @@
class TEST_PACKRAT01

inherit
PACKRAT_REDUCER

insert
EIFFELTEST_TOOLS

@@ -16,7 +13,7 @@ feature {}
parser: PACKRAT_PARSER
buffer: MINI_PARSER_BUFFER
do
create grammar.make(Current)
create grammar.make
create parser

-- this one is the original one (to keep it somewhere)
@@ -38,29 +35,4 @@ sp <- [ \t\n]*
assert(parser.eval(buffer, grammar.table, "grammar"))
end

feature {PACKRAT_GRAMMAR}
reduce_alternative (nonterminal_name: FIXED_STRING) is
do
end

reduce_pattern (nonterminal_name: FIXED_STRING) is
do
end

reduce_positive_lookahead (nonterminal_name: FIXED_STRING) is
do
end

reduce_negative_lookahead (nonterminal_name: FIXED_STRING) is
do
end

reduce_loop (nonterminal_name: FIXED_STRING; quantifier: INTEGER_8) is
do
end

reduce_with_tag (nonterminal_name, tag: FIXED_STRING) is
do
end

end
@@ -1,8 +1,5 @@
class TEST_PACKRAT02

inherit
PACKRAT_REDUCER

insert
EIFFELTEST_TOOLS

@@ -16,7 +13,7 @@ feature {}
table: PARSE_TABLE[PACKRAT_PARSE_CONTEXT]
source: STRING; dump: STRING_OUTPUT_STREAM
do
create grammar.make(Current)
create grammar.make

-- this one is the extended grammar (with tags)

@@ -42,29 +39,4 @@ tag <- '{' (!'}' .)+ '}' sp
assert(source.is_equal(dump.to_string))
end

feature {PACKRAT_GRAMMAR}
reduce_alternative (nonterminal_name: FIXED_STRING) is
do
end

reduce_pattern (nonterminal_name: FIXED_STRING) is
do
end

reduce_positive_lookahead (nonterminal_name: FIXED_STRING) is
do
end

reduce_negative_lookahead (nonterminal_name: FIXED_STRING) is
do
end

reduce_loop (nonterminal_name: FIXED_STRING; quantifier: INTEGER_8) is
do
end

reduce_with_tag (nonterminal_name, tag: FIXED_STRING) is
do
end

end
@@ -1,8 +1,5 @@
class TEST_PACKRAT03

inherit
PACKRAT_REDUCER

insert
EIFFELTEST_TOOLS

@@ -16,7 +13,7 @@ feature {}
table: PARSE_TABLE[PACKRAT_PARSE_CONTEXT]
source: STRING; dump: STRING_OUTPUT_STREAM
do
create grammar.make(Current)
create grammar.make

-- this one is the extended grammar (with tags),
-- decorated with tags
@@ -43,29 +40,4 @@ tag <- '{' (!'}' .)+ '}' sp
assert(source.is_equal(dump.to_string))
end

feature {PACKRAT_GRAMMAR}
reduce_alternative (nonterminal_name: FIXED_STRING) is
do
end

reduce_pattern (nonterminal_name: FIXED_STRING) is
do
end

reduce_positive_lookahead (nonterminal_name: FIXED_STRING) is
do
end

reduce_negative_lookahead (nonterminal_name: FIXED_STRING) is
do
end

reduce_loop (nonterminal_name: FIXED_STRING; quantifier: INTEGER_8) is
do
end

reduce_with_tag (nonterminal_name, tag: FIXED_STRING) is
do
end

end
@@ -1,8 +1,5 @@
class TEST_PACKRAT04

inherit
PACKRAT_REDUCER

insert
EIFFELTEST_TOOLS
LOGGING
@@ -18,7 +15,7 @@ feature {}
source: STRING; dump: STRING_OUTPUT_STREAM
parser: PACKRAT_PARSER; buffer: MINI_PARSER_BUFFER
do
create grammar.make(Current)
create grammar.make

-- this one is the extended grammar (with tags),
-- decorated with tags
@@ -44,40 +41,20 @@ tag <- '{' (!'}' .)+ '}' sp
table.pretty_print_on(dump)
assert(source.is_equal(dump.to_string))

table.set_default_tree_builders(agent reduce_non_terminal, agent reduce_terminal)

create parser
create buffer.initialize_with(source)
assert(parser.eval(buffer, table, "grammar") and then parser.error = Void)
end

feature {PACKRAT_GRAMMAR}
reduce_alternative (nonterminal_name: FIXED_STRING) is
do
log.trace.put_line("#### reduce alternative: nonterminal %"#(1)%"" # nonterminal_name)
end

reduce_pattern (nonterminal_name: FIXED_STRING) is
do
log.trace.put_line("#### reduce pattern: nonterminal %"#(1)%"" # nonterminal_name)
end

reduce_positive_lookahead (nonterminal_name: FIXED_STRING) is
do
log.trace.put_line("#### reduce positive lookahead: nonterminal %"#(1)%"" # nonterminal_name)
end

reduce_negative_lookahead (nonterminal_name: FIXED_STRING) is
do
log.trace.put_line("#### reduce negative lookahead: nonterminal %"#(1)%"" # nonterminal_name)
end

reduce_loop (nonterminal_name: FIXED_STRING; quantifier: INTEGER_8) is
feature {}
reduce_non_terminal is
do
log.trace.put_line("#### reduce loop: nonterminal %"#(1)%", #(2)" # nonterminal_name # quantifier.out)
end

reduce_with_tag (nonterminal_name, tag: FIXED_STRING) is
reduce_terminal is
do
log.trace.put_line("#### reduce tag: nonterminal %"#(1)%", tag {#(2)}" # nonterminal_name # tag)
end

end