Skip to main content

Crate xamlx

Crate xamlx 

Source
Expand description

Rust port of the backend-independent part of XamlX, the XAML compiler library by Nikita Tsukanov (MIT, see external/XamlX/NOTICE.md).

The crate mirrors the upstream layout module for module:

ModuleUpstreamContents
astAst/AST nodes, visitors, type/property references, intrinsics
parsersParsers/XML based XAML parser and the markup extension parser
type_systemTypeSystem/the type system abstraction and its helpers
transformTransform/transformation context, configuration and all AST transformers
emitEmit/backend-agnostic emit contracts
compilerCompiler/the backend-independent compiler driver
diagnosticsDiagnostics/diagnostics and their severity
exceptionsExceptions.csthe error type

The IL backend (IL/) is not part of the port. Upstream AST nodes implement the IL emitting interfaces directly; here the nodes carry only their data, and a backend supplies node emitters (emit::IXamlAstNodeEmitter) for them.

§Conventions

  • C# interfaces keep their I prefix as trait names and are used through Rc<dyn ...> handles; a C# property named Type becomes type_.
  • Nodes are mutable through Cell/RefCell fields, which keeps the upstream in-place visitor semantics and node identity.
  • Exceptions become XamlResult values carrying an XamlError.

Re-exports§

pub use diagnostics::XamlDiagnostic;
pub use diagnostics::XamlDiagnosticSeverity;
pub use diagnostics::XamlXWellKnownDiagnosticCodes;
pub use exceptions::XamlError;
pub use exceptions::XamlParseException;
pub use exceptions::XamlResult;
pub use exceptions::XamlTypeSystemException;
pub use xaml_namespaces::XamlNamespaces;

Modules§

ast
Port of the Ast/ directory.
compiler
Port of the Compiler/ directory: the backend-independent compiler driver.
diagnostics
Port of the Diagnostics/ directory.
emit
Port of the Emit/ directory: the backend-agnostic emit abstractions.
exceptions
Port of Exceptions.cs.
extensions
Port of the Extensions/ directory.
parsers
Port of the Parsers/ directory.
transform
Port of the Transform/ directory.
type_system
Port of the TypeSystem/ directory: the type system abstraction used by the compiler.
xaml_namespaces
Port of XamlNamespaces.cs.

Macros§

xaml_ast_node_members
Implements the bookkeeping members of IXamlAstNode inside an impl block.
xaml_line_info_impl
Implements IXamlLineInfo by delegating to an embedded XamlAstNode (or any other IXamlLineInfo field): xaml_line_info_impl!(MyNode, base).
xaml_query_interface
Answers a query_interface request for each listed interface type.