USDAParser.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. // Pre-compiled regex patterns for performance
  2. const DEF_MATCH_REGEX = /^def\s+(?:(\w+)\s+)?"?([^"]+)"?$/;
  3. const VARIANT_STRING_REGEX = /^string\s+(\w+)$/;
  4. const ATTR_MATCH_REGEX = /^(?:uniform\s+)?(\w+(?:\[\])?)\s+(.+)$/;
  5. // Spec types (must match USDCParser/USDComposer)
  6. const SpecType = {
  7. Attribute: 1,
  8. Prim: 6,
  9. Relationship: 8
  10. };
  11. class USDAParser {
  12. parseText( text ) {
  13. // Preprocess: strip comments and normalize multiline values
  14. text = this._preprocess( text );
  15. const root = {};
  16. const lines = text.split( '\n' );
  17. let string = null;
  18. let target = root;
  19. const stack = [ root ];
  20. for ( const line of lines ) {
  21. if ( line.includes( '=' ) ) {
  22. // Find the first '=' that's not inside quotes
  23. const eqIdx = this._findAssignmentOperator( line );
  24. if ( eqIdx === - 1 ) {
  25. string = line.trim();
  26. continue;
  27. }
  28. const lhs = line.slice( 0, eqIdx ).trim();
  29. const rhs = line.slice( eqIdx + 1 ).trim();
  30. if ( rhs.endsWith( '{' ) ) {
  31. const group = {};
  32. stack.push( group );
  33. target[ lhs ] = group;
  34. target = group;
  35. } else if ( rhs.endsWith( '(' ) ) {
  36. // see #28631
  37. const values = rhs.slice( 0, - 1 );
  38. target[ lhs ] = values;
  39. const meta = {};
  40. stack.push( meta );
  41. target = meta;
  42. } else {
  43. target[ lhs ] = rhs;
  44. }
  45. } else if ( line.includes( ':' ) && ! line.includes( '=' ) ) {
  46. // Handle dictionary entries like "0: [(...)...]" for timeSamples
  47. const colonIdx = line.indexOf( ':' );
  48. const key = line.slice( 0, colonIdx ).trim();
  49. const value = line.slice( colonIdx + 1 ).trim();
  50. // Only process if key looks like a number (timeSamples frame)
  51. if ( /^[\d.]+$/.test( key ) ) {
  52. target[ key ] = value;
  53. }
  54. } else if ( line.endsWith( '{' ) ) {
  55. string = line.slice( 0, - 1 ).trim() || string;
  56. const group = target[ string ] || {};
  57. stack.push( group );
  58. target[ string ] = group;
  59. target = group;
  60. } else if ( line.endsWith( '}' ) ) {
  61. stack.pop();
  62. if ( stack.length === 0 ) continue;
  63. target = stack[ stack.length - 1 ];
  64. } else if ( line.endsWith( '(' ) ) {
  65. const meta = {};
  66. stack.push( meta );
  67. string = line.split( '(' )[ 0 ].trim() || string;
  68. target[ string ] = meta;
  69. target = meta;
  70. } else if ( line.endsWith( ')' ) ) {
  71. stack.pop();
  72. target = stack[ stack.length - 1 ];
  73. } else if ( line.trim() ) {
  74. string = line.trim();
  75. }
  76. }
  77. return root;
  78. }
  79. _preprocess( text ) {
  80. // Remove block comments /* ... */
  81. text = this._stripBlockComments( text );
  82. // Collapse triple-quoted strings into single lines
  83. text = this._collapseTripleQuotedStrings( text );
  84. // Remove line comments # ... (but preserve #usda header)
  85. // Only remove # comments that aren't at the start of a line or after whitespace
  86. const lines = text.split( '\n' );
  87. const processed = [];
  88. let inMultilineValue = false;
  89. let bracketDepth = 0;
  90. let parenDepth = 0;
  91. let accumulated = '';
  92. for ( let i = 0; i < lines.length; i ++ ) {
  93. let line = lines[ i ];
  94. // Strip inline comments (but not inside strings)
  95. line = this._stripInlineComment( line );
  96. // Track bracket/paren depth for multiline values
  97. const trimmed = line.trim();
  98. if ( inMultilineValue ) {
  99. // Continue accumulating multiline value
  100. accumulated += ' ' + trimmed;
  101. // Update depths
  102. for ( const ch of trimmed ) {
  103. if ( ch === '[' ) bracketDepth ++;
  104. else if ( ch === ']' ) bracketDepth --;
  105. else if ( ch === '(' && bracketDepth > 0 ) parenDepth ++;
  106. else if ( ch === ')' && bracketDepth > 0 ) parenDepth --;
  107. }
  108. // Check if multiline value is complete
  109. if ( bracketDepth === 0 && parenDepth === 0 ) {
  110. processed.push( accumulated );
  111. accumulated = '';
  112. inMultilineValue = false;
  113. }
  114. } else {
  115. // Check if this line starts a multiline array value
  116. // Look for patterns like "attr = [" or "attr = @path@[" without closing ]
  117. if ( trimmed.includes( '=' ) ) {
  118. const eqIdx = this._findAssignmentOperator( trimmed );
  119. if ( eqIdx !== - 1 ) {
  120. const rhs = trimmed.slice( eqIdx + 1 ).trim();
  121. // Count brackets in the value part
  122. let openBrackets = 0;
  123. let closeBrackets = 0;
  124. for ( const ch of rhs ) {
  125. if ( ch === '[' ) openBrackets ++;
  126. else if ( ch === ']' ) closeBrackets ++;
  127. }
  128. if ( openBrackets > closeBrackets ) {
  129. // Multiline array detected
  130. inMultilineValue = true;
  131. bracketDepth = openBrackets - closeBrackets;
  132. parenDepth = 0;
  133. accumulated = trimmed;
  134. continue;
  135. }
  136. }
  137. }
  138. processed.push( trimmed );
  139. }
  140. }
  141. return processed.join( '\n' );
  142. }
  143. _stripBlockComments( text ) {
  144. // Iteratively remove /* ... */ comments without regex backtracking
  145. let result = '';
  146. let i = 0;
  147. while ( i < text.length ) {
  148. // Check for block comment start
  149. if ( text[ i ] === '/' && i + 1 < text.length && text[ i + 1 ] === '*' ) {
  150. // Find the closing */
  151. let j = i + 2;
  152. while ( j < text.length ) {
  153. if ( text[ j ] === '*' && j + 1 < text.length && text[ j + 1 ] === '/' ) {
  154. // Found closing, skip past it
  155. j += 2;
  156. break;
  157. }
  158. j ++;
  159. }
  160. // Move past the comment (or to end if unclosed)
  161. i = j;
  162. } else {
  163. result += text[ i ];
  164. i ++;
  165. }
  166. }
  167. return result;
  168. }
  169. _collapseTripleQuotedStrings( text ) {
  170. let result = '';
  171. let i = 0;
  172. while ( i < text.length ) {
  173. if ( i + 2 < text.length ) {
  174. const triple = text.slice( i, i + 3 );
  175. if ( triple === '\'\'\'' || triple === '"""' ) {
  176. const quoteChar = triple;
  177. result += quoteChar;
  178. i += 3;
  179. while ( i < text.length ) {
  180. if ( i + 2 < text.length && text.slice( i, i + 3 ) === quoteChar ) {
  181. result += quoteChar;
  182. i += 3;
  183. break;
  184. } else {
  185. if ( text[ i ] === '\n' ) {
  186. result += '\\n';
  187. } else if ( text[ i ] !== '\r' ) {
  188. result += text[ i ];
  189. }
  190. i ++;
  191. }
  192. }
  193. continue;
  194. }
  195. }
  196. result += text[ i ];
  197. i ++;
  198. }
  199. return result;
  200. }
  201. _stripInlineComment( line ) {
  202. // Don't strip if line starts with #usda
  203. if ( line.trim().startsWith( '#usda' ) ) return line;
  204. // Find # that's not inside a string
  205. let inString = false;
  206. let stringChar = null;
  207. let escaped = false;
  208. for ( let i = 0; i < line.length; i ++ ) {
  209. const ch = line[ i ];
  210. if ( escaped ) {
  211. escaped = false;
  212. continue;
  213. }
  214. if ( ch === '\\' ) {
  215. escaped = true;
  216. continue;
  217. }
  218. if ( ! inString && ( ch === '"' || ch === '\'' ) ) {
  219. inString = true;
  220. stringChar = ch;
  221. } else if ( inString && ch === stringChar ) {
  222. inString = false;
  223. stringChar = null;
  224. } else if ( ! inString && ch === '#' ) {
  225. // Found comment start outside of string
  226. return line.slice( 0, i ).trimEnd();
  227. }
  228. }
  229. return line;
  230. }
  231. _findAssignmentOperator( line ) {
  232. // Find the first '=' that's not inside quotes
  233. let inString = false;
  234. let stringChar = null;
  235. let escaped = false;
  236. for ( let i = 0; i < line.length; i ++ ) {
  237. const ch = line[ i ];
  238. if ( escaped ) {
  239. escaped = false;
  240. continue;
  241. }
  242. if ( ch === '\\' ) {
  243. escaped = true;
  244. continue;
  245. }
  246. if ( ! inString && ( ch === '"' || ch === '\'' ) ) {
  247. inString = true;
  248. stringChar = ch;
  249. } else if ( inString && ch === stringChar ) {
  250. inString = false;
  251. stringChar = null;
  252. } else if ( ! inString && ch === '=' ) {
  253. return i;
  254. }
  255. }
  256. return - 1;
  257. }
  258. /**
  259. * Parse USDA text and return raw spec data in specsByPath format.
  260. * Used by USDComposer for unified scene composition.
  261. */
  262. parseData( text ) {
  263. const root = this.parseText( text );
  264. const specsByPath = {};
  265. // Parse root metadata
  266. const rootFields = {};
  267. if ( '#usda 1.0' in root ) {
  268. const header = root[ '#usda 1.0' ];
  269. if ( header.upAxis ) {
  270. rootFields.upAxis = header.upAxis.replace( /"/g, '' );
  271. }
  272. if ( header.defaultPrim ) {
  273. rootFields.defaultPrim = header.defaultPrim.replace( /"/g, '' );
  274. }
  275. if ( header.metersPerUnit !== undefined ) {
  276. rootFields.metersPerUnit = parseFloat( header.metersPerUnit );
  277. }
  278. if ( header.framesPerSecond !== undefined ) {
  279. rootFields.framesPerSecond = parseFloat( header.framesPerSecond );
  280. }
  281. if ( header.timeCodesPerSecond !== undefined ) {
  282. rootFields.timeCodesPerSecond = parseFloat( header.timeCodesPerSecond );
  283. }
  284. }
  285. specsByPath[ '/' ] = { specType: SpecType.Prim, fields: rootFields };
  286. // Walk the tree and build specsByPath
  287. const walkTree = ( data, parentPath ) => {
  288. const primChildren = [];
  289. for ( const key in data ) {
  290. // Skip metadata
  291. if ( key === '#usda 1.0' ) continue;
  292. if ( key === 'variants' ) continue;
  293. // Check for primitive definitions
  294. // Matches both 'def TypeName "name"' and 'def "name"' (no type)
  295. const defMatch = key.match( DEF_MATCH_REGEX );
  296. if ( defMatch ) {
  297. const typeName = defMatch[ 1 ] || '';
  298. const name = defMatch[ 2 ];
  299. const path = parentPath === '/' ? '/' + name : parentPath + '/' + name;
  300. primChildren.push( name );
  301. const primFields = { typeName };
  302. const primData = data[ key ];
  303. // Extract attributes and relationships from this prim
  304. this._extractPrimData( primData, path, primFields, specsByPath, SpecType );
  305. specsByPath[ path ] = { specType: SpecType.Prim, fields: primFields };
  306. // Recurse into children
  307. walkTree( primData, path );
  308. }
  309. }
  310. // Add primChildren to parent spec
  311. if ( primChildren.length > 0 && specsByPath[ parentPath ] ) {
  312. specsByPath[ parentPath ].fields.primChildren = primChildren;
  313. }
  314. };
  315. walkTree( root, '/' );
  316. // Fallback: infer elementSize for primvars:skel:jointIndices/jointWeights
  317. // when not explicitly declared in the USDA text
  318. this._inferSkelElementSize( specsByPath );
  319. return { specsByPath };
  320. }
  321. _inferSkelElementSize( specsByPath ) {
  322. // For each mesh prim with primvars:skel:jointIndices/jointWeights but no
  323. // elementSize, infer it from the data: elementSize = array.length / numVertices.
  324. for ( const path in specsByPath ) {
  325. const spec = specsByPath[ path ];
  326. if ( spec.specType !== SpecType.Prim || spec.fields.typeName !== 'Mesh' ) continue;
  327. const pointsSpec = specsByPath[ path + '.points' ];
  328. if ( ! pointsSpec || ! pointsSpec.fields.default ) continue;
  329. const numVertices = pointsSpec.fields.default.length / 3;
  330. if ( numVertices === 0 ) continue;
  331. this._inferElementSize( specsByPath[ path + '.primvars:skel:jointIndices' ], numVertices );
  332. this._inferElementSize( specsByPath[ path + '.primvars:skel:jointWeights' ], numVertices );
  333. }
  334. }
  335. _inferElementSize( attrSpec, numVertices ) {
  336. if ( ! attrSpec || attrSpec.fields.elementSize !== undefined || ! attrSpec.fields.default ) return;
  337. const len = attrSpec.fields.default.length;
  338. if ( len > 0 && len % numVertices === 0 ) attrSpec.fields.elementSize = len / numVertices;
  339. }
  340. _extractPrimData( data, path, primFields, specsByPath, SpecType ) {
  341. if ( ! data || typeof data !== 'object' ) return;
  342. for ( const key in data ) {
  343. // Skip nested defs (handled by walkTree)
  344. if ( key.startsWith( 'def ' ) ) continue;
  345. if ( key === 'prepend references' ) {
  346. primFields.references = [ data[ key ] ];
  347. continue;
  348. }
  349. if ( key === 'payload' ) {
  350. primFields.payload = data[ key ];
  351. continue;
  352. }
  353. if ( key === 'variants' ) {
  354. const variantSelection = {};
  355. const variants = data[ key ];
  356. for ( const vKey in variants ) {
  357. const match = vKey.match( VARIANT_STRING_REGEX );
  358. if ( match ) {
  359. const variantSetName = match[ 1 ];
  360. const variantValue = variants[ vKey ].replace( /"/g, '' );
  361. variantSelection[ variantSetName ] = variantValue;
  362. }
  363. }
  364. if ( Object.keys( variantSelection ).length > 0 ) {
  365. primFields.variantSelection = variantSelection;
  366. }
  367. continue;
  368. }
  369. if ( key.startsWith( 'rel ' ) ) {
  370. const relName = key.slice( 4 );
  371. const relPath = path + '.' + relName;
  372. const target = data[ key ].replace( /[<>]/g, '' );
  373. specsByPath[ relPath ] = {
  374. specType: SpecType.Relationship,
  375. fields: { targetPaths: [ target ] }
  376. };
  377. continue;
  378. }
  379. // Handle xformOpOrder
  380. if ( key.includes( 'xformOpOrder' ) ) {
  381. const ops = data[ key ]
  382. .replace( /[\[\]]/g, '' )
  383. .split( ',' )
  384. .map( s => s.trim().replace( /"/g, '' ) );
  385. primFields.xformOpOrder = ops;
  386. continue;
  387. }
  388. // Handle typed attributes
  389. // Format: [qualifier] type attrName (e.g., "uniform token[] joints", "float3 position")
  390. const attrMatch = key.match( ATTR_MATCH_REGEX );
  391. if ( attrMatch ) {
  392. const valueType = attrMatch[ 1 ];
  393. const attrName = attrMatch[ 2 ];
  394. const rawValue = data[ key ];
  395. // Handle connection attributes (e.g., "inputs:normal.connect = </path>")
  396. if ( attrName.endsWith( '.connect' ) ) {
  397. const baseAttrName = attrName.slice( 0, - 8 ); // Remove '.connect'
  398. const attrPath = path + '.' + baseAttrName;
  399. // Parse connection path - extract from <path> format
  400. let connPath = String( rawValue ).trim();
  401. if ( connPath.startsWith( '<' ) ) connPath = connPath.slice( 1 );
  402. if ( connPath.endsWith( '>' ) ) connPath = connPath.slice( 0, - 1 );
  403. // Get or create the attribute spec
  404. if ( ! specsByPath[ attrPath ] ) {
  405. specsByPath[ attrPath ] = {
  406. specType: SpecType.Attribute,
  407. fields: { typeName: valueType }
  408. };
  409. }
  410. specsByPath[ attrPath ].fields.connectionPaths = [ connPath ];
  411. continue;
  412. }
  413. // Handle timeSamples attributes specially
  414. if ( attrName.endsWith( '.timeSamples' ) && typeof rawValue === 'object' ) {
  415. const baseAttrName = attrName.slice( 0, - 12 ); // Remove '.timeSamples'
  416. const attrPath = path + '.' + baseAttrName;
  417. // Parse timeSamples dictionary into times and values arrays
  418. const times = [];
  419. const values = [];
  420. for ( const frameKey in rawValue ) {
  421. const frame = parseFloat( frameKey );
  422. if ( isNaN( frame ) ) continue;
  423. times.push( frame );
  424. values.push( this._parseAttributeValue( valueType, rawValue[ frameKey ] ) );
  425. }
  426. // Sort by time
  427. const sorted = times.map( ( t, i ) => ( { t, v: values[ i ] } ) ).sort( ( a, b ) => a.t - b.t );
  428. specsByPath[ attrPath ] = {
  429. specType: SpecType.Attribute,
  430. fields: {
  431. timeSamples: { times: sorted.map( s => s.t ), values: sorted.map( s => s.v ) },
  432. typeName: valueType
  433. }
  434. };
  435. } else {
  436. // Parse value based on type
  437. const parsedValue = this._parseAttributeValue( valueType, rawValue );
  438. // Store as attribute spec, preserving any existing fields
  439. // (e.g. connectionPaths set by an earlier `.connect` form)
  440. const attrPath = path + '.' + attrName;
  441. if ( specsByPath[ attrPath ] ) {
  442. specsByPath[ attrPath ].fields.default = parsedValue;
  443. specsByPath[ attrPath ].fields.typeName = valueType;
  444. } else {
  445. specsByPath[ attrPath ] = {
  446. specType: SpecType.Attribute,
  447. fields: { default: parsedValue, typeName: valueType }
  448. };
  449. }
  450. }
  451. }
  452. }
  453. }
  454. _parseAttributeValue( valueType, rawValue ) {
  455. if ( rawValue === undefined || rawValue === null ) return undefined;
  456. const str = String( rawValue ).trim();
  457. // Array types
  458. if ( valueType.endsWith( '[]' ) ) {
  459. let result;
  460. // Parse JSON-like arrays
  461. try {
  462. // Handle arrays with parentheses like [(1,2,3), (4,5,6)]
  463. // Remove trailing comma (valid in USDA but not JSON)
  464. let cleaned = str.replace( /\(/g, '[' ).replace( /\)/g, ']' );
  465. if ( cleaned.endsWith( ',' ) ) cleaned = cleaned.slice( 0, - 1 );
  466. const parsed = JSON.parse( cleaned );
  467. // Flatten nested arrays for types like point3f[]
  468. result = Array.isArray( parsed ) && Array.isArray( parsed[ 0 ] ) ? parsed.flat() : parsed;
  469. } catch ( e ) {
  470. // Try simple array parsing
  471. const cleaned = str.replace( /[\[\]]/g, '' );
  472. result = cleaned.split( ',' ).map( s => {
  473. const trimmed = s.trim();
  474. const num = parseFloat( trimmed );
  475. return isNaN( num ) ? trimmed.replace( /"/g, '' ) : num;
  476. } );
  477. }
  478. //reorder (w, x, y, z) to (x, y, z, w)
  479. if ( valueType.startsWith( 'quat' ) ) {
  480. for ( let i = 0; i < result.length; i += 4 ) {
  481. const w = result[ i ];
  482. result[ i ] = result[ i + 1 ];
  483. result[ i + 1 ] = result[ i + 2 ];
  484. result[ i + 2 ] = result[ i + 3 ];
  485. result[ i + 3 ] = w;
  486. }
  487. }
  488. return result;
  489. }
  490. // Vector types (double3, float3, point3f, etc.)
  491. if ( valueType.includes( '3' ) || valueType.includes( '2' ) || valueType.includes( '4' ) ) {
  492. // Parse (x, y, z) format
  493. const cleaned = str.replace( /[()]/g, '' );
  494. const values = cleaned.split( ',' ).map( s => parseFloat( s.trim() ) );
  495. return values;
  496. }
  497. // Quaternion types (quatf, quatd, quath)
  498. // Text format is (w, x, y, z), convert to (x, y, z, w)
  499. if ( valueType.startsWith( 'quat' ) ) {
  500. const cleaned = str.replace( /[()]/g, '' );
  501. const values = cleaned.split( ',' ).map( s => parseFloat( s.trim() ) );
  502. return [ values[ 1 ], values[ 2 ], values[ 3 ], values[ 0 ] ];
  503. }
  504. // Matrix types
  505. if ( valueType.includes( 'matrix' ) ) {
  506. const cleaned = str.replace( /[()]/g, '' );
  507. const values = cleaned.split( ',' ).map( s => parseFloat( s.trim() ) );
  508. return values;
  509. }
  510. // Scalar numeric types
  511. if ( valueType === 'float' || valueType === 'double' || valueType === 'int' ) {
  512. return parseFloat( str );
  513. }
  514. // String/token types
  515. if ( valueType === 'string' || valueType === 'token' ) {
  516. return this._parseString( str );
  517. }
  518. // Asset path
  519. if ( valueType === 'asset' ) {
  520. return str.replace( /@/g, '' ).replace( /"/g, '' );
  521. }
  522. // Default: return as string with quotes removed
  523. return this._parseString( str );
  524. }
  525. _parseString( str ) {
  526. // Remove surrounding quotes
  527. if ( ( str.startsWith( '"' ) && str.endsWith( '"' ) ) ||
  528. ( str.startsWith( '\'' ) && str.endsWith( '\'' ) ) ) {
  529. str = str.slice( 1, - 1 );
  530. }
  531. // Handle escape sequences
  532. let result = '';
  533. let i = 0;
  534. while ( i < str.length ) {
  535. if ( str[ i ] === '\\' && i + 1 < str.length ) {
  536. const next = str[ i + 1 ];
  537. switch ( next ) {
  538. case 'n': result += '\n'; break;
  539. case 't': result += '\t'; break;
  540. case 'r': result += '\r'; break;
  541. case '\\': result += '\\'; break;
  542. case '"': result += '"'; break;
  543. case '\'': result += '\''; break;
  544. default: result += next; break;
  545. }
  546. i += 2;
  547. } else {
  548. result += str[ i ];
  549. i ++;
  550. }
  551. }
  552. return result;
  553. }
  554. }
  555. export { USDAParser };
粤ICP备19079148号