-
Notifications
You must be signed in to change notification settings - Fork 42
Added initial EXEC preprocessor handling logic in pplex and ppparse. #279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gitside-gnucobol-3.x
Are you sure you want to change the base?
Changes from 1 commit
9a895d7
119e265
e492b07
31c0601
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,6 +226,7 @@ MAYBE_AREA_A [ ]?#? | |
| %x CONTROL_STATEMENT_STATE | ||
| %x DISPLAY_DIRECTIVE_STATE | ||
| %x IMP_DIRECTIVE_STATE | ||
| %X EXEC_STATE | ||
|
|
||
| %% | ||
|
|
||
|
|
@@ -501,6 +502,7 @@ MAYBE_AREA_A [ ]?#? | |
| ^{AREA_A}[ \n]*/"COPY"[ ,;\n] { count_newlines (yytext); } | ||
| ^{AREA_A}[ \n]*/"INCLUDE"[ ,;\n] { count_newlines (yytext); } | ||
| ^{AREA_A}[ \n]*/"REPLACE"[ ,;\n] { count_newlines (yytext); } | ||
| ^{AREA_A}[ \n]*/"EXEC"[ ,;\n] { count_newlines (yytext); } | ||
|
|
||
| "COPY"/[ ,;\n] { | ||
| yy_push_state (COPY_STATE); | ||
|
|
@@ -525,6 +527,11 @@ MAYBE_AREA_A [ ]?#? | |
| return REPLACE; | ||
| } | ||
|
|
||
| "EXEC"/[ ,;\n] { | ||
| BEGIN(EXEC_STATE); | ||
| return EXEC; | ||
| } | ||
|
|
||
| ^{MAYBE_AREA_A}.{6}[ ]*"*CONTROL" | | ||
| ^{MAYBE_AREA_A}.{6}[ ]*"*CBL" { | ||
| BEGIN CONTROL_STATEMENT_STATE; | ||
|
|
@@ -569,6 +576,16 @@ MAYBE_AREA_A [ ]?#? | |
| } | ||
| } | ||
|
|
||
| <EXEC_STATE>{ | ||
| "END-EXEC"([ \t]*\.)? { BEGIN (INITIAL); return END_EXEC; } | ||
| "INCLUDE" { return COPY; } | ||
| :[A-Za-z0-9][A-Za-z0-9-]* { pplval.s = cobc_plex_strdup (yytext); return TOKEN; } | ||
| [A-Za-z0-9][A-Za-z0-9-]* { pplval.s = cobc_plex_strdup (yytext); return TOKEN; } | ||
|
||
| [(),*/<>=+\-] { pplval.s = cobc_plex_strdup (yytext); return TOKEN; } | ||
| \n { newline_count++; } | ||
| . { /* silently consumed */ } | ||
| } | ||
|
|
||
| <SUBSTITUTION_SECTION_STATE, | ||
| CONTROL_DIVISION_STATE>{ | ||
| "REPLACE" { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -753,6 +753,9 @@ ppparse_clear_vars (const struct cb_define_struct *p) | |
| %token <s> VARIABLE_NAME "Variable" | ||
| %token <s> LITERAL "Literal" | ||
|
|
||
| %token EXEC | ||
| %token END_EXEC | ||
|
|
||
| %type <s> _copy_in | ||
| %type <s> copy_source | ||
| %type <s> _literal | ||
|
|
@@ -776,6 +779,7 @@ ppparse_clear_vars (const struct cb_define_struct *p) | |
| %type <l> imp_include_sources | ||
|
|
||
| %type <r> _copy_replacing | ||
| %type <l> exec_token_list | ||
| %type <r> replacing_list | ||
|
|
||
| %type <ds> object_id | ||
|
|
@@ -830,6 +834,7 @@ statement: | |
|
|
||
| statement_no_replace: | ||
| copy_statement | ||
| | exec_statement | ||
| | directive TERMINATOR | ||
| | listing_statement | ||
| | CONTROL_STATEMENT control_options _dot TERMINATOR | ||
|
|
@@ -1726,6 +1731,40 @@ replacing_list: | |
| } | ||
| ; | ||
|
|
||
| exec_token_list: | ||
| /* empty */ | ||
| { | ||
| $$ = NULL; | ||
| } | ||
| | exec_token_list TOKEN | ||
| { | ||
| $$ = ppp_list_add ($1, $2); | ||
|
||
| } | ||
| ; | ||
|
|
||
| exec_statement: | ||
| EXEC END_EXEC | ||
|
||
| { | ||
| /* empty EXEC block — silently ignored */ | ||
| } | ||
| | EXEC TOKEN COPY copy_source END_EXEC | ||
| { | ||
| /* EXEC TAG INCLUDE copybook */ | ||
|
||
| cb_warning (cb_warn_unsupported, | ||
| _("EXEC %s INCLUDE is not yet supported"), $2); | ||
| } | ||
| | EXEC TOKEN exec_token_list END_EXEC | ||
| { | ||
| /* EXEC TAG ... END-EXEC — warn and ignore */ | ||
| cb_warning (cb_warn_unsupported, | ||
| _("EXEC %s statement ignored"), $2); | ||
| } | ||
| | EXEC error END_EXEC | ||
| { | ||
| yyerrok; | ||
| } | ||
| ; | ||
|
|
||
| text_src: | ||
| EQEQ token_list EQEQ | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a new token INCLUDE handling it in the parser as that will also be used as part of the internal preprocessor's error messages