How to use the acorn-jsx.tokContexts function in acorn-jsx

To help you get started, we’ve selected a few acorn-jsx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hitext / hitext / src / temp-generators / lang-js / syntax.js View on Github external
tokens.forEach(({ token, context }) => {
        let type = null;

        switch (context) {
            case acorn.tokContexts.j_oTag:
            case acorn.tokContexts.j_cTag:
                switch (token.type) {
                    case acorn.tokTypes.jsxTagStart:
                    case acorn.tokTypes.jsxTagEnd:
                    case acorn.tokTypes.braceR:
                    case acorn.tokTypes.eq:
                    case acorn.tokTypes.slash:
                        type = 'punctuator';
                        break;
                }
                break;

            default:
                switch (token.type) {
                    case acorn.tokTypes.num:
                        type = 'number';
                        break;

acorn-jsx

Modern, fast React.js JSX parser

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis

Similar packages