Coder Social home page Coder Social logo

rsx-dom's Introduction

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.

rsx-dom's People

Contributors

victorporof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.