Jump to content

ConfigNode parser


Recommended Posts

Is there an up-to-date parser available for the ConfigNode-format?

Preferably in javascript (nodejs), but any language would do.

Also: Can somebody tell me what drove Squad to build a proprietary format in the first place?

It looks so similar to JSON and I can't think of something which their format can store but JSON can not. All the additional work for (de-)serialization for what?

- - - Updated - - -

If there is none available I would go on and build one, but the format seems to be inconsistent when it comes to collections, or at least I can't see the difference:

Example:

The collection of parts and modules in a .craft file are separate objects:


PART
{
MODULE
{
}
MODULE
{
}
}
PART
{
}

The events and actions within a module on the other hand are not separate:


EVENTS
{
Foo
{
}
Bar
{
}
}

Link to comment
Share on other sites

Well, after a good amount of time spent, I think I have reverse engineered the format correctly.

I will post the source of the parser as a nodejs module on GitHub soon. It has no dependencies so it could be used with plain javascript pretty much without any change. Porting it to another language should be fairly easy too.

The above examples would map to the following JSON:


{
name: ""
nodes: [
{ name: "PART", nodes: [], values:{} },
{ name: "PART", nodes: [], values:{} }
],
values: {}
}


{
name: "EVENTS"
nodes: [
{ name: "Foo", nodes: [], values:{} },
{ name: "Bar", nodes: [], values:{} }
],
values: {}
}

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...