]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add support for nested conditionals
authorse <se@FreeBSD.org>
Wed, 28 Oct 2020 14:48:58 +0000 (14:48 +0000)
committerse <se@FreeBSD.org>
Wed, 28 Oct 2020 14:48:58 +0000 (14:48 +0000)
commit5e562dae0b42c9ea7fba14cc953922dcc79aa7ed
tree61d2a69cca2bd5d66f7d0a0ddeadb18c12d772b5
parent24d19117052f25120edb3b4a06c338a1458ca008
Add support for nested conditionals

The previous behavior was to support nested #ifdef and #ifndef, but to
return to unconditional parsing after the next #endif, independently of
the number of previously parsed conditions.

E.g. after "#ifdef A / #ifdef B / #endif" the following lines were
unconditially parsed again, independently of A and/or B being defined.

The new behavior is to count the level of false conditions and to only
restart parsing of calendar entries when the corresponding number of
#endif tokens have been seen.

In addition to the above, an #else directive has been added, to toggle
between parsing and ignoring of the following lines.

No validation of the correct use of the condition directives is made.
#endif without prior #define or #ifndef is ignored and #else toggles
between parsing and skipping of entries.

The MFC period has been set to 1 month to allow for a review of the
changes and for a discussion, whether these modifications should not
be merged at all.

No correct input file is parsed differently than before, but if calendar
data files are published that use these new features, those data files
will not parse correctly on prior versions of this program.

MFC after: 1 month
usr.bin/calendar/calendar.1
usr.bin/calendar/io.c