1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15#ifndef SYNTAX_RULES_H 16#define SYNTAX_RULES_H 17 18#include <list> 19#include <map> 20#include <string> 21#include <vector> 22namespace OHOS { 23namespace HiviewDFX { 24const std::string L1_SEG_STATUS = "segmentStatus"; 25const std::string L1_RULE = "Rule"; 26const std::string L2_DIR_OR_FILE = "DirOrFile"; 27const std::string L2_SKIP = "skip"; 28const std::string L2_SUBCATELOG = "Subcatalog"; 29const std::string L2_FEATUREID = "featureId"; 30const std::string L2_RULES = "rules"; 31const std::string L2_SEGMENT_RULE = "segmentRule"; 32const std::string L2_SEGMENT_TYPE = "segmentType"; 33const std::string L2_SEGMENT_START = "startSeg"; 34const std::string L2_SEGMENT_STACK = "segStack"; 35 36const std::string L3_NAMESPACE = "namespace"; 37const std::string L3_MATCH_KEY = "matchKey"; 38const std::string L3_NUM = "num"; 39const std::string L3_PARAM = "v_"; 40const std::string L3_DEPEND = "depend"; 41const std::string L3_DESCRIPTOR_LEFT = "@{"; 42const std::string L3_DESCRIPTOR_RIGHT = "}@"; 43const std::string L3_VARIABLE_TRACE_BLOCK = "@T@"; 44const std::string L3_SEEK_LAST = "@L@"; 45const std::string L3_OR_DESCRIPTOR = "@|@"; 46const std::string L3_AND_DESCRIPTOR = "@&@"; 47const std::string L3_REGULAR_DESCRIPTOR = "@R@"; 48 49struct FeatureRule { 50 int num {0}; 51 std::string name; 52 std::string source; 53 std::string depend; 54 std::string cmdType; 55 std::map<std::string, std::string> param; 56}; 57 58struct LineFeature { 59 int lineCursor{0}; 60 std::string value; 61}; 62 63struct FeatureSet { 64 std::string fullPath; 65 std::string segmentType; 66 int skipStep; 67 std::list<FeatureRule> rules; 68 std::vector<std::string> startSegVec; 69 std::vector<std::string> segStackVec; 70}; 71} // namespace HiviewDFX 72} // namespace OHOS 73#endif /* SYNTAX_RULES_H */