Skip to content

Commit

Permalink
Restructuring
Browse files Browse the repository at this point in the history
It starts to look like a real TypeScript project.
  • Loading branch information
mike-lischke committed Oct 14, 2024
1 parent e46e627 commit 2b7197c
Show file tree
Hide file tree
Showing 275 changed files with 188 additions and 11,771 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions tool/src/org/antlr/v4/cli/TestRig.ts → cli/TestRig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions tool/src/org/antlr/v4/Tool.ts → src/Tool.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand All @@ -10,7 +8,7 @@ import { ATNSerializer, CharStream, CommonTokenStream } from "antlr4ng";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
import path, { basename } from "path";

import { ANTLRv4Parser } from "../../../../../src/generated/ANTLRv4Parser.js";
import { ANTLRv4Parser } from "./generated/ANTLRv4Parser.js";

import { UndefChecker } from "./UndefChecker.js";
import { AnalysisPipeline } from "./analysis/AnalysisPipeline.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* can be found in the LICENSE.txt file in the project root.
*/

import { GrammarTreeVisitor } from "../../../../../src/tree-walkers/GrammarTreeVisitor.js";
import { GrammarTreeVisitor } from "./tree-walkers/GrammarTreeVisitor.js";
import type { ErrorManager } from "./tool/ErrorManager.js";
import { ErrorType } from "./tool/ErrorType.js";
import type { ActionAST } from "./tool/ast/ActionAST.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand All @@ -9,9 +7,9 @@
import { CommonToken, IntervalSet, type TokenStream } from "antlr4ng";
import { STGroupFile, type STGroup } from "stringtemplate4ts";

import { CommonTreeNodeStream } from "../../../../../../src/antlr3/tree/CommonTreeNodeStream.js";
import { ANTLRv4Parser } from "../../../../../../src/generated/ANTLRv4Parser.js";
import { LeftRecursiveRuleWalker } from "../../../../../../src/tree-walkers/LeftRecursiveRuleWalker.js";
import { CommonTreeNodeStream } from "../antlr3/tree/CommonTreeNodeStream.js";
import { ANTLRv4Parser } from "../generated/ANTLRv4Parser.js";
import { LeftRecursiveRuleWalker } from "../tree-walkers/LeftRecursiveRuleWalker.js";
import { Tool } from "../Tool.js";
import { CodeGenerator, type SupportedLanguage } from "../codegen/CodeGenerator.js";
import { GrammarASTAdaptor } from "../parse/GrammarASTAdaptor.js";
Expand Down Expand Up @@ -55,7 +53,7 @@ export class LeftRecursiveRuleAnalyzer extends LeftRecursiveRuleWalker {
static readonly #recRuleTemplates = new STGroupFile(LeftRecursiveRuleAnalyzer.#templateGroupFile);

public constructor(ruleAST: GrammarAST, tool: Tool, ruleName: string, language: SupportedLanguage) {
super(new CommonTreeNodeStream(new GrammarASTAdaptor(ruleAST.token!.inputStream!), ruleAST));
super(new CommonTreeNodeStream(new GrammarASTAdaptor(ruleAST.token!.inputStream ?? undefined), ruleAST));
this.tool = tool;
this.ruleName = ruleName;
this.language = language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

import { CharStream, CommonTokenStream, RecognitionException } from "antlr4ng";

import { ANTLRv4Lexer } from "../../../../../../src/generated/ANTLRv4Lexer.js";
import { ANTLRv4Parser } from "../../../../../../src/generated/ANTLRv4Parser.js";
import { Tool } from "../Tool.js";
import type { SupportedLanguage } from "../codegen/CodeGenerator.js";
import { ANTLRv4Lexer } from "../generated/ANTLRv4Lexer.js";
import { ANTLRv4Parser } from "../generated/ANTLRv4Parser.js";
import { GrammarASTAdaptor } from "../parse/GrammarASTAdaptor.js";
import { ScopeParser } from "../parse/ScopeParser.js";
import { ToolANTLRParser } from "../parse/ToolANTLRParser.js";
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/BaseRecognizer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
28 changes: 3 additions & 25 deletions src/antlr3/EarlyExitException.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
/*
[The "BSD license"]
Copyright (c) 2005-2009 Terence Parr
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/

import { RecognitionException, type IntStream } from "antlr4ng";
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/RecognizerSharedState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/misc/FastQueue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/misc/LookaheadStream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/BaseTree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/BaseTreeAdaptor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/CommonErrorNode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/CommonTree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/CommonTreeAdaptor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/CommonTreeNodeStream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/PositionTrackingStream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/Tree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeAdaptor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeIterator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeNodeStream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreePatternLexer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreePatternParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeRewriter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeRuleReturnScope.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeVisitor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeVisitorAction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
2 changes: 0 additions & 2 deletions src/antlr3/tree/TreeWizard.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand All @@ -10,6 +8,7 @@ import {
ATN, ATNState, AtomTransition, BlockEndState, CodePointTransitions, EpsilonTransition, IntervalSet,
NotSetTransition, RangeTransition, SetTransition, Transition
} from "antlr4ng";

import { CharSupport } from "../misc/CharSupport.js";
import { ErrorType } from "../tool/ErrorType.js";
import { Grammar } from "../tool/Grammar.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand All @@ -11,6 +9,7 @@ import {
NotSetTransition, AtomTransition, StarBlockStartState, PlusBlockStartState, BlockStartState, BlockEndState,
RuleStartState, PlusLoopbackState, StarLoopbackState, StarLoopEntryState, ATN, Vocabulary,
} from "antlr4ng";

import { getTokenDisplayName } from "../misc/helpers.js";

/** An ATN walker that knows how to dump them to serialized strings. */
Expand Down Expand Up @@ -78,7 +77,7 @@ export class ATNPrinter {
this.atn.grammarType === 0);
buffer += "-" + label + "->" + this.getStateString(t.target) + "\n";
} else {
buffer += "-" + t.toString() + "->" + this.getStateString(t.target) + "\n";
buffer += "-" + String(t) + "->" + this.getStateString(t.target) + "\n";
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* java2ts: keep */
/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/

export class CharactersDataCheckStatus {
public readonly collision: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* java2ts: keep */

/*
* Copyright (c) The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
Expand Down
Loading

0 comments on commit 2b7197c

Please sign in to comment.