Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Jsx Parser By Parser Combinators.

NotificationsYou must be signed in to change notification settings

Saber2pr/jsx-ast-parser

Repository files navigation

npmcodecov

jsx parser by parser combinators.

yarn add @saber2pr/jsx-ast-parser

Usage

import{parser,transformer,compiler,traverser,}from'@saber2pr/jsx-ast-parser'constcode=`<div className="hello">world</div>`constast=parser.parse(code)// parse ast from code stringconstjsx=transformer.transform(ast)// transform ast to jsx// compile jsx to source codecompiler.compile(jsx)===code// true// find jsx nodetraverser.findNode(jsx,node=>transformer.isTextElement(node))// [ { tagName: 'text', nodeValue: 'world' } ]

Help

  1. Api Docs
  2. Jsx Ast Viewer

Feature

Overview Grammar BNF

jsx.bnf

Syntax currently supported

  • parser
    • jsx
      • jsx opened
      • jsx self closing
      • jsx props
        • jsx props string-value
        • jsx props number-value, bool-value
        • jsx props object
        • jsx props object-array
        • jsx props string-array, number-array
        • jsx props arrow function
          • jsx props arrow function scope statements
        • jsx props function
          • jsx props function scope statements
    • statement
      • call chain
      • arrow function
      • comment
      • arithmetic
      • function
      • define
      • assign
      • if else
      • for
      • while
      • try catch
      • return
      • deconstruct
      • as
  • transformer
    • transform jsx
  • traverser
    • traverse ast
    • traverse jsx
  • compiler
    • compile ast
    • compile jsx

Why

It started as a project for me to learn the principles of compilation, but now I'm confident I can make it better! I will continue to provide analysis tools for JSX code.

About

Jsx Parser By Parser Combinators.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp