diff --git a/tools/codegen/src/ir/mod.rs b/tools/codegen/src/ir/mod.rs index 539bf9e..2f7ab36 100644 --- a/tools/codegen/src/ir/mod.rs +++ b/tools/codegen/src/ir/mod.rs @@ -8,31 +8,31 @@ use property::Property; pub use format::Format; pub(crate) use from_ast::ToIntermediate; -use crate::ast::SyntaxVersion; +pub use crate::ast::SyntaxVersion; /// Intermediate file. #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct Ir { +pub struct Ir { #[serde(default)] - syntax_version: SyntaxVersion, - namespace: String, - imports: Vec, + pub syntax_version: SyntaxVersion, + pub namespace: String, + pub imports: Vec, #[serde(rename = "declarations")] - decls: Vec, + pub decls: Vec, } #[derive(Debug, Clone, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct ImportStmt { - name: String, - paths: Vec, - path_supers: usize, +pub struct ImportStmt { + pub name: String, + pub paths: Vec, + pub path_supers: usize, } #[derive(Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields, tag = "type", rename_all = "lowercase")] -pub(crate) enum TopDecl { +pub enum TopDecl { #[serde(rename = "option")] Option_(Option_), Union(Union), @@ -45,86 +45,86 @@ pub(crate) enum TopDecl { #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct Option_ { - name: String, - item: ItemDecl, +pub struct Option_ { + pub name: String, + pub item: ItemDecl, #[serde(default = "zero", skip_serializing_if = "is_zero")] - imported_depth: usize, + pub imported_depth: usize, } #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct Union { - name: String, +pub struct Union { + pub name: String, #[serde(deserialize_with = "deserialize_union_items")] - items: Vec, + pub items: Vec, #[serde(default = "zero", skip_serializing_if = "is_zero")] - imported_depth: usize, + pub imported_depth: usize, } #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct Array { - name: String, - item: ItemDecl, - item_count: usize, +pub struct Array { + pub name: String, + pub item: ItemDecl, + pub item_count: usize, #[serde(default = "zero", skip_serializing_if = "is_zero")] - imported_depth: usize, + pub imported_depth: usize, } #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct Struct { - name: String, - fields: Vec, +pub struct Struct { + pub name: String, + pub fields: Vec, #[serde(default = "zero", skip_serializing_if = "is_zero")] - imported_depth: usize, + pub imported_depth: usize, } #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct FixVec { - name: String, - item: ItemDecl, +pub struct FixVec { + pub name: String, + pub item: ItemDecl, #[serde(default = "zero", skip_serializing_if = "is_zero")] - imported_depth: usize, + pub imported_depth: usize, } #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct DynVec { - name: String, - item: ItemDecl, +pub struct DynVec { + pub name: String, + pub item: ItemDecl, #[serde(default = "zero", skip_serializing_if = "is_zero")] - imported_depth: usize, + pub imported_depth: usize, } #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct Table { - name: String, - fields: Vec, +pub struct Table { + pub name: String, + pub fields: Vec, #[serde(default = "zero", skip_serializing_if = "is_zero")] - imported_depth: usize, + pub imported_depth: usize, } #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields, transparent)] -pub(crate) struct ItemDecl { - typ: String, +pub struct ItemDecl { + pub typ: String, } #[derive(Debug, Property, Serialize, Deserialize)] #[serde(deny_unknown_fields)] -pub(crate) struct UnionItemDecl { - typ: String, - id: usize, +pub struct UnionItemDecl { + pub typ: String, + pub id: usize, } #[derive(Debug, Serialize, Deserialize)] #[serde(untagged)] -enum UnionItemsForCompatibility { +pub enum UnionItemsForCompatibility { ItemsForCompatibility(Vec), Items(Vec), } @@ -149,10 +149,10 @@ where #[derive(Debug, Property, Deserialize, Serialize)] #[serde(deny_unknown_fields)] -pub(crate) struct FieldDecl { - name: String, +pub struct FieldDecl { + pub name: String, #[serde(rename = "type")] - typ: String, + pub typ: String, } const fn zero() -> usize { diff --git a/tools/codegen/src/lib.rs b/tools/codegen/src/lib.rs index fcbdbd4..b8a1881 100644 --- a/tools/codegen/src/lib.rs +++ b/tools/codegen/src/lib.rs @@ -7,7 +7,7 @@ pub(crate) mod parser; pub(crate) mod utils; #[cfg(feature = "compiler-plugin")] -mod ir; +pub mod ir; pub use compiler::Compiler; pub use generator::Language;