Add support for connection syntax parsing in USDA lexer

- Add readConnection() method to tokenize USDA connection targets (<...>)
- Connection targets are now properly recognized as STRING tokens
- This allows files with connection attributes (.connect) to tokenize correctly
- Example: </path/to/prim.attribute> is now recognized as a valid token

All 304 test files continue to process successfully.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Syoyo Fujita
2026-01-13 10:17:52 +09:00
parent 749dffb8ee
commit cc7ea8dca0

View File

@@ -442,6 +442,29 @@ class UsdaLexer {
return { type: TokenType.IDENTIFIER, value };
}
readConnection() {
this.advance(); // consume opening <
let value = '';
while (this.pos < this.input.length) {
const ch = this.peek();
if (ch === '>') {
this.advance();
break;
}
if (ch === '\\') {
this.advance();
value += this.advance();
} else {
value += this.advance();
}
}
return { type: TokenType.STRING, value };
}
nextToken() {
this.skipWhitespace();
@@ -470,6 +493,10 @@ class UsdaLexer {
const token = this.readAssetPath();
return { ...token, line: startLine, col: startCol };
}
case '<': {
const token = this.readConnection();
return { ...token, line: startLine, col: startCol };
}
}
// Strings