highlight.proto

    syntax = "proto2";

    package example;

    message Object {
      required string name = 1;
      required int32 identifier = 2;
      optional string address = 3;

      enum ObjectType {
        LOCAL = 0;
        REMOTE = 1;
        NEITHER = 2;
        default = 3; // no keyword
      }

      message ObjectData {
        required string number = 1;
        optional ObjectType type = 2 [default = NEITHER];
        optional ObjectType other = 3 [default = default];
        //                                       ^ no keyword
      }

      repeated ObjectData dataList = 4;

      string string = 5;
      //     ^ no data type
      string default = 5;
      //     ^ no keyword
    }

    message ObjectList {
      repeated Object object = 1;
    }

    enum EnumAllowingAlias {
      option allow_alias = true;
      EAA_UNSPECIFIED = 0;
      EAA_STARTED = 1;
      EAA_RUNNING = 1;
      EAA_FINISHED = 2;
    }

    message SomeOtherMessage {
      SearchResponse.Result result = 1;
    }

    package media;

    // A container message to hold stuff that a user has created.
    message UserContent {
      // Set verification to `DECLARATION` to enforce extension declarations for all
      // extensions in this range.
      extensions 100 to 199 [verification = DECLARATION];
    }

    // A container message to hold stuff that a user has created.
    message UserContent {
      extensions 100 to 199 [
        declaration = {
          number: 126,
          full_name: ".kittens.kitten_videos",
          type: ".kittens.Video",
          repeated: true
        },
        // Ensures all field numbers in this extension range are declarations.
        verification = DECLARATION
      ];
    }

    service SearchService {
      rpc Search(SearchRequest) returns (SearchResponse);
    }

    message RequestType {}
    message ResponseType {}

    service MyService {
      option (my_service_option) = FOO;

      rpc MyMethod(RequestType) returns(ResponseType) {
        // Note:  my_method_option has type MyMessage.  We can set each field
        //   within it using a separate "option" line.
        option (my_method_option).foo = 567;
        option (my_method_option).bar = "Some string";
      }
    }

    import "google/protobuf/descriptor.proto";

    extend google.protobuf.EnumValueOptions {
      string string_name = 123456789;
    }

    enum Data {
      DATA_UNSPECIFIED = 0;
      DATA_SEARCH = 1 [deprecated = true];
      DATA_DISPLAY = 2 [
        (string_name) = "x\uafe23\U000123456\nx\x433\xag\0123\u1xx\p\U0010ai"
      ];
    }

    message Outer {
      option (my_option).a = true;
      message Inner {   // Level 2
        required int64 ival = 1;
      }
      map<int32, string> my_map = 2;
      extensions 20 to 30;
      float n = .2;
      float n = inf;
    }