| 413 | //----------------------------------------------------------------------------- |
| 414 | |
| 415 | bool Taml::parse(const char* pFilename, TamlVisitor& visitor) |
| 416 | { |
| 417 | // Debug Profiling. |
| 418 | PROFILE_SCOPE(Taml_Parse); |
| 419 | |
| 420 | // Sanity! |
| 421 | AssertFatal(pFilename != NULL, "Taml::parse() - Cannot parse a NULL filename."); |
| 422 | |
| 423 | // Fetch format mode. |
| 424 | const TamlFormatMode formatMode = getFileAutoFormatMode(pFilename); |
| 425 | |
| 426 | // Handle format mode appropriately. |
| 427 | switch (formatMode) |
| 428 | { |
| 429 | case XmlFormat: |
| 430 | { |
| 431 | // Parse with the visitor. |
| 432 | TamlXmlParser parser; |
| 433 | |
| 434 | // Are property changes needed but not supported? |
| 435 | if (visitor.wantsPropertyChanges() && !parser.canChangeProperty()) |
| 436 | { |
| 437 | // Yes, so warn. |
| 438 | Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename); |
| 439 | return false; |
| 440 | } |
| 441 | |
| 442 | return parser.accept(pFilename, visitor); |
| 443 | } |
| 444 | |
| 445 | case JSONFormat: |
| 446 | { |
| 447 | // Parse with the visitor. |
| 448 | /*TamlJSONParser parser; |
| 449 | |
| 450 | // Are property changes needed but not supported? |
| 451 | if ( visitor.wantsPropertyChanges() && !parser.canChangeProperty() ) |
| 452 | { |
| 453 | // Yes, so warn. |
| 454 | Con::warnf( "Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a specified visitor requires property changes which are not supported by the parser.", getFormatModeDescription(formatMode), pFilename ); |
| 455 | return false; |
| 456 | } |
| 457 | |
| 458 | return parser.accept( pFilename, visitor ); */ |
| 459 | return false; |
| 460 | } |
| 461 | |
| 462 | case BinaryFormat: |
| 463 | default: |
| 464 | break; |
| 465 | } |
| 466 | |
| 467 | // Warn. |
| 468 | Con::warnf("Taml::parse() - Cannot parse '%s' file-type for filename '%s' as a required parser is not available.", getFormatModeDescription(formatMode), pFilename); |
| 469 | return false; |
| 470 | } |
| 471 | |
| 472 | //----------------------------------------------------------------------------- |
no test coverage detected