hs_expression_info: check unsupported constructs

This commit is contained in:
Justin Viiret 2017-06-05 14:38:57 +10:00 committed by Matthew Barr
parent aad55e1b72
commit 9589ee9f90

View File

@ -44,6 +44,7 @@
#include "parser/parse_error.h" #include "parser/parse_error.h"
#include "parser/Parser.h" #include "parser/Parser.h"
#include "parser/prefilter.h" #include "parser/prefilter.h"
#include "parser/unsupported.h"
#include "util/compile_error.h" #include "util/compile_error.h"
#include "util/cpuid_flags.h" #include "util/cpuid_flags.h"
#include "util/depth.h" #include "util/depth.h"
@ -376,6 +377,14 @@ hs_error_t hs_expression_info_int(const char *expression, unsigned int flags,
prefilterTree(pe.component, ParseMode(flags)); prefilterTree(pe.component, ParseMode(flags));
} }
// Expressions containing zero-width assertions and other extended pcre
// types aren't supported yet. This call will throw a ParseError
// exception if the component tree contains such a construct.
checkUnsupported(*pe.component);
pe.component->checkEmbeddedStartAnchor(true);
pe.component->checkEmbeddedEndAnchor(true);
auto built_expr = buildGraph(rm, cc, pe); auto built_expr = buildGraph(rm, cc, pe);
unique_ptr<NGHolder> &g = built_expr.g; unique_ptr<NGHolder> &g = built_expr.g;
ExpressionInfo &expr = built_expr.expr; ExpressionInfo &expr = built_expr.expr;