Skip to content

Simple node tree abstraction layer over RSX syntax trees

Notifications You must be signed in to change notification settings

victorporof/rsx-dom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Under heavy research and development, please don't use this yet!

rsx-dom

License: MPL 2.0 Build Status

Simple node tree abstraction layer over RSX syntax trees

Purpose

A backwards compatible higher level of abstraction over the AST generated by the RSX parser. Since working directly with rsx_parser::RSXElement abstract syntax trees (or Rust's proc_macro::TokenStream) can be tedious, and the underlying parser and compiler data formats can change at any time, a simpler DOM structure is useful as an abstraction layer in the scope of writing RSX code.

How to use

Documentation

This crate concerns itself strictly generating a DOM node tree from a RSX syntax tree. If you're just looking to write RSX in your project, take a look at the RSX compiler plugin instead.

Otherwise, add this to your Cargo.toml file:

[dependencies]
rsx-dom = { git = "https://github.com/victorporof/rsx-dom.git" }

RSX parsing is enabled via the rsx-parse feature gate.

[dependencies]
rsx-dom = { git = "https://github.com/victorporof/rsx-dom.git", features = ["rsx-parse"] }

When used as part of the RSX compiler plugin, the convertion is automatic between rsx_parser::RSXElement abstract syntax trees to the more convenient rsx_dom::DOMNode elements, because the AST is directly tokenized into a DOM tree to avoid any runtime work! Templating is thus a zero cost abstraction.

If manual instantiation is desired, simply import the library into your code to build rsx_dom::DOMNode elements.

extern crate rsx_dom;
use rsx_dom::types::DOMNode;

let node = DOMNode::from(...);

Note that when used as a compiler plugin,

Note: rsx-dom also re-exports the rsx-parser crate, only needed if you need to parse character streams (such as strings) directly. You'll probably prefer using the rsx! macro as part of the RSX compiler plugin instead.

See all the available types for more details.

About

Simple node tree abstraction layer over RSX syntax trees

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages