Update vk_parse to 0.2
This commit is contained in:
parent
6a5f18e6ac
commit
9e4f25f282
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||||
authors = ["Maik Klein <maikklein@googlemail.com>"]
|
authors = ["Maik Klein <maikklein@googlemail.com>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
vk-parse = "0.1"
|
vk-parse = "0.2"
|
||||||
vkxml = "0.3"
|
vkxml = "0.3"
|
||||||
nom = "4.0"
|
nom = "4.0"
|
||||||
heck = "0.3"
|
heck = "0.3"
|
||||||
|
|
|
@ -856,14 +856,14 @@ impl<'a> ConstantExt for ExtensionConstant<'a> {
|
||||||
pub fn generate_extension_constants<'a>(
|
pub fn generate_extension_constants<'a>(
|
||||||
extension_name: &str,
|
extension_name: &str,
|
||||||
extension_number: i64,
|
extension_number: i64,
|
||||||
extension_items: &'a [vk_parse::ExtensionItem],
|
extension_items: &'a [vk_parse::ExtensionChild],
|
||||||
const_cache: &mut HashSet<&'a str>,
|
const_cache: &mut HashSet<&'a str>,
|
||||||
const_values: &mut HashMap<Ident, Vec<Ident>>,
|
const_values: &mut HashMap<Ident, Vec<Ident>>,
|
||||||
) -> quote::Tokens {
|
) -> quote::Tokens {
|
||||||
let items = extension_items
|
let items = extension_items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(|item| match item {
|
||||||
vk_parse::ExtensionItem::Require { items, .. } => Some(items.iter()),
|
vk_parse::ExtensionChild::Require { items, .. } => Some(items.iter()),
|
||||||
_ => None,
|
_ => None,
|
||||||
}).flat_map(|iter| iter);
|
}).flat_map(|iter| iter);
|
||||||
let enum_tokens = items.filter_map(|item| match item {
|
let enum_tokens = items.filter_map(|item| match item {
|
||||||
|
@ -921,16 +921,16 @@ pub fn generate_extension_constants<'a>(
|
||||||
}
|
}
|
||||||
pub fn generate_extension_commands<'a>(
|
pub fn generate_extension_commands<'a>(
|
||||||
extension_name: &str,
|
extension_name: &str,
|
||||||
items: &[vk_parse::ExtensionItem],
|
items: &[vk_parse::ExtensionChild],
|
||||||
cmd_map: &CommandMap<'a>,
|
cmd_map: &CommandMap<'a>,
|
||||||
fn_cache: &mut HashSet<&'a str>,
|
fn_cache: &mut HashSet<&'a str>,
|
||||||
) -> Tokens {
|
) -> Tokens {
|
||||||
let commands = items
|
let commands = items
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|ext_item| match ext_item {
|
.filter_map(|ext_item| match ext_item {
|
||||||
vk_parse::ExtensionItem::Require { items, .. } => {
|
vk_parse::ExtensionChild::Require { items, .. } => {
|
||||||
Some(items.iter().filter_map(|item| match item {
|
Some(items.iter().filter_map(|item| match item {
|
||||||
vk_parse::InterfaceItem::Command { name, .. } => cmd_map.get(name).map(|c| *c),
|
vk_parse::InterfaceItem::Command { ref name, .. } => cmd_map.get(name).map(|c| *c),
|
||||||
_ => None,
|
_ => None,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
@ -957,11 +957,11 @@ pub fn generate_extension<'a>(
|
||||||
let extension_tokens = generate_extension_constants(
|
let extension_tokens = generate_extension_constants(
|
||||||
&extension.name,
|
&extension.name,
|
||||||
extension.number.unwrap_or(0),
|
extension.number.unwrap_or(0),
|
||||||
&extension.items,
|
&extension.children,
|
||||||
const_cache,
|
const_cache,
|
||||||
const_values,
|
const_values,
|
||||||
);
|
);
|
||||||
let fp = generate_extension_commands(&extension.name, &extension.items, cmd_map, fn_cache);
|
let fp = generate_extension_commands(&extension.name, &extension.children, cmd_map, fn_cache);
|
||||||
let q = quote!{
|
let q = quote!{
|
||||||
#fp
|
#fp
|
||||||
#extension_tokens
|
#extension_tokens
|
||||||
|
@ -1779,8 +1779,8 @@ pub fn generate_feature_extension<'a>(
|
||||||
) -> Tokens {
|
) -> Tokens {
|
||||||
let constants =
|
let constants =
|
||||||
registry.0.iter().filter_map(|item| match item {
|
registry.0.iter().filter_map(|item| match item {
|
||||||
vk_parse::RegistryItem::Feature { name, items, .. } => Some(
|
vk_parse::RegistryChild::Feature(feature) => Some(
|
||||||
generate_extension_constants(name, 0, items, const_cache, const_values),
|
generate_extension_constants(&feature.name, 0, &feature.children, const_cache, const_values),
|
||||||
),
|
),
|
||||||
_ => None,
|
_ => None,
|
||||||
});
|
});
|
||||||
|
@ -1860,7 +1860,7 @@ pub fn write_source_code(path: &Path) {
|
||||||
.0
|
.0
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|item| match item {
|
.filter_map(|item| match item {
|
||||||
vk_parse::RegistryItem::Extensions { items: ext, .. } => Some(ext),
|
vk_parse::RegistryChild::Extensions(ref ext) => Some(&ext.children),
|
||||||
_ => None,
|
_ => None,
|
||||||
}).nth(0)
|
}).nth(0)
|
||||||
.expect("extension");
|
.expect("extension");
|
||||||
|
|
Loading…
Reference in a new issue