source.proto 2.1 KB

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