From owner-svn-src-user@FreeBSD.ORG Mon Aug 22 11:22:13 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E14951065672; Mon, 22 Aug 2011 11:22:13 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D11BA8FC0C; Mon, 22 Aug 2011 11:22:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7MBMDYN048535; Mon, 22 Aug 2011 11:22:13 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7MBMDLg048533; Mon, 22 Aug 2011 11:22:13 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201108221122.p7MBMDLg048533@svn.freebsd.org> From: Gabor Kovesdan Date: Mon, 22 Aug 2011 11:22:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225077 - user/gabor/tre-integration/contrib/tre/lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2011 11:22:14 -0000 Author: gabor Date: Mon Aug 22 11:22:13 2011 New Revision: 225077 URL: http://svn.freebsd.org/changeset/base/225077 Log: - Add a general comment Modified: user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c Modified: user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c ============================================================================== --- user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c Mon Aug 22 11:18:47 2011 (r225076) +++ user/gabor/tre-integration/contrib/tre/lib/tre-heuristic.c Mon Aug 22 11:22:13 2011 (r225077) @@ -40,6 +40,21 @@ #include "xmalloc.h" /* + * A full regex implementation requires a finite state automaton + * and using an automaton is always about a trade-off. A DFA is + * fast but complex and requires more memory because of the + * high number of states. NFA is slower but simpler and uses less + * memory. Regular expression matching is an underlying common task + * that is required to be efficient but correctness, clean and + * maintanable code are also requirements. So what we do is using + * an NFA implementation and heuristically locate the possible matches + * with a cheaper algorithm and only apply the heavy one to the + * possibly matching segments. This allows us to benefit from the + * advantages of an NFA implementation reducing the effect of the + * performance impact. + */ + +/* * Parses bracket expression seeking to the end of the enclosed text. * The parameters are the opening (oe) and closing elements (ce). * Can handle nested bracket expressions.