[04/32] cpp lexer

Nathan Sidwell nathan@acm.org
Tue Nov 3 21:13:51 GMT 2020


c++ modules creates 2 new kinds of preprocessor lines
[export] module ...
[export] import ...

To all intents and purposes these are cppdirectives spelt without a 
leading '#'.  module and import are context-sensitive keywords.  Thus 
preprocessor tokenizing needs a bit of token peeking.  This is that peeking.

We have a new node flag 'NODE_MODULE', which marks whether an identifier 
is significant to this peeking.  When we see such an identifier at the 
beginning of a logical line, we need to peek further and figure out 
whether these are those keywords.

When successfully peeked, we replace the identifiers with internal-only 
tokens that the c++ parser recognizes.

-- 
Nathan Sidwell

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04-cpp-lexer.diff
Type: text/x-patch
Size: 19243 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201103/198bffdc/attachment-0001.bin>


More information about the Gcc-patches mailing list