mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user