Added initial EXEC preprocessor handling logic in pplex and ppparse.#279
Added initial EXEC preprocessor handling logic in pplex and ppparse.#279utam-1 wants to merge 9 commits into
Conversation
GitMensch
left a comment
There was a problem hiding this comment.
that's a good start; missing are: cobc/Changelog and an entry in NEWS with something like
for parsing purposes, EXEC blocks are now recognized and handed with the "unsupported" warning level (defaulting to error) with INCLUDE statements handled as copybooks
along with test cases in syn_extensions.at (test an empty block, an empty SQL block and missing name after INCLUDE so we have a clue if error handling works, then another that from GixSQL's test cases which uses EXEC SQL INCLUDE with sqlca and another copybook, allowing the validation that the include did work correctly)
GitMensch
left a comment
There was a problem hiding this comment.
overall a remarkably better commit than the last one; see more notes below
| ]) | ||
|
|
||
| AT_CHECK([$COMPILE_ONLY prog.cob], [1], [], | ||
| [prog.cob:5: error: syntax error, unexpected END_EXEC, expecting Word or Literal |
There was a problem hiding this comment.
This shows that the tolen name END_EXEC should get a literal value "END-EXEC"
GitMensch
left a comment
There was a problem hiding this comment.
Hi Uttam,
that PR is nearly ready to go upstream. Please have a look at the following comments, push your changes again (should pass CI) and I'll commit it.
This provides the baseline for the preprocessor config file.
Side note: I've added you to "contrib devs" on SF, so you can commit to the contrib svn repo and have the GnuCOBOL project in the associations under your SF profile.
|
Hello Simon, |
GitMensch
left a comment
There was a problem hiding this comment.
That looks nice!
Just a minor thing: replace leading spaces by tab (I could do that on upstream-merge otherwise).
Some more things I've stumbled over now in the review comments below.
Question: Should we start a target branch here + then create one PR against that according to the GSoC proposal - or have a single new one where we do everything until we consider the external preprocessor handling finished?
| INCLUDE SQLCA | ||
| END-EXEC. | ||
| EXEC SQL | ||
| INCLUDE EMPREC |
There was a problem hiding this comment.
I've missed that before, we also need an example like INCLUDE "EMPREC" -> literal and ideally also INCLUDE SQLCA.cpy -> embedded perioid
| <EXEC_STATE>{ | ||
| "END-EXEC"([ \t]*\.)? { BEGIN (INITIAL); return END_EXEC; } | ||
| "INCLUDE" { return INCLUDE; } | ||
| {WORD} { pplval.s = cobc_plex_strdup (yytext); return TOKEN; } |
There was a problem hiding this comment.
distinguish between a new SUBSYSTEM "subsytem" token and "common" TOKEN, which will improve diagnostics;
that may either be done with a new EXEC_STATE_START or with a static variable
Yes that would be nice, I tried to replace them with
I think keeping this as the baseline target branch and then creating a PR against that makes sense. |
|
sounds like a plan; I'd consider that branch fine now, so you may start with the next steps per your original GSoC plan (I only leave a minor change request, but that's really minor) |
| if (!exec_subsystem_seen) { | ||
| exec_subsystem_seen = 1; | ||
| return SUBSYSTEM; | ||
| } |
There was a problem hiding this comment.
just always go with TOKEN here, that's no valid SUBSYSTEM
|
|
||
|
|
||
| AT_SETUP([EXEC SQL INCLUDE sqlca and copybook]) | ||
| AT_KEYWORDS([exec sql include sqlca extensions]) |
There was a problem hiding this comment.
all words in the test name are automatically added to the keywords and all keywords are case-senstive, so please cleanup the duplicates in all tests' keyywords; thanks
| 03 ENO PIC S9(4) COMP. | ||
| 03 LNAME PIC X(10). |
There was a problem hiding this comment.
COBOL85 ruleset would not compile that; area A (columns 8-11) should have the level 01+77 + most "boilerplate", column 12+ have higher levels (like these) and all coded statements, see below
| DISPLAY SQLCODE. | ||
| MOVE 1 TO ENO. | ||
| STOP RUN. |
There was a problem hiding this comment.
these are statements and start ideally at col12+(area b); also if there are statements then you should have a section or paragraph definition (those go to area a) - the easiest thing is go with MAIN.
Note: this does work "as is" but keeping a portable coding style is a good trait, so I suggest to go over those things for the test.
Thank you! |
|
PR should be merged upstream, then I'll create a rebased branch that you can work from. I still wait for the FSF attorney to send the signed papers (will ping them mid/end of this week if I don't see any response, I'm actually waiting on multiple ones this time). ... but you can already start with that work, just don't push to this branch (either a separate one based on that or push later). |
Brief description of PR
The aim of this PR is to add an initial foundation work related to : https://sourceforge.net/p/gnucobol/feature-requests/341/
Changes made
The basic idea behind these changes are to initially detect and raise error for EXEC .... END EXEC block. In order to do so we defined a new state for the compiler <EXEC_STATE>, and necessary grammar rules for parser to handle these blocks, which handle the foreign embedded code.