Change m2 lexical analysis to optionally consume C comments.
authorGaius Mulley <gaiusmod2@gmail.com>
Tue, 24 Jan 2023 19:21:20 +0000 (19:21 +0000)
committerGaius Mulley <gaiusmod2@gmail.com>
Tue, 24 Jan 2023 19:21:20 +0000 (19:21 +0000)
commit96fd01679011379d6da0777e435078212c6bb325
tree8f0b186c25fc0f5f613607158b9f673c20b3f3b0
parentb061fc94d70dc82f554eeb94434cf03cd5af03f7
Change m2 lexical analysis to optionally consume C comments.

This patch allows a subsequent patch to turn on/off the consuming
of C comments.

gcc/m2/ChangeLog:

* m2.flex (cpreprocessor): Add temporary variable
which is initialized to 0.
(commentCLevel): New variable.
(endOfCComment): New function.
(splitSlashStar): New function to split /* into / and *
tokens.
(COMMENTC): New flex state.
("/*"): New rule to test whether we should treat /*
as a single token or as two tokens.
(<COMMENTC>.): New rule to skip a character.
(<COMMENTC>\n.*): New rule to consume the line.
(<COMMENTC>"*/"): New rule to call endOfCComment.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/m2.flex