Skip to content

Commit

Permalink
Refactored malformed checks in parser
Browse files Browse the repository at this point in the history
  • Loading branch information
xevor11 committed Sep 2, 2024
1 parent 1493f2f commit 0c1eb53
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -12257,15 +12257,14 @@ call_body:
char* s = (char *)CB_LITERAL ($3)->data;
if (strncasecmp("Java.", s, 5) == 0) {
call_conv = CB_CONV_JAVA;
}
/* Check for malformed Java method names */
char* class_and_method_name = s + 5;
if (strchr(class_and_method_name, '.') == NULL) {
cb_error_x ($3, _("malformed Java method name '%s', expected format 'Java.ClassName.methodName'"), s);
}
/* Check for unsupported Java method calls with parameters or return values */
if($7 != NULL || $8 != NULL) {
CB_PENDING("Java method calls with parameters or return values");
/* Check for malformed Java method names */
if (strchr(s + 5, '.') == NULL) {
cb_error_x ($3, _("malformed Java method name '%s', expected format 'Java.ClassName.methodName'"), s);
}
/* Check for unsupported Java method calls with parameters or return values */
if($7 != NULL || $8 != NULL) {
CB_PENDING("Java method calls with parameters or return values");
}
}
cb_check_conformance ($3, $7, $8);
} else if (CB_REFERENCE_P ($3)) {
Expand Down

0 comments on commit 0c1eb53

Please sign in to comment.