kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/proto/common.proto (about) 1 /* 2 * Copyright 2015 The Kythe Authors. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 syntax = "proto3"; 18 19 package kythe.proto.common; 20 21 option go_package = "kythe.io/kythe/proto/common_go_proto"; 22 option java_package = "com.google.devtools.kythe.proto"; 23 option java_multiple_files = true; 24 25 import "google/protobuf/timestamp.proto"; 26 27 // Fact represents a single key/value fact from the graph. 28 message Fact { 29 string name = 1; 30 bytes value = 2; 31 } 32 33 // A Point represents a location within a file or buffer. 34 // 35 // If line_number ≤ 0, the line number and column offset are considered 36 // unknown and will be ignored. 37 // 38 // A point with line_number > 0 is said to be _normalized_ if it satisfies 39 // the constraint 0 ≤ column_offset ≤ bytelen(line_number); that is, if the 40 // column_offset is within the actual range of the corresponding line. A 41 // point can be normalized by adjusting line_number and column_offset so that 42 // this constraint is satisfied. This may be impossible if the column offset 43 // exceeds the bounds of the file. 44 message Point { 45 // The offset in bytes from the beginning of the file. 46 // Requires 0 ≤ byte_offset ≤ len(file). 47 int32 byte_offset = 1; 48 49 // The line number containing the point, 1-based. 50 int32 line_number = 2; 51 52 // The byte offset of the point within its line. 53 int32 column_offset = 3; 54 } 55 56 // A Span represents an inclusive-exclusive range inside of a file or buffer. 57 message Span { 58 Point start = 1; 59 Point end = 2; 60 } 61 62 message NodeInfo { 63 // The matching facts known for that node, a map from fact name to value. 64 map<string, bytes> facts = 2; 65 66 // If known and unambiguous, an anchor ticket for this node's definition 67 // location. 68 // Tickets are Kythe URIs (http://www.kythe.io/docs/kythe-uri-spec.html). 69 string definition = 5; 70 71 reserved 1; 72 reserved "ticket"; 73 } 74 75 message Diagnostic { 76 // Text span to which the diagnostic applies. If the span is unset, the 77 // diagnostic refers to its entire parent context (i.e. the file to which it 78 // is attached). 79 Span span = 1; 80 81 // Plain-text diagnostic message to be reported to users. 82 string message = 2; 83 84 // Optional details that further refine the diagnostic but need not be 85 // reported to users immediately. This field can be used to provide more 86 // context for bug reports and may contain compiler/build errors. 87 string details = 3; 88 89 // Optional URL leading to more detailed information on this diagnostic. This 90 // may be documentation on a particular class of errors or a tracking issue 91 // for prevalent errors. 92 string context_url = 4; 93 } 94 95 // A Diagnostic resolved to include its associated file through a Kythe `tagged` 96 // graph edge. 97 message ResolvedDiagnostic { 98 CorpusPath corpus_path = 1; 99 Diagnostic diagnostic = 2; 100 } 101 102 // A file path rooted in a corpus. This is a subset of a Kythe VName. 103 message CorpusPath { 104 string corpus = 1; 105 string root = 2; 106 string path = 3; 107 } 108 109 message Link { 110 // Semantic tickets for DEFINITION links. 111 repeated string definition = 3; 112 113 reserved 1, 2; 114 } 115 116 // Marked up, source code-like text. 117 message MarkedSource { 118 enum Kind { 119 // This node only contains other nodes and has no special semantics. 120 BOX = 0; 121 // This node dominates nodes that should be classified as types. 122 TYPE = 1; 123 // This node dominates nodes that should be classified as parameters. 124 PARAMETER = 2; 125 // This node dominates nodes that should be classified as identifiers. 126 IDENTIFIER = 3; 127 // This node dominates nodes that should be classified as context. 128 CONTEXT = 4; 129 // This node dominates nodes that should be classified as initializers. 130 INITIALIZER = 5; 131 // This node dominates nodes that should be classified as modifiers. 132 MODIFIER = 12; 133 // Substitute this node with a PARAMETER formed from the param edges from 134 // the context node starting with `lookup_index`. 135 PARAMETER_LOOKUP_BY_PARAM = 6; 136 // Substitute this node with the marked source derived from the 137 // `lookup_index`th param edge of the context node. 138 LOOKUP_BY_PARAM = 7; 139 // Substitute this node with a PARAMETER formed from the param edges from 140 // the context node starting with `lookup_index`. Checks the context 141 // node for a `param/default` fact and uses that to set the 142 // first_default_child field. 143 PARAMETER_LOOKUP_BY_PARAM_WITH_DEFAULTS = 8; 144 // Substitute this node with the marked source derived from the typed edge 145 // of the context node. 146 LOOKUP_BY_TYPED = 9; 147 // Substitute this node with a PARAMETER formed from the tparam edges from 148 // the context node starting with `lookup_index`. 149 PARAMETER_LOOKUP_BY_TPARAM = 10; 150 // Substitute this node with the marked source derived from the 151 // `lookup_index`th tparam edge of the context node. 152 LOOKUP_BY_TPARAM = 11; 153 } 154 Kind kind = 1; 155 // Nodes expect to be printed as: 156 // pre_text + (child + post_child_text)* + post_text 157 // where post_child_text is not included after the final child unless 158 // add_final_list_token is asserted. post_child_text should never be 159 // printed if there are no children. 160 string pre_text = 2; 161 repeated MarkedSource child = 3; 162 string post_child_text = 4; 163 string post_text = 5; 164 uint32 lookup_index = 6; 165 // The default_children_count children at the end of the child list should 166 // be considered as "default" or uninteresting. 167 uint32 default_children_count = 7; 168 // `add_final_list_token` ensures that `post_child_text` will be 169 // included after any nonempty list when that list is followed by additional 170 // text. 171 bool add_final_list_token = 10; 172 // Annotations covering this subtree's full span. 173 repeated Link link = 11; 174 175 // Exclude this MarkedSource when being included in a parent of these kinds. 176 repeated Kind exclude_on_include = 12; 177 } 178 179 // Contains symbol information for Kythe graph nodes. 180 message SymbolInfo { 181 // The base un-qualified name for a node ("printf", "String") 182 string base_name = 1; 183 // The fully qualified name for a node ("printf", "java.lang.String") 184 string qualified_name = 2; 185 } 186 187 // Origin of a Kythe index. 188 message Origin { 189 string corpus = 1; 190 string revision = 2; 191 // commit_timestamp records the time at which this version of the corpus was 192 // created. It is typically a git commit timestamp. 193 google.protobuf.Timestamp commit_timestamp = 3; 194 // Set of languages appearing in this origin. 195 repeated string language = 4; 196 } 197 198 // Metadata of a Kythe supported language. 199 message Language { 200 string name = 1; // the language name (see kythe.io/docs/schema) 201 Support support = 2; 202 203 enum Support { 204 UNKNOWN = 0; 205 EXPERIMENTAL = 1; // support for this language is experimental 206 SUPPORTED = 2; // the language is fully supported 207 } 208 209 // Set of analyzer versions used for this language's analysis. 210 repeated string analyzer_version = 3; 211 } 212 213 // A Hash of some data. 214 message Hash { 215 // Specifies the hash algorithm, if any. 216 enum HashType { 217 NONE = 0; 218 219 // Use a sha256 hash (git's successor hash -- 220 // https://git-scm.com/docs/hash-function-transition/). 221 SHA256 = 1; 222 // Use a sha1 hash (git's legacy blob hash). 223 SHA1 = 2; 224 } 225 226 // The type of hash that was performed. 227 HashType type = 1; 228 // The hash value. 229 bytes value = 2; 230 }