Skip to content

Commit c72c627

Browse files
committed
run cxx-gen-ast as a typescript app
This is an internal tool, there is no need to compile it to JavaScript, instead run it directly with modern node.js with type stripping enabled.
1 parent 9d90ff5 commit c72c627

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+205
-220
lines changed

package-lock.json

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"playground": "npm run dev -w @robertoraggi/cxx-playground",
4040
"setup-venv": "zx scripts/setup-venv.mjs",
4141
"update-tests": "zx scripts/update-tests.mjs",
42-
"cxx-gen-ast": "node packages/cxx-gen-ast",
42+
"cxx-gen-ast": "node --no-warnings packages/cxx-gen-ast/src/gen.ts",
4343
"cxx-gen-lsp": "node packages/cxx-gen-lsp packages/cxx-gen-lsp/metaModel.json packages/cxx-gen-lsp -o src/lsp/cxx/lsp",
4444
"download-lsp-model": "zx scripts/download-lsp-model.mjs",
4545
"download-mlir": "gh run download -n mlir --dir build.em/llvm-project/install/"

packages/cxx-gen-ast/.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/cxx-gen-ast/package.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@
44
"private": true,
55
"type": "module",
66
"description": "Generate AST from C++ source code",
7-
"main": "./dist/gen.js",
8-
"bin": {
9-
"cxx-gen-ast": "./dist/gen.js"
10-
},
117
"scripts": {
12-
"postinstall": "npm run build",
13-
"build": "tsc",
14-
"watch": "tsc -w"
8+
"build": "tsc"
159
},
1610
"keywords": [],
1711
"author": {
@@ -26,9 +20,6 @@
2620
"devDependencies": {
2721
"@types/node": "^24.0.10",
2822
"@types/yargs": "^17.0.33",
29-
"@typescript-eslint/eslint-plugin": "^8.35.1",
30-
"@typescript-eslint/parser": "^8.35.1",
31-
"eslint": "^9.30.1",
3223
"prettier": "^3.6.2",
3324
"typescript": "^5.8.3",
3425
"yargs": "^18.0.0"

packages/cxx-gen-ast/src/gen.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,32 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
// SOFTWARE.
2222

23-
import { gen_ast_cc } from "./gen_ast_cc.js";
24-
import { gen_ast_printer_cc } from "./gen_ast_printer_cc.js";
25-
import { gen_ast_printer_h } from "./gen_ast_printer_h.js";
26-
import { gen_ast_fwd_h } from "./gen_ast_fwd_h.js";
27-
import { gen_ast_h } from "./gen_ast_h.js";
28-
import { gen_ast_kind_h } from "./gen_ast_kind_h.js";
29-
import { gen_ast_recursive_visitor_ts } from "./gen_ast_recursive_visitor_ts.js";
30-
import { gen_ast_slot_cc } from "./gen_ast_slot_cc.js";
31-
import { gen_ast_slot_h } from "./get_ast_slot_h.js";
32-
import { gen_ast_ts } from "./gen_ast_ts.js";
33-
import { gen_ast_visitor_h } from "./gen_ast_visitor_h.js";
34-
import { gen_ast_visitor_cc } from "./gen_ast_visitor_cc.js";
35-
import { gen_ast_visitor_ts } from "./gen_ast_visitor_ts.js";
36-
import { parseAST } from "./parseAST.js";
37-
import { gen_ast_kind_ts } from "./gen_ast_kind_ts.js";
38-
import { gen_ast_fbs } from "./gen_ast_fbs.js";
39-
import { gen_ast_encoder_h } from "./gen_ast_encoder_h.js";
40-
import { gen_ast_encoder_cc } from "./gen_ast_encoder_cc.js";
41-
import { gen_ast_decoder_h } from "./gen_ast_decoder_h.js";
42-
import { gen_ast_decoder_cc } from "./gen_ast_decoder_cc.js";
43-
import { gen_ast_slot_ts } from "./gen_ast_slot_ts.js";
44-
import { gen_token_fwd_h } from "./gen_token_fwd_h.js";
45-
import { gen_tokenkind_ts } from "./gen_tokenkind_ts.js";
46-
import { gen_keywords_kwgen } from "./gen_keywords_kwgen.js";
47-
import { gen_ast_pretty_printer_h } from "./gen_ast_pretty_printer_h.js";
48-
import { gen_ast_pretty_printer_cc } from "./gen_ast_pretty_printer_cc.js";
23+
import { gen_ast_cc } from "./gen_ast_cc.ts";
24+
import { gen_ast_printer_cc } from "./gen_ast_printer_cc.ts";
25+
import { gen_ast_printer_h } from "./gen_ast_printer_h.ts";
26+
import { gen_ast_fwd_h } from "./gen_ast_fwd_h.ts";
27+
import { gen_ast_h } from "./gen_ast_h.ts";
28+
import { gen_ast_kind_h } from "./gen_ast_kind_h.ts";
29+
import { gen_ast_recursive_visitor_ts } from "./gen_ast_recursive_visitor_ts.ts";
30+
import { gen_ast_slot_cc } from "./gen_ast_slot_cc.ts";
31+
import { gen_ast_slot_h } from "./get_ast_slot_h.ts";
32+
import { gen_ast_ts } from "./gen_ast_ts.ts";
33+
import { gen_ast_visitor_h } from "./gen_ast_visitor_h.ts";
34+
import { gen_ast_visitor_cc } from "./gen_ast_visitor_cc.ts";
35+
import { gen_ast_visitor_ts } from "./gen_ast_visitor_ts.ts";
36+
import { parseAST } from "./parseAST.ts";
37+
import { gen_ast_kind_ts } from "./gen_ast_kind_ts.ts";
38+
import { gen_ast_fbs } from "./gen_ast_fbs.ts";
39+
import { gen_ast_encoder_h } from "./gen_ast_encoder_h.ts";
40+
import { gen_ast_encoder_cc } from "./gen_ast_encoder_cc.ts";
41+
import { gen_ast_decoder_h } from "./gen_ast_decoder_h.ts";
42+
import { gen_ast_decoder_cc } from "./gen_ast_decoder_cc.ts";
43+
import { gen_ast_slot_ts } from "./gen_ast_slot_ts.ts";
44+
import { gen_token_fwd_h } from "./gen_token_fwd_h.ts";
45+
import { gen_tokenkind_ts } from "./gen_tokenkind_ts.ts";
46+
import { gen_keywords_kwgen } from "./gen_keywords_kwgen.ts";
47+
import { gen_ast_pretty_printer_h } from "./gen_ast_pretty_printer_h.ts";
48+
import { gen_ast_pretty_printer_cc } from "./gen_ast_pretty_printer_cc.ts";
4949

5050
import * as fs from "fs";
5151
import * as path from "path";

packages/cxx-gen-ast/src/gen_ast_cc.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21-
import { cpy_header } from "./cpy_header.js";
22-
import { groupNodesByBaseType } from "./groupNodesByBaseType.js";
23-
import { AST } from "./parseAST.js";
21+
import { cpy_header } from "./cpy_header.ts";
22+
import { groupNodesByBaseType } from "./groupNodesByBaseType.ts";
23+
import type { AST } from "./parseAST.ts";
2424
import * as fs from "fs";
2525

2626
export function gen_ast_cc({ ast, output }: { ast: AST; output: string }) {

packages/cxx-gen-ast/src/gen_ast_decoder_cc.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21-
import { groupNodesByBaseType } from "./groupNodesByBaseType.js";
22-
import { AST } from "./parseAST.js";
23-
import { cpy_header } from "./cpy_header.js";
21+
import { groupNodesByBaseType } from "./groupNodesByBaseType.ts";
22+
import type { AST } from "./parseAST.ts";
23+
import { cpy_header } from "./cpy_header.ts";
2424
import * as fs from "fs";
2525

2626
export function gen_ast_decoder_cc({

packages/cxx-gen-ast/src/gen_ast_decoder_h.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21-
import { groupNodesByBaseType } from "./groupNodesByBaseType.js";
22-
import { AST } from "./parseAST.js";
23-
import { cpy_header } from "./cpy_header.js";
21+
import { groupNodesByBaseType } from "./groupNodesByBaseType.ts";
22+
import type { AST } from "./parseAST.ts";
23+
import { cpy_header } from "./cpy_header.ts";
2424
import * as fs from "fs";
2525

2626
export function gen_ast_decoder_h({

packages/cxx-gen-ast/src/gen_ast_encoder_cc.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21-
import { groupNodesByBaseType } from "./groupNodesByBaseType.js";
22-
import { AST, Attribute } from "./parseAST.js";
23-
import { cpy_header } from "./cpy_header.js";
21+
import { groupNodesByBaseType } from "./groupNodesByBaseType.ts";
22+
import type { AST, Attribute } from "./parseAST.ts";
23+
import { cpy_header } from "./cpy_header.ts";
2424
import * as fs from "fs";
2525

2626
export function gen_ast_encoder_cc({

packages/cxx-gen-ast/src/gen_ast_encoder_h.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1919
// SOFTWARE.
2020

21-
import { groupNodesByBaseType } from "./groupNodesByBaseType.js";
22-
import { AST } from "./parseAST.js";
23-
import { cpy_header } from "./cpy_header.js";
21+
import { groupNodesByBaseType } from "./groupNodesByBaseType.ts";
22+
import type { AST } from "./parseAST.ts";
23+
import { cpy_header } from "./cpy_header.ts";
2424
import * as fs from "fs";
2525

2626
export function gen_ast_encoder_h({

0 commit comments

Comments
 (0)