MCPcopy Create free account
hub / github.com/CppMicroServices/CppMicroServices / ParseExpr

Method ParseExpr

framework/src/util/LDAPExpr.cpp:922–966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

920 }
921
922 LDAPExpr
923 LDAPExpr::ParseExpr(ParseState& ps)
924 {
925 ps.skipWhite();
926 if (!ps.prefix("("))
927 {
928 ps.error(LDAPExprConstants::MALFORMED());
929 }
930
931 int op;
932 ps.skipWhite();
933 Byte c = ps.peek();
934 if (c == '&')
935 {
936 op = AND;
937 }
938 else if (c == '|')
939 {
940 op = OR;
941 }
942 else if (c == '!')
943 {
944 op = NOT;
945 }
946 else
947 {
948 return ParseSimple(ps);
949 }
950 ps.skip(1); // Ignore the d->m_operator
951
952 std::vector<LDAPExpr> v;
953 do
954 {
955 v.push_back(ParseExpr(ps));
956 ps.skipWhite();
957 } while (ps.peek() == '(');
958
959 std::size_t n = v.size();
960 if (!ps.prefix(")") || n == 0 || (op == NOT && n > 1))
961 {
962 ps.error(LDAPExprConstants::MALFORMED());
963 }
964
965 return LDAPExpr(op, v);
966 }
967
968 LDAPExpr
969 LDAPExpr::ParseSimple(ParseState& ps)

Callers

nothing calls this directly

Calls 7

skipWhiteMethod · 0.80
prefixMethod · 0.80
peekMethod · 0.80
skipMethod · 0.80
LDAPExprClass · 0.70
errorMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected