-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support more compiler directives #257
Conversation
Would this handle #153 ? |
No, the |
We would like to be able to parse the whole https://github.com/OCamlPro/gnucobol-contrib/tree/1618cb70d3855fd56a17bb2522c421e38993fc6d/samples/worldcities folder, (with the fixes from OCamlPro/gnucobol-contrib#1), and this is used in some files |
I see in there it's not used in floating position… so maybe Boris's suggestion could work (as a temporary measure). |
I think only GnuCOBOL supports that and the features is removed in COBOL 2014, so handling this specific one is likely not important. |
0a6c7c9
to
460b4e3
Compare
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.
Seems all good to me, but one question concerning a test failure
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.
All good for me 👌
I'd love a PR for GnuCOBOL on that as well :-) Concerning this PR: Do you want to do a follow-up for the MF conditional compilation? 78 my-define VALUE 5.
$IF my-define
DISPLAY 'something'
$END |
The |
Also avoid emitting empty semantic tokens
27537e8
to
c239bb0
Compare
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.
There are some issues on the MF side (see comments), but I'm mostly concerned about ISO.
I don't know if there's a preparser applied or if the compdir_grammar.mly keywords are taken "verbatim".
ISO says:
A compiler directive is composed of the compiler directive indicator
>>
, optionally followed by the COBOL character space, followed by compiler-instruction. The compiler directive indicator shall be treated as though it were followed by a space if no space is specified after the indicator.
Also note that "the COBOL character space" can consist of multiple character spaces.
I do wonder: does
>> IF something DEFINED
PERFORM something
>> ELSE
PERFORM other-stuff
>>END-IF
works.
…ple spaces As per the ISO/IEC 1989:2014, page 92: > Anywhere a space is used as a separator or as part of a separator, > more than one space may be used.
Those
For that, I originally followed GnuCOBOL. The version I used did not allow more than one character, so |
Oh, please check that then. Concerning this PR it looks good to me now. |
Adds support for
>>DEFINE
and simple (cascading) conditional compilation directives.>>SET
directives are parsed but not interpreted yet.>>EVALUATE
/>>WHEN
shall be added in a subsequent PR.