cplusplus / cplusplus/draft

[cpp.pre] p1 directive-introducing token is immediately followed by a whitespace

Open
#5,393 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

[cpp.pre] p1 says

the first token in the sequence, ..., is

  • [...]
  • an import preprocessing token immediately followed on the same logical line by a header-name, <, identifier, string-literal, or : preprocessing token, or
  • a module preprocessing token immediately followed on the same logical line by an identifier, :, or ; preprocessing token, or
  • an export preprocessing token immediately followed on the same logical line by one of the two preceding forms.

Consider such three cases:

import                             <string>;     
module                                ; 
export                import                    "squee";

Neither of them is immediately followed by the expected preprocessing tokens on the same logic line. In other words, these directive-introducing tokens are immediately followed by whitespaces. I think whitespace should be considered here since [lex.phases] p3 says

The source file is decomposed into preprocessing tokens ([lex.pptoken]) and sequences of whitespace characters (including comments).

Only at phase 7 will these whitespace characters be no longer significant. P7 says

Whitespace characters separating tokens are no longer significant.

In other words, it makes sense that we consider whitespace characters for any phase prior to phase 7. Thus, the intervening whitespace makes the tokens not immediately follow the directive-introducing token. I think [cpp.pre] p1 might be changed to

  • an import preprocessing token, if ignore whitespace containing no new-line characters, immediately followed on the same logical line by a header-name, <, identifier, string-literal, or : preprocessing token, or
  • a module preprocessing token, if ignore whitespace containing no new-line characters, immediately followed on the same logical line by an identifier, :, or ; preprocessing token, or
  • an export preprocessing token, if ignore whitespace containing no new-line characters, immediately followed on the same logical line by one of the two preceding forms.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading [cpp.pre] paragraph 1 alongside [lex.phases] paragraphs 3 and 7, then examine the reported examples with intervening whitespace. Determine whether the wording needs clarification and update the draft only once the interpretation is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.