diff options
author | Ivan Blinkov <ivan@blinkov.ru> | 2022-02-10 16:47:11 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:11 +0300 |
commit | 5b283123c882433dafbaf6b338adeea16c1a0ea0 (patch) | |
tree | 339adc63bce23800021202ae4a8328a843dc447a /contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp | |
parent | 1aeb9a455974457866f78722ad98114bafc84e8a (diff) | |
download | ydb-5b283123c882433dafbaf6b338adeea16c1a0ea0.tar.gz |
Restoring authorship annotation for Ivan Blinkov <ivan@blinkov.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp')
-rw-r--r-- | contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp b/contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp index a740eab65e..60f667f491 100644 --- a/contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp +++ b/contrib/libs/hyperscan/src/nfagraph/ng_builder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, 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: @@ -28,11 +28,11 @@ /** \file * \brief: NFA Graph Builder: used by Glushkov construction to construct an - * NGHolder from a parsed expression. + * NGHolder from a parsed expression. */ - -#include "ng_builder.h" - + +#include "ng_builder.h" + #include "grey.h" #include "ng.h" #include "ng_util.h" @@ -81,7 +81,7 @@ public: void cloneRegion(Position first, Position last, unsigned posOffset) override; - BuiltExpression getGraph() override; + BuiltExpression getGraph() override; private: /** fetch a vertex given its Position ID. */ @@ -96,12 +96,12 @@ private: /** \brief Greybox: used for resource limits. */ const Grey &grey; - /** \brief Underlying graph. */ - unique_ptr<NGHolder> graph; + /** \brief Underlying graph. */ + unique_ptr<NGHolder> graph; + + /** \brief Underlying expression info. */ + ExpressionInfo expr; - /** \brief Underlying expression info. */ - ExpressionInfo expr; - /** \brief mapping from position to vertex. Use \ref getVertex for access. * */ vector<NFAVertex> id2vertex; @@ -113,9 +113,9 @@ private: } // namespace NFABuilderImpl::NFABuilderImpl(ReportManager &rm_in, const Grey &grey_in, - const ParsedExpression &parsed) - : rm(rm_in), grey(grey_in), graph(ue2::make_unique<NGHolder>()), - expr(parsed.expr), vertIdx(N_SPECIALS) { + const ParsedExpression &parsed) + : rm(rm_in), grey(grey_in), graph(ue2::make_unique<NGHolder>()), + expr(parsed.expr), vertIdx(N_SPECIALS) { // Reserve space for a reasonably-sized NFA id2vertex.reserve(64); @@ -133,8 +133,8 @@ NFABuilderImpl::~NFABuilderImpl() { NFAVertex NFABuilderImpl::getVertex(Position pos) const { assert(id2vertex.size() >= pos); const NFAVertex v = id2vertex[pos]; - assert(v != NGHolder::null_vertex()); - assert((*graph)[v].index == pos); + assert(v != NGHolder::null_vertex()); + assert((*graph)[v].index == pos); return v; } @@ -149,10 +149,10 @@ void NFABuilderImpl::addVertex(Position pos) { id2vertex.resize(pos + 1); } id2vertex[pos] = v; - (*graph)[v].index = pos; + (*graph)[v].index = pos; } -BuiltExpression NFABuilderImpl::getGraph() { +BuiltExpression NFABuilderImpl::getGraph() { DEBUG_PRINTF("built graph has %zu vertices and %zu edges\n", num_vertices(*graph), num_edges(*graph)); @@ -163,13 +163,13 @@ BuiltExpression NFABuilderImpl::getGraph() { throw CompileError("Pattern too large."); } - return { expr, move(graph) }; + return { expr, move(graph) }; } void NFABuilderImpl::setNodeReportID(Position pos, int offsetAdjust) { - Report ir = rm.getBasicInternalReport(expr, offsetAdjust); + Report ir = rm.getBasicInternalReport(expr, offsetAdjust); DEBUG_PRINTF("setting report id on %u = (%u, %d, %u)\n", - pos, expr.report, offsetAdjust, ir.ekey); + pos, expr.report, offsetAdjust, ir.ekey); NFAVertex v = getVertex(pos); auto &reports = (*graph)[v].reports; @@ -179,24 +179,24 @@ void NFABuilderImpl::setNodeReportID(Position pos, int offsetAdjust) { void NFABuilderImpl::addCharReach(Position pos, const CharReach &cr) { NFAVertex v = getVertex(pos); - (*graph)[v].char_reach |= cr; + (*graph)[v].char_reach |= cr; } void NFABuilderImpl::setAssertFlag(Position pos, u32 flag) { NFAVertex v = getVertex(pos); - (*graph)[v].assert_flags |= flag; + (*graph)[v].assert_flags |= flag; } u32 NFABuilderImpl::getAssertFlag(Position pos) { NFAVertex v = getVertex(pos); - return (*graph)[v].assert_flags; + return (*graph)[v].assert_flags; } pair<NFAEdge, bool> NFABuilderImpl::addEdge(NFAVertex u, NFAVertex v) { // assert that the edge doesn't already exist - assert(edge(u, v, *graph).second == false); + assert(edge(u, v, *graph).second == false); - return add_edge(u, v, *graph); + return add_edge(u, v, *graph); } void NFABuilderImpl::addEdge(Position startPos, Position endPos) { @@ -209,16 +209,16 @@ void NFABuilderImpl::addEdge(Position startPos, Position endPos) { if ((u == graph->start || u == graph->startDs) && v == graph->startDs) { /* standard special -> special edges already exist */ - assert(edge(u, v, *graph).second == true); + assert(edge(u, v, *graph).second == true); return; } - assert(edge(u, v, *graph).second == false); + assert(edge(u, v, *graph).second == false); addEdge(u, v); } bool NFABuilderImpl::hasEdge(Position startPos, Position endPos) const { - return edge(getVertex(startPos), getVertex(endPos), *graph).second; + return edge(getVertex(startPos), getVertex(endPos), *graph).second; } Position NFABuilderImpl::getStart() const { @@ -252,7 +252,7 @@ Position NFABuilderImpl::makePositions(size_t nPositions) { } void NFABuilderImpl::cloneRegion(Position first, Position last, unsigned posOffset) { - NGHolder &g = *graph; + NGHolder &g = *graph; assert(posOffset > 0); // walk the nodes between first and last and copy their vertex properties |