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> 22 namespace OHOS { 23 namespace HiviewDFX { 24 const std::string L1_SEG_STATUS = "segmentStatus"; 25 const std::string L1_RULE = "Rule"; 26 const std::string L2_DIR_OR_FILE = "DirOrFile"; 27 const std::string L2_SKIP = "skip"; 28 const std::string L2_SUBCATELOG = "Subcatalog"; 29 const std::string L2_FEATUREID = "featureId"; 30 const std::string L2_RULES = "rules"; 31 const std::string L2_SEGMENT_RULE = "segmentRule"; 32 const std::string L2_SEGMENT_TYPE = "segmentType"; 33 const std::string L2_SEGMENT_START = "startSeg"; 34 const std::string L2_SEGMENT_STACK = "segStack"; 35 36 const std::string L3_NAMESPACE = "namespace"; 37 const std::string L3_MATCH_KEY = "matchKey"; 38 const std::string L3_NUM = "num"; 39 const std::string L3_PARAM = "v_"; 40 const std::string L3_DEPEND = "depend"; 41 const std::string L3_DESCRIPTOR_LEFT = "@{"; 42 const std::string L3_DESCRIPTOR_RIGHT = "}@"; 43 const std::string L3_VARIABLE_TRACE_BLOCK = "@T@"; 44 const std::string L3_SEEK_LAST = "@L@"; 45 const std::string L3_OR_DESCRIPTOR = "@|@"; 46 const std::string L3_AND_DESCRIPTOR = "@&@"; 47 const std::string L3_REGULAR_DESCRIPTOR = "@R@"; 48 49 struct 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 58 struct LineFeature { 59 int lineCursor{0}; 60 std::string value; 61 }; 62 63 struct 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 */