microsoft / microsoft/TypeScript
Trivia ownership documentation seems to be incorrect
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Acknowledgement
- I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.
Comment
Referencing the #1678 issue and the ast-trivia: trivia ownership in the typescript-book, there seems to be an error in explanation:
in the issue @mhegazy mentions:
one thing that is different from the Roslyn notion of trivia, is we do not have trailing trivia. all triva in TypeScript is leading. so for instance [...]
in the same issue and in the wiki book however the following info is given:
In General:
- A token owns any trivia after it on the same line upto the next token.
- Any comment after that line is associated with the following token.
So from the first cite I understand as if token owns any trivia before it up to the previous token ([trivia of A][token A]... that's why end-of-file token is always present) which seems to be the correct explanation, while the second cite describes that a token owns the trivia after it up to next token in the same line, which would mean that A has trailing trivia, thus not true in TS — albeit true for Roslyn.
[token A][trivia owned by A]<nl>
[trivia owned by B]
[token B]
Unless there is some misconception of what "owned" trivia means, but imo the second cite is incorrect.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Öffne docs/compiler/ast-trivia.md im Abschnitt „trivia ownership“ und vergleiche dessen Formulierung mit Issue #1678 und dem darin zitierten TypeScript-Verhalten. Aktualisiere die Erklärung so, dass der Besitz mit dem im Issue beschriebenen Modell der führenden Trivia übereinstimmt, und überprüfe anschließend, dass die enthaltenen Beispiele nicht mehr den Eindruck erwecken, es handle sich um nachfolgende Trivia.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 1/5
- Geschätzter Aufwand
- Unter einer Stunde
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 48/100