Version
TypeScript 7.0.2
Reproduction
npm install typescript@7.0.2
node --input-type=module -e 'import { createScanner, LanguageVariant, SyntaxKind } from "typescript/unstable/ast"; const scanner=createScanner(false,LanguageVariant.Standard,"#"); for(let i=0;i<2;i++){const token=scanner.scan(); console.log(SyntaxKind[token], scanner.getTokenStart(), scanner.getTokenEnd())}'
Actual output:
PrivateIdentifier 0 0
PrivateIdentifier 0 0
The scanner repeatedly returns the same non-EOF token without moving from offset 0. A loop that scans until EndOfFile therefore never terminates on a bare # (including when a later comment appears in the same source). Expected: scanning malformed input advances or returns EOF so consumers can terminate. A bare # followed by an identifier scans normally.
Version
TypeScript 7.0.2
Reproduction
npm install typescript@7.0.2 node --input-type=module -e 'import { createScanner, LanguageVariant, SyntaxKind } from "typescript/unstable/ast"; const scanner=createScanner(false,LanguageVariant.Standard,"#"); for(let i=0;i<2;i++){const token=scanner.scan(); console.log(SyntaxKind[token], scanner.getTokenStart(), scanner.getTokenEnd())}'Actual output:
The scanner repeatedly returns the same non-EOF token without moving from offset 0. A loop that scans until
EndOfFiletherefore never terminates on a bare#(including when a later comment appears in the same source). Expected: scanning malformed input advances or returns EOF so consumers can terminate. A bare#followed by an identifier scans normally.