rust-lang / rust-lang/fls

Syntax rule for non-doc line comments

Open
#608 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
reStructuredText
Stars
497
Forks
41
Avg merge
3h 52m
Merged PRs (30d)
4

Description

§2.5 (fls_q8l2jza7d9xa) provides the following syntax rule for a non-doc line comment:

LineComment ::=
    //
  | // (~[! /] | //) ~[\n]*

The ~[! /] expression is there to make sure this rule doesn't match an outer line doc.

But that expressions matches too broadly: it accepts LF, which it shouldn't (the notation ~[X Y] is defined in §1.1.4:14 (fls_blvsfqeevosr) and means to match a single character other than X or Y).

That means that this syntax rule says, for example, that the following input
is a single LineComment:

//
x = 1

Contributor guide

Open the contributing guide

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 with §2.5 (fls_q8l2jza7d9xa) and compare the LineComment rule with the character-matching notation defined in §1.1.4:14 (fls_blvsfqeevosr). Correct the rule so a line-feed cannot be consumed as part of a non-doc line comment, and verify that the shown // followed by x = 1 input is no longer one LineComment.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.