Skip to content

Commit

Permalink
Merge branch 'juno/add-java-parser' of https://github.com/aceslick911…
Browse files Browse the repository at this point in the history
…/astexplorer into aceslick911-juno/add-java-parser
  • Loading branch information
fkling committed Aug 4, 2020
2 parents 7d61002 + 9bf5bae commit e3e40be
Show file tree
Hide file tree
Showing 17 changed files with 307 additions and 85 deletions.
49 changes: 27 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ The AST explorer provides following code parsers:
- [@vue/compiler-core][]
- [vue-eslint-parser][]
- [ICU][]
- Java
- [java-parser][]
- JavaScript:
- [acorn][] + [acorn-jsx][]
- [babel-eslint][]
Expand Down Expand Up @@ -79,7 +81,7 @@ Depending on the parser settings, it not only supports ES5/CSS3 but also

- ES6: [arrow functions](https://github.com/lukehoban/es6features#arrows), [destructuring](https://github.com/lukehoban/es6features#destructuring),
[classes](https://github.com/lukehoban/es6features#classes), ...
- ES7 proposals: [async/await](https://github.com/lukehoban/ecmascript-asyncawait), [object rest / spread](https://github.com/sebmarkbage/ecmascript-rest-spread), ...
- ES7 proposals: [async/await](https://github.com/lukehoban/ecmascript-asyncawait), [object rest / spread](https://github.com/sebmarkbage/ecmascript-rest-spread), ...
- [JSX](https://facebook.github.io/jsx/), known through [React](https://facebook.github.io/react/).
- Typed JavaScript ([Flow](http://flowtype.org/) and [TypeScript](http://typescriptlang.org/))
- [SASS](http://sass-lang.com/)
Expand Down Expand Up @@ -110,16 +112,16 @@ are included so you can prototype your own plugins:

- Save and fork code snippets. Copy the URL to share them.
- Copying an AST or dropping a file containing an AST into the window will
parse the AST and update the code using [escodegen][].
parse the AST and update the code using [escodegen][].
- Otherwise, the content of text editor will be replaced with the content of the
file (i.e. you can drag and drop JS files).
file (i.e. you can drag and drop JS files).
- Choose between multiple parsers and configure them.
- shift+click on a node expands the full subtree.
- Hovering over a node highlights the corresponding text in the source code
- Editing the source or moving the cursor around will automatically highlight
the corresponding AST node (or its ancestors of it isn't expanded)
- You can use `$node` in the console to refer to the last opened/toggled AST
node.
node.

[acorn-jsx]: https://github.com/RReverser/acorn-jsx
[acorn]: https://github.com/ternjs/acorn
Expand Down Expand Up @@ -170,16 +172,17 @@ node.
[yaml]: https://github.com/eemeli/yaml
[yaml-ast-parser]: https://github.com/mulesoft-labs/yaml-ast-parser
[esformatter]: https://github.com/millermedeiros/esformatter-parser#readme
[MDX]: https://mdxjs.com/
[mdx]: https://mdxjs.com/
[mdxhast]: https://mdxjs.com/advanced/ast#mdxhast
[mdx]: https://mdxjs.com/advanced/sync-api
[Scalameta]: http://scalameta.org/
[scalameta]: http://scalameta.org/
[solidity-parser-antlr]: https://github.com/federicobond/solidity-parser-antlr
[vue-template-compiler]: https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler
[@vue/compiler-core]: https://github.com/vuejs/vue-next/blob/master/packages/compiler-core/README.md
[vue-eslint-parser]: https://github.com/mysticatea/vue-eslint-parser
[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

### Contributions

Expand All @@ -194,31 +197,33 @@ as possible!
2. Install the new parser as dependency: `yarn add theParser` (or `npm install -S theParser`)
3. Copy one of the existing examples in `src/parsers/{language}`.
4. Adjust the code as necessary:
- Update metadata.
- Load the right parser (`loadParser`).
- Call the right parsing method with the right/necessary options in `parse`.
- Implement the `nodeToRange` method (this is for highlighting).
- Implement the `getNodeName` method (this is for quick look through the tree).
- Implement `opensByDefault` method for auto-expansion of specific properties.
- Define `_ignoredProperties` set or implement `forEachProperty` generator method for filtering.
- Provide a `renderSettings` method if applicable.

- Update metadata.
- Load the right parser (`loadParser`).
- Call the right parsing method with the right/necessary options in `parse`.
- Implement the `nodeToRange` method (this is for highlighting).
- Implement the `getNodeName` method (this is for quick look through the tree).
- Implement `opensByDefault` method for auto-expansion of specific properties.
- Define `_ignoredProperties` set or implement `forEachProperty` generator method for filtering.
- Provide a `renderSettings` method if applicable.

#### How to add a new transformer

0. Go to `website/`.
1. Install the new transformer as dependency.
2. Copy one of the existing examples in `src/parsers/{language}/transformers`.
3. Adjust the code as necessary:
- Update metadata and `defaultParserID`.
- Load the right transformer (`loadTransformer`).
- Call the transformation method in `transform`.
- Change sample transformation code in `codeExample.txt`.
1. Copy one of the existing examples in `src/parsers/{language}/transformers`.
1. Adjust the code as necessary:

- Update metadata and `defaultParserID`.
- Load the right transformer (`loadTransformer`).
- Call the transformation method in `transform`.
- Change sample transformation code in `codeExample.txt`.

#### Build your own version for development

1. Clone the repository.
3. Go to `website/`.
4. Install all dependencies with `yarn install` (you can run `npm install` as
2. Go to `website/`.
3. Install all dependencies with `yarn install` (you can run `npm install` as
well).

Run `yarn run build` for the final minimized version.
Expand Down
18 changes: 11 additions & 7 deletions website/.fontcustom-manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"checksum": {
"previous": "16162f150d3b19ba44cc2e51f284fbcdff1d8722369f798daec6b2817f6f7b69",
"current": "16162f150d3b19ba44cc2e51f284fbcdff1d8722369f798daec6b2817f6f7b69"
"previous": "45cd59da2a1bc422647cab7f5363931929292afe7ca74b83e1e27f66f99ade81",
"current": "45cd59da2a1bc422647cab7f5363931929292afe7ca74b83e1e27f66f99ade81"
},
"fonts": [
"fontcustom/fontcustom_16162f150d3b19ba44cc2e51f284fbcd.ttf",
"fontcustom/fontcustom_16162f150d3b19ba44cc2e51f284fbcd.svg",
"fontcustom/fontcustom_16162f150d3b19ba44cc2e51f284fbcd.woff",
"fontcustom/fontcustom_16162f150d3b19ba44cc2e51f284fbcd.eot",
"fontcustom/fontcustom_16162f150d3b19ba44cc2e51f284fbcd.woff2"
"fontcustom/fontcustom_45cd59da2a1bc422647cab7f53639319.ttf",
"fontcustom/fontcustom_45cd59da2a1bc422647cab7f53639319.svg",
"fontcustom/fontcustom_45cd59da2a1bc422647cab7f53639319.woff",
"fontcustom/fontcustom_45cd59da2a1bc422647cab7f53639319.eot",
"fontcustom/fontcustom_45cd59da2a1bc422647cab7f53639319.woff2"
],
"glyphs": {
"GraphQL_Logo": {
Expand All @@ -23,6 +23,10 @@
"codepoint": 61698,
"source": "./fontcustom/input-svg/icu.svg"
},
"java": {
"codepoint": 61703,
"source": "./fontcustom/input-svg/java.svg"
},
"ocaml": {
"codepoint": 61702,
"source": "./fontcustom/input-svg/ocaml.svg"
Expand Down
31 changes: 23 additions & 8 deletions website/fontcustom/fontcustom-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,20 @@

@font-face {
font-family: "fontcustom";
src: url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.eot");
src: url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.eot?#iefix") format("embedded-opentype"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.woff2") format("woff2"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.woff") format("woff"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.ttf") format("truetype"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.svg#fontcustom") format("svg");
src: url("./fontcustom_45cd59da2a1bc422647cab7f53639319.eot");
src: url("./fontcustom_45cd59da2a1bc422647cab7f53639319.eot?#iefix") format("embedded-opentype"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.woff2") format("woff2"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.woff") format("woff"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.ttf") format("truetype"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.svg#fontcustom") format("svg");
font-weight: normal;
font-style: normal;
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: "fontcustom";
src: url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.svg#fontcustom") format("svg");
src: url("./fontcustom_45cd59da2a1bc422647cab7f53639319.svg#fontcustom") format("svg");
}
}

Expand All @@ -164,6 +164,7 @@
.icon-GraphQL_Logo:before,
.icon-handlebars:before,
.icon-icu:before,
.icon-java:before,
.icon-ocaml:before,
.icon-reason:before,
.icon-rust:before,
Expand All @@ -185,6 +186,7 @@
.icon-GraphQL_Logo:before { content: "\f100"; }
.icon-handlebars:before { content: "\f101"; }
.icon-icu:before { content: "\f102"; }
.icon-java:before { content: "\f107"; }
.icon-ocaml:before { content: "\f106"; }
.icon-reason:before { content: "\f105"; }
.icon-rust:before { content: "\f104"; }
Expand All @@ -204,7 +206,7 @@
<body class="characters-off">
<div id="page" class="container">
<header>
<h1>fontcustom contains 7 glyphs:</h1>
<h1>fontcustom contains 8 glyphs:</h1>
<a onclick="toggleCharacters(); return false;" href="#">Toggle Preview Characters</a>
</header>

Expand Down Expand Up @@ -248,6 +250,19 @@ <h1>fontcustom contains 7 glyphs:</h1>
</div>
</div>

<div class="glyph">
<div class="preview-glyphs">
<span class="step size-12"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-14"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-16"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-18"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-21"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-24"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-36"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-48"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-60"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span><span class="step size-72"><span class="letters">Pp</span><i id="icon-java" class="icon-java"></i></span>
</div>
<div class="preview-scale">
<span class="step">12</span><span class="step">14</span><span class="step">16</span><span class="step">18</span><span class="step">21</span><span class="step">24</span><span class="step">36</span><span class="step">48</span><span class="step">60</span><span class="step">72</span>
</div>
<div class="usage">
<input class="class" type="text" readonly="readonly" onClick="this.select();" value=".icon-java" />
<input class="point" type="text" readonly="readonly" onClick="this.select();" value="&amp;#xf107;" />
</div>
</div>

<div class="glyph">
<div class="preview-glyphs">
<span class="step size-12"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-14"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-16"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-18"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-21"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-24"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-36"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-48"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-60"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span><span class="step size-72"><span class="letters">Pp</span><i id="icon-ocaml" class="icon-ocaml"></i></span>
Expand Down
16 changes: 9 additions & 7 deletions website/fontcustom/fontcustom.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@

@font-face {
font-family: "fontcustom";
src: url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.eot");
src: url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.eot?#iefix") format("embedded-opentype"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.woff2") format("woff2"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.woff") format("woff"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.ttf") format("truetype"),
url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.svg#fontcustom") format("svg");
src: url("./fontcustom_45cd59da2a1bc422647cab7f53639319.eot");
src: url("./fontcustom_45cd59da2a1bc422647cab7f53639319.eot?#iefix") format("embedded-opentype"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.woff2") format("woff2"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.woff") format("woff"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.ttf") format("truetype"),
url("./fontcustom_45cd59da2a1bc422647cab7f53639319.svg#fontcustom") format("svg");
font-weight: normal;
font-style: normal;
}

@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: "fontcustom";
src: url("./fontcustom_16162f150d3b19ba44cc2e51f284fbcd.svg#fontcustom") format("svg");
src: url("./fontcustom_45cd59da2a1bc422647cab7f53639319.svg#fontcustom") format("svg");
}
}

Expand All @@ -27,6 +27,7 @@
.icon-GraphQL_Logo:before,
.icon-handlebars:before,
.icon-icu:before,
.icon-java:before,
.icon-ocaml:before,
.icon-reason:before,
.icon-rust:before,
Expand All @@ -48,6 +49,7 @@
.icon-GraphQL_Logo:before { content: "\f100"; }
.icon-handlebars:before { content: "\f101"; }
.icon-icu:before { content: "\f102"; }
.icon-java:before { content: "\f107"; }
.icon-ocaml:before { content: "\f106"; }
.icon-reason:before { content: "\f105"; }
.icon-rust:before { content: "\f104"; }
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit e3e40be

Please sign in to comment.