mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 02:15:29 +00:00
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Xml.Linq;
|
|
|
|
namespace CHeaderToXML
|
|
{
|
|
class GLXmlParser : Parser
|
|
{
|
|
public GLXmlParser()
|
|
{
|
|
|
|
}
|
|
|
|
public override IEnumerable<XElement> Parse(string[] lines)
|
|
{
|
|
var input = XDocument.Parse(String.Join(" ", lines));
|
|
|
|
// Enumerations
|
|
var groups = input.Root
|
|
.Elements("groups")
|
|
.Elements("group");
|
|
foreach (var group in groups)
|
|
{
|
|
var e = new XElement("enum");
|
|
e.Name = group.Attribute("name").Value;
|
|
foreach (var token in group.Elements("enum"))
|
|
{
|
|
if (token.Attribute("value") != null)
|
|
{
|
|
e.Add(new XElement("token",
|
|
new XAttribute("name", token.Attribute("name")),
|
|
new XAttribute("value", token.Attribute("value"))));
|
|
}
|
|
else
|
|
{
|
|
e.Add(new XElement("use",
|
|
new XAttribute("token", token.Attribute("name"))));
|
|
}
|
|
}
|
|
|
|
yield return e;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|