dfa: prune_overlong -> clear_deeper_reports

Rather than pruning states, we simply clear reports on states that are
too deep and allow Hopcroft minimisation to reduce the size of the DFA
afterwards.
This commit is contained in:
Justin Viiret
2017-04-13 13:18:33 +10:00
committed by Matthew Barr
parent 8650a1a33f
commit 41d7aa8281
3 changed files with 18 additions and 107 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016, Intel Corporation
* Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -39,10 +39,12 @@ namespace ue2 {
u32 remove_leading_dots(raw_dfa &raw);
/**
* Prunes any states which cannot be reached within max_offset from start of
* stream. Returns false if no changes are made to the rdfa
* \brief Clear reports on any states that are deeper than \a max_offset from
* start of stream.
*
* Returns false if no changes are made to the DFA.
*/
bool prune_overlong(raw_dfa &raw, u32 max_offset);
bool clear_deeper_reports(raw_dfa &raw, u32 max_offset);
std::set<ReportID> all_reports(const raw_dfa &rdfa);
bool has_eod_accepts(const raw_dfa &rdfa);