Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion protobuf/protobuf2/Protobuf2.g4
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,24 @@ type_
// Extensions

extensions
: EXTENSIONS ranges SEMI
: EXTENSIONS ranges (LB (verificationDef | declarations) RB)? SEMI
;

verificationDef
: VERIFICATION EQ verification
;

verification
: DECLARATION_LIT
| UNVERIFIED_LIT
;

declarations
: declaration (COMMA declaration)*
;

declaration
: DECLARATION EQ blockLit
;

// Reserved
Expand Down Expand Up @@ -472,6 +489,22 @@ MAX
: 'max'
;

VERIFICATION
: 'verification'
;

DECLARATION
: 'declaration'
;

DECLARATION_LIT
: 'DECLARATION'
;

UNVERIFIED_LIT
: 'UNVERIFIED'
;

ENUM
: 'enum'
;
Expand Down Expand Up @@ -707,4 +740,8 @@ keywords
| STREAM
| RETURNS
| BOOL_LIT
| DECLARATION
| VERIFICATION
| DECLARATION_LIT
| UNVERIFIED_LIT
;
16 changes: 16 additions & 0 deletions protobuf/protobuf2/examples/extension.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
syntax = 'proto2';

message UserContent {
extensions 100 to 199 [verification = DECLARATION];
}

message OtherContent {
extensions 100 to 199 [
declaration = {
number: 126,
full_name: ".kittens.kitten_videos",
type: ".kittens.Video",
repeated: true
}
];
}
Loading