Skip to content

Commit fce685d

Browse files
committed
Support parsing method parameter and return type annotations
1 parent 5ea438e commit fce685d

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

src/common/PeopleCodeParser.g4

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ classMember
220220
;
221221

222222
method
223-
: METHOD genericID SEMI* statements? END_METHOD
223+
: METHOD genericID SEMI* methodAnnotations statements? END_METHOD
224224
;
225225

226226
getter
@@ -437,3 +437,19 @@ functionArguments
437437
functionArgument
438438
: USER_VARIABLE (AS typeT)?
439439
;
440+
441+
methodAnnotations
442+
: methodParameterAnnotation* methodReturnAnnotation? methodExtendsAnnotation?
443+
;
444+
445+
methodParameterAnnotation
446+
: SLASH_PLUS methodArgument COMMA? PLUS_SLASH
447+
;
448+
449+
methodReturnAnnotation
450+
: SLASH_PLUS RETURNS typeT PLUS_SLASH
451+
;
452+
453+
methodExtendsAnnotation
454+
: SLASH_PLUS EXTENDS DIV IMPLEMENTS appClassPath DOT genericID PLUS_SLASH
455+
;

src/csharp/PeopleCodeLexer.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ BLOCK_COMMENT_SLASH
3838
API_COMMENT : '/**' ~[/] .*? '*/' {!REGEX_3_STAR.IsMatch(Text)}? -> channel(API_COMMENTS) ;
3939
WS : [\p{White_Space}]+ -> channel(WHITESPACE) ;
4040
BLOCK_COMMENT_NEST : '<*' (BLOCK_COMMENT_NEST | .)*? '*>' -> channel(COMMENTS) ;
41-
BLOCK_COMMENT_PLUS : '/+' .*? '+/' ';'? -> channel(COMMENTS) ;
4241
LINE_COMMENT : R E M (A R K)? .*? ';' {REGEX_REM.IsMatch(Text)}? -> channel(COMMENTS) ;
4342
DIR_IF : '#' IF -> channel(DIRECTIVES), pushMode(DIRECTIVE) ;
4443
DIR_ELSE : '#' ELSE SEMI* -> channel(DIRECTIVES) ;
@@ -56,7 +55,6 @@ CATCH : C A T C H ;
5655
CLASS : C L A S S ;
5756
COLON : ':' ;
5857
COMMA : ',' ;
59-
6058
COMPONENT
6159
: C O M P O N E N T L I F E
6260
| C O M P O N E N T
@@ -120,6 +118,7 @@ OF : O F ;
120118
OR : O R ;
121119
OUT : O U T ;
122120
PEOPLECODE : P E O P L E C O D E ;
121+
PLUS_SLASH : '+/';
123122
PRIVATE : P R I V A T E ;
124123
PROPERTY : P R O P E R T Y ;
125124
PROTECTED : P R O T E C T E D ;
@@ -132,6 +131,7 @@ RETURNS : R E T U R N S ;
132131
RPAREN : ')' ;
133132
SEMI : ';' ;
134133
SET : S E T ;
134+
SLASH_PLUS : '/+';
135135
STAR : '*' ;
136136
STEP : S T E P ;
137137
SUBTR : '-' ;

src/java/PeopleCodeLexer.g4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ OF : O F ;
121121
OR : O R ;
122122
OUT : O U T ;
123123
PEOPLECODE : P E O P L E C O D E ;
124+
PLUS_SLASH : '+/';
124125
PRIVATE : P R I V A T E ;
125126
PROPERTY : P R O P E R T Y ;
126127
PROTECTED : P R O T E C T E D ;
@@ -133,6 +134,7 @@ RETURNS : R E T U R N S ;
133134
RPAREN : ')' ;
134135
SEMI : ';' ;
135136
SET : S E T ;
137+
SLASH_PLUS : '/+';
136138
STAR : '*' ;
137139
STEP : S T E P ;
138140
SUBTR : '-' ;

src/python3/PeopleCodeLexer.g4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ OF : O F ;
118118
OR : O R ;
119119
OUT : O U T ;
120120
PEOPLECODE : P E O P L E C O D E ;
121+
PLUS_SLASH : '+/';
121122
PRIVATE : P R I V A T E ;
122123
PROPERTY : P R O P E R T Y ;
123124
PROTECTED : P R O T E C T E D ;
@@ -130,6 +131,7 @@ RETURNS : R E T U R N S ;
130131
RPAREN : ')' ;
131132
SEMI : ';' ;
132133
SET : S E T ;
134+
SLASH_PLUS : '/+';
133135
STAR : '*' ;
134136
STEP : S T E P ;
135137
SUBTR : '-' ;

0 commit comments

Comments
 (0)