xref: /aosp_15_r20/external/googleapis/google/api/expr/v1beta1/source.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2019 Google LLC.
2//
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
16syntax = "proto3";
17
18package google.api.expr.v1beta1;
19
20option cc_enable_arenas = true;
21option go_package = "google.golang.org/genproto/googleapis/api/expr/v1beta1;expr";
22option java_multiple_files = true;
23option java_outer_classname = "SourceProto";
24option java_package = "com.google.api.expr.v1beta1";
25
26// Source information collected at parse time.
27message SourceInfo {
28  // The location name. All position information attached to an expression is
29  // relative to this location.
30  //
31  // The location could be a file, UI element, or similar. For example,
32  // `acme/app/AnvilPolicy.cel`.
33  string location = 2;
34
35  // Monotonically increasing list of character offsets where newlines appear.
36  //
37  // The line number of a given position is the index `i` where for a given
38  // `id` the `line_offsets[i] < id_positions[id] < line_offsets[i+1]`. The
39  // column may be derivd from `id_positions[id] - line_offsets[i]`.
40  repeated int32 line_offsets = 3;
41
42  // A map from the parse node id (e.g. `Expr.id`) to the character offset
43  // within source.
44  map<int32, int32> positions = 4;
45}
46
47// A specific position in source.
48message SourcePosition {
49  // The soucre location name (e.g. file name).
50  string location = 1;
51
52  // The character offset.
53  int32 offset = 2;
54
55  // The 1-based index of the starting line in the source text
56  // where the issue occurs, or 0 if unknown.
57  int32 line = 3;
58
59  // The 0-based index of the starting position within the line of source text
60  // where the issue occurs.  Only meaningful if line is nonzer..
61  int32 column = 4;
62}
63