YAML.jl icon indicating copy to clipboard operation
YAML.jl copied to clipboard

Application specific tags?

Open YongHeeK opened this issue 6 years ago • 1 comments

I know it's clearly stated at README that Application specific tags are not implemented. But it seems to me basic structures are already there, and I'm wondering is it possible to implement that functionality.

I'm trying to parse unity data for my project. But there are some strings in unity data that YAML.jl can't handle

I can filter those strings manually, and read unity data with YAML.jl. But if there is better way to do this, It will be really helpful for me 😄

here is a minimal example

using YAML

s1 = """
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
  m_ObjectHideFlags: 1
  m_Modification:
    m_TransformParent: {fileID: 0}
    m_Modifications: []
  m_SourcePrefab: {fileID: 0}
  m_RootGameObject: {fileID: 1794587523630750}
--- !u!1 &1087941076346928
GameObject:
  m_ObjectHideFlags: 1
  m_PrefabInternal: {fileID: 100100000}
  m_Component:
  - component: {fileID: 224636974132200644}
  m_Layer: 5
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_IsActive: 1
"""
data = YAML.load(s1) # is not working

s2 = """
Prefab:
  m_ObjectHideFlags: 1
  m_Modification:
    m_TransformParent: {fileID: 0}
    m_Modifications: []
  m_SourcePrefab: {fileID: 0}
  m_RootGameObject: {fileID: 1794587523630750}
GameObject:
  m_ObjectHideFlags: 1
  m_PrefabInternal: {fileID: 100100000}
  m_Component:
  - component: {fileID: 224636974132200644}
  m_Layer: 5
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_IsActive: 1
"""
data = YAML.load(s2) # it works

YongHeeK avatar Dec 27 '18 09:12 YongHeeK

Bump this, reading tags is now supported, although not writing. I have an application where I'm OK with just having a parse tree, then I can modify the data and save back the YAML, with the tags, without ever having to actually unmarshall and marshall again all the custom objects. Would that be easily implementable?

nlw0 avatar Feb 11 '20 23:02 nlw0