Skip to content

Commit

Permalink
- fix: includeXml directives were being pruned incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
RavenX8 committed Nov 28, 2024
1 parent 3e39650 commit 1095eea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions generator/src/flat_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub enum ComplexTypeContent {
Empty
}

use heck::ToUpperCamelCase;
pub use ::schema::ast::Occurs;

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -145,12 +146,12 @@ impl Packet {
pub fn new(type_: String
, doc: Option<String>) -> Self {
use ::heck::*;
let name = type_.clone().to_lower_camel_case();
let (class_name, filename) = if name.starts_with("isc") {
let name = type_.clone().to_upper_camel_case();
let (class_name, filename) = if name.starts_with("Isc") {
(name.clone(),
name.clone().to_snake_case())
} else {
if name.starts_with("pakcs") {
if name.starts_with("Pakcs") {
let name = "Cli".to_string() + &name[5..];
(name.clone(),
name.clone().to_snake_case())
Expand Down Expand Up @@ -439,7 +440,7 @@ impl Bitset {
impl SimpleType {
pub fn new(name: String, doc: Option<String>) -> Self {
use heck::ToLowerCamelCase;
SimpleType{ name: name.to_lower_camel_case(), contents: Vec::new(), doc }
SimpleType{ name: name.to_upper_camel_case(), contents: Vec::new(), doc }
}

pub fn add_content(&mut self, content: SimpleTypeContent) {
Expand Down
6 changes: 3 additions & 3 deletions generator/src/graph_passes.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ::flat_ast::*;
use std::collections::{BTreeMap, HashSet};
use heck::ToLowerCamelCase;
use heck::{ToLowerCamelCase, ToUpperCamelCase};

#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
struct NodeId(usize);
Expand Down Expand Up @@ -250,7 +250,7 @@ pub fn run(mut packet: Packet) -> Result<Packet, ::failure::Error> {
for content in s.contents() {
match content {
Restriction(ref r) => {
if let Ok(node) = graph.get_node(&r.base().to_owned().to_lower_camel_case()) {
if let Ok(node) = graph.get_node(&r.base().to_owned().to_upper_camel_case()) {
let to = graph.get_node(s.name()).unwrap();
graph.add_edge(to, node);
}
Expand All @@ -260,7 +260,7 @@ pub fn run(mut packet: Packet) -> Result<Packet, ::failure::Error> {
},
PacketContent::Element(ref e) => {
trace!("adding start node {}", e.type_());
graph.add_start_node(&e.type_().to_owned().to_lower_camel_case());
graph.add_start_node(&e.type_().to_owned().to_upper_camel_case());
match e.occurs() {
Some(self::Occurs::Unbounded) => vector = true,
Some(self::Occurs::Num(_)) => array = true,
Expand Down

0 comments on commit 1095eea

Please sign in to comment.