Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added another javascript parser called "@jeefo/ecma_parser" #644

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ The AST explorer provides following code parsers:
- [typescript][]
- [typescript-eslint-parser][]
- [uglify-js][]
- [@jeefo/ecma_parser][]
- JSON:
- [JSON][]
- [Momoa][]
Expand Down Expand Up @@ -198,6 +199,7 @@ are included so you can prototype your own plugins:
[svelte]: https://github.com/sveltejs/svelte
[hyntax]: https://github.com/nik-garmash/hyntax
[java-parser]: https://github.com/jhipster/prettier-java/tree/master/packages/java-parser
[@jeefo/ecma_parser]: https://github.com/je3f0o/jeefo_ecma_parser

### Contributions

Expand Down Expand Up @@ -244,4 +246,4 @@ as possible!
Run `yarn run build` for the final minimized version.
Run `yarn run watch` for incremental builds.

Run `yarn start` to start a simple static webserver.
Run `yarn start` to start a simple static webserver.
3 changes: 2 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@glimmer/compiler": "^0.83.1",
"@glimmer/syntax": "^0.83.1",
"@humanwhocodes/momoa": "^1.0.0",
"@jeefo/ecma_parser": "^0.0.11",
"@mdx-js/mdx": "^1.5.8",
"@swc/wasm-web": "^1.2.146",
"@typescript-eslint/parser": "^5.0.0",
Expand Down Expand Up @@ -181,4 +182,4 @@
"lint": "node_modules/eslint/bin/eslint.js src/",
"fontcustom": "fontcustom compile ./fontcustom/input-svg/ --config=./fontcustom/config.yml"
}
}
}
51 changes: 51 additions & 0 deletions website/src/parsers/js/jeefo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
* File Name : jeefo.js
* Created at : 2022-05-11
* Updated at : 2022-05-12
* Author : jeefo
* Purpose :
* Description :
* Reference :
.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.*/
// ignore:start
"use strict";

/* globals*/
/* exported*/

// ignore:end

import pkg from "@jeefo/ecma_parser/package.json";
import defaultParserInterface from "../utils/defaultParserInterface";

export default {
...defaultParserInterface,

id: "jeefo",
displayName: pkg.name,
version: pkg.version,
homepage: pkg.homepage,
locationProps: new Set(["start", "end"]),
typeProps: new Set(["_id", "_type", "_precedence"]),

loadParser(callback) {
require(["@jeefo/ecma_parser/dist/jeefo_parser"], async jeefo => {
const parser = await jeefo.require("./es8/parser");
callback(parser);
});
},

parse(parser, code) {
return parser.parse(code);
},

getNodeName(node) {
return node.id;
},

nodeToRange(node) {
if (node.start) {
return [node.start.index, node.end.index + 1];
}
},
};
30 changes: 30 additions & 0 deletions website/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,36 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==

"@jeefo/command@^0.0.3":
version "0.0.3"
resolved "https://registry.yarnpkg.com/@jeefo/command/-/command-0.0.3.tgz#1c83d25165dcc4755933dc3f90f997ba2b4b6818"
integrity sha512-tjdpTTHr1GQp4CWVtccV3eHE9TvbNEQfsMwslKjbaRnTl2jwtmNmGmSPttpnLpR17/ATEs89DQYiUpmGY9knDg==

"@jeefo/ecma_parser@^0.0.11":
version "0.0.11"
resolved "https://registry.yarnpkg.com/@jeefo/ecma_parser/-/ecma_parser-0.0.11.tgz#3b0a271f59a837ab690efe86786526cc50d54efa"
integrity sha512-Bl7H+fS3MWruV0ar2UEe31QaKRZ/T83gEo+zKdEBZrz42GLfGAEHWqP7TkpKepHy/RvXhd+LCmEAi00vdU1RQA==
dependencies:
"@jeefo/command" "^0.0.3"
"@jeefo/parser" "^0.0.28"
"@jeefo/tokenizer" "^0.0.6"
"@jeefo/utils" "^0.0.16"

"@jeefo/parser@^0.0.28":
version "0.0.28"
resolved "https://registry.yarnpkg.com/@jeefo/parser/-/parser-0.0.28.tgz#9effa4a6deffb86cfebc9a52b4c20cba2c6515d6"
integrity sha512-RhsqhDuyOMP2/zSlIH+BhV9yrvEWRkFksaxyhkD3awZSCXIhtRUEhcqzv5QfyngrVtXiBuyBS732ZBRo305E0g==

"@jeefo/tokenizer@^0.0.6":
version "0.0.6"
resolved "https://registry.yarnpkg.com/@jeefo/tokenizer/-/tokenizer-0.0.6.tgz#792e5859c504c98bb7115e67035e076a81109ee3"
integrity sha512-erJKroeyhsZVFEwVvtd+TQvg3QOmjTK3gN2eZHgmP7klOHuG4qmY6TPCHaIwnrDpc1LvZxg3Vr8LCV63eX6aZw==

"@jeefo/utils@^0.0.16":
version "0.0.16"
resolved "https://registry.yarnpkg.com/@jeefo/utils/-/utils-0.0.16.tgz#b653404f12e16b05dc0a19bb1ed16036b20f66a2"
integrity sha512-rTutNTuxuir9FIo9bgxq7wqvz8Qdyq7qCdMhYsl66SvNPf2d1r2DhgECq39KxvzIEh58BWE/mMd88PonSPpjQQ==

"@mdx-js/mdx@^1.5.8":
version "1.5.8"
resolved "https://registry.yarnpkg.com/@mdx-js/mdx/-/mdx-1.5.8.tgz#40740eaf0b0007b461cee8df13a7ae5a1af8064a"
Expand Down