Letting me save things to _ or _myVar to throw it away. fixing printing newlines in strings

This commit is contained in:
Dustin Swan 2026-04-06 17:29:40 -06:00
parent d36f694d80
commit 586d55df85
No known key found for this signature in database
GPG key ID: 30D46587E2100467
3 changed files with 24 additions and 5 deletions

View file

@ -199,9 +199,19 @@ export class Parser {
return { definitions, typeDefinitions, classDefinitions, instanceDeclarations };
}
private underscoreCounter = 0;
private parseDefinition(): Definition {
const nameToken = this.expect('ident');
const name = (nameToken as { value: string }).value;
let nameToken: Token;
let name: string;
if (this.current().kind === 'underscore') {
nameToken = this.advance();
name = `_${this.underscoreCounter++}`;
} else {
nameToken = this.expect('ident');
name = (nameToken as { value: string }).value;
}
let annotation: Annotation | undefined;
if (this.current().kind === 'colon') {