From 096ef99de38b613a5c8c1fb6c9dbc018a8f2daf5 Mon Sep 17 00:00:00 2001 From: Lawrence Zeng Date: Sat, 19 Oct 2024 17:02:08 -0400 Subject: [PATCH] Adding Typescript definition files to export Trees module. Signed-off-by: Lawrence Zeng --- runtime/JavaScript/src/antlr4/tree/Trees.d.ts | 15 +++++++++++++++ runtime/JavaScript/src/antlr4/tree/index.d.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 runtime/JavaScript/src/antlr4/tree/Trees.d.ts diff --git a/runtime/JavaScript/src/antlr4/tree/Trees.d.ts b/runtime/JavaScript/src/antlr4/tree/Trees.d.ts new file mode 100644 index 0000000000..f2d05c9ba5 --- /dev/null +++ b/runtime/JavaScript/src/antlr4/tree/Trees.d.ts @@ -0,0 +1,15 @@ +import { Parser } from "../Parser"; +import { ParseTree } from "./ParseTree"; +import { Tree } from "./Tree"; + +export default Trees; +declare namespace Trees { + function toStringTree(tree: Tree, ruleNames: string[], recog: Parser): string; + function getNodeText(t: Tree, ruleNames: string[], recog: Parser): string; + function getChildren(t: Tree): Tree[]; + function getAncestors(t: Tree): Tree[]; + function findAllTokenNodes(t: ParseTree, ttype: number): ParseTree[]; + function findAllRuleNodes(t: ParseTree, ruleIndex: number): ParseTree[]; + function findAllNodes(t: ParseTree, index: number, findTokens: boolean): ParseTree[]; + function descendants(t: ParseTree): ParseTree[]; +} diff --git a/runtime/JavaScript/src/antlr4/tree/index.d.ts b/runtime/JavaScript/src/antlr4/tree/index.d.ts index 1fde81f536..c3d3d5ad4b 100644 --- a/runtime/JavaScript/src/antlr4/tree/index.d.ts +++ b/runtime/JavaScript/src/antlr4/tree/index.d.ts @@ -5,4 +5,4 @@ export * from './ParseTree'; export * from './ParseTreeListener'; export * from './ParseTreeVisitor'; export * from './ParseTreeWalker'; - +export * as Trees from './Trees';