Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

antlr4-c3

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antlr4-c3 - npm Package Compare versions

Comparing version 3.1.1 to 3.2.0

historical-contributors.txt

40

lib/index.d.ts

@@ -1,20 +0,20 @@

export * from "./src/ArrayType";
export * from "./src/BaseSymbol";
export * from "./src/BlockSymbol";
export * from "./src/ClassSymbol";
export * from "./src/FieldSymbol";
export * from "./src/FundamentalType";
export * from "./src/InterfaceSymbol";
export * from "./src/LiteralSymbol";
export * from "./src/MethodSymbol";
export * from "./src/NamespaceSymbol";
export * from "./src/ParameterSymbol";
export * from "./src/RoutineSymbol";
export * from "./src/ScopedSymbol";
export * from "./src/TypeAlias";
export * from "./src/TypedSymbol";
export * from "./src/VariableSymbol";
export * from "./src/CodeCompletionCore";
export * from "./src/SymbolTable";
export * from "./src/DuplicateSymbolError";
export * from "./src/types";
export * from "./src/ArrayType.js";
export * from "./src/BaseSymbol.js";
export * from "./src/BlockSymbol.js";
export * from "./src/ClassSymbol.js";
export * from "./src/FieldSymbol.js";
export * from "./src/FundamentalType.js";
export * from "./src/InterfaceSymbol.js";
export * from "./src/LiteralSymbol.js";
export * from "./src/MethodSymbol.js";
export * from "./src/NamespaceSymbol.js";
export * from "./src/ParameterSymbol.js";
export * from "./src/RoutineSymbol.js";
export * from "./src/ScopedSymbol.js";
export * from "./src/TypeAlias.js";
export * from "./src/TypedSymbol.js";
export * from "./src/VariableSymbol.js";
export * from "./src/CodeCompletionCore.js";
export * from "./src/SymbolTable.js";
export * from "./src/DuplicateSymbolError.js";
export * from "./src/types.js";

@@ -1,43 +0,25 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2016, 2021 Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./src/ArrayType"), exports);
__exportStar(require("./src/BaseSymbol"), exports);
__exportStar(require("./src/BlockSymbol"), exports);
__exportStar(require("./src/ClassSymbol"), exports);
__exportStar(require("./src/FieldSymbol"), exports);
__exportStar(require("./src/FundamentalType"), exports);
__exportStar(require("./src/InterfaceSymbol"), exports);
__exportStar(require("./src/LiteralSymbol"), exports);
__exportStar(require("./src/MethodSymbol"), exports);
__exportStar(require("./src/NamespaceSymbol"), exports);
__exportStar(require("./src/ParameterSymbol"), exports);
__exportStar(require("./src/RoutineSymbol"), exports);
__exportStar(require("./src/ScopedSymbol"), exports);
__exportStar(require("./src/TypeAlias"), exports);
__exportStar(require("./src/TypedSymbol"), exports);
__exportStar(require("./src/VariableSymbol"), exports);
__exportStar(require("./src/CodeCompletionCore"), exports);
__exportStar(require("./src/SymbolTable"), exports);
__exportStar(require("./src/DuplicateSymbolError"), exports);
__exportStar(require("./src/types"), exports);
export * from "./src/ArrayType.js";
export * from "./src/BaseSymbol.js";
export * from "./src/BlockSymbol.js";
export * from "./src/ClassSymbol.js";
export * from "./src/FieldSymbol.js";
export * from "./src/FundamentalType.js";
export * from "./src/InterfaceSymbol.js";
export * from "./src/LiteralSymbol.js";
export * from "./src/MethodSymbol.js";
export * from "./src/NamespaceSymbol.js";
export * from "./src/ParameterSymbol.js";
export * from "./src/RoutineSymbol.js";
export * from "./src/ScopedSymbol.js";
export * from "./src/TypeAlias.js";
export * from "./src/TypedSymbol.js";
export * from "./src/VariableSymbol.js";
export * from "./src/CodeCompletionCore.js";
export * from "./src/SymbolTable.js";
export * from "./src/DuplicateSymbolError.js";
export * from "./src/types.js";
//# sourceMappingURL=index.js.map

@@ -1,11 +0,11 @@

import { Type, ReferenceKind, TypeKind } from "./types";
import { BaseSymbol } from "./BaseSymbol";
export declare class ArrayType extends BaseSymbol implements Type {
readonly elementType: Type;
import { IType, ReferenceKind, TypeKind } from "./types.js";
import { BaseSymbol } from "./BaseSymbol.js";
export declare class ArrayType extends BaseSymbol implements IType {
readonly elementType: IType;
readonly size: number;
private referenceKind;
constructor(name: string, referenceKind: ReferenceKind, elemType: Type, size?: number);
get baseTypes(): Type[];
constructor(name: string, referenceKind: ReferenceKind, elemType: IType, size?: number);
get baseTypes(): IType[];
get kind(): TypeKind;
get reference(): ReferenceKind;
}

@@ -1,13 +0,8 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ArrayType = void 0;
const types_1 = require("./types");
const BaseSymbol_1 = require("./BaseSymbol");
class ArrayType extends BaseSymbol_1.BaseSymbol {
import { TypeKind } from "./types.js";
import { BaseSymbol } from "./BaseSymbol.js";
export class ArrayType extends BaseSymbol {
elementType;

@@ -23,6 +18,5 @@ size; // > 0 if fixed length.

get baseTypes() { return []; }
get kind() { return types_1.TypeKind.Array; }
get kind() { return TypeKind.Array; }
get reference() { return this.referenceKind; }
}
exports.ArrayType = ArrayType;
//# sourceMappingURL=ArrayType.js.map

@@ -1,5 +0,5 @@

import { ParseTree } from "antlr4ts/tree/ParseTree";
import { MemberVisibility, Modifier, SymbolConstructor } from "./types";
import { type IScopedSymbol } from "./ScopedSymbol";
import { type ISymbolTable } from "./SymbolTable";
import { ParseTree } from "antlr4ng";
import { type IScopedSymbol } from "./ScopedSymbol.js";
import { type ISymbolTable } from "./SymbolTable.js";
import { MemberVisibility, Modifier } from "./types.js";
/**

@@ -105,1 +105,3 @@ * The root of the symbol table class hierarchy: a symbol can be any manageable entity (like a block), not only

}
/** The type of constructors for symbols. Used mostly for factory and lookup functions. */
export type SymbolConstructor<T extends BaseSymbol, Args extends unknown[]> = new (...args: Args) => T;

@@ -1,11 +0,6 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseSymbol = void 0;
const types_1 = require("./types");
import { MemberVisibility } from "./types.js";
/**

@@ -17,3 +12,3 @@ * The root of the symbol table class hierarchy: a symbol can be any manageable entity (like a block), not only

*/
class BaseSymbol {
export class BaseSymbol {
/** The name of the symbol or empty if anonymous. */

@@ -24,3 +19,3 @@ name;

modifiers = new Set();
visibility = types_1.MemberVisibility.Unknown;
visibility = MemberVisibility.Unknown;
#parent;

@@ -205,3 +200,2 @@ constructor(name = "") {

}
exports.BaseSymbol = BaseSymbol;
//# sourceMappingURL=BaseSymbol.js.map

@@ -1,3 +0,3 @@

import { ScopedSymbol } from "./ScopedSymbol";
import { ScopedSymbol } from "./ScopedSymbol.js";
export declare class BlockSymbol extends ScopedSymbol {
}

@@ -1,14 +0,8 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockSymbol = void 0;
const ScopedSymbol_1 = require("./ScopedSymbol");
class BlockSymbol extends ScopedSymbol_1.ScopedSymbol {
import { ScopedSymbol } from "./ScopedSymbol.js";
export class BlockSymbol extends ScopedSymbol {
}
exports.BlockSymbol = BlockSymbol;
//# sourceMappingURL=BlockSymbol.js.map

@@ -1,8 +0,8 @@

import { Type, ReferenceKind, TypeKind } from "./types";
import { FieldSymbol } from "./FieldSymbol";
import { InterfaceSymbol } from "./InterfaceSymbol";
import { MethodSymbol } from "./MethodSymbol";
import { ScopedSymbol } from "./ScopedSymbol";
import { IType, ReferenceKind, TypeKind } from "./types.js";
import { FieldSymbol } from "./FieldSymbol.js";
import { InterfaceSymbol } from "./InterfaceSymbol.js";
import { MethodSymbol } from "./MethodSymbol.js";
import { ScopedSymbol } from "./ScopedSymbol.js";
/** Classes and structs. */
export declare class ClassSymbol extends ScopedSymbol implements Type {
export declare class ClassSymbol extends ScopedSymbol implements IType {
isStruct: boolean;

@@ -15,3 +15,3 @@ reference: ReferenceKind;

constructor(name: string, ext: ClassSymbol[], impl: Array<ClassSymbol | InterfaceSymbol>);
get baseTypes(): Type[];
get baseTypes(): IType[];
get kind(): TypeKind;

@@ -18,0 +18,0 @@ /**

@@ -1,18 +0,13 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassSymbol = void 0;
const types_1 = require("./types");
const FieldSymbol_1 = require("./FieldSymbol");
const MethodSymbol_1 = require("./MethodSymbol");
const ScopedSymbol_1 = require("./ScopedSymbol");
import { ReferenceKind, TypeKind } from "./types.js";
import { FieldSymbol } from "./FieldSymbol.js";
import { MethodSymbol } from "./MethodSymbol.js";
import { ScopedSymbol } from "./ScopedSymbol.js";
/** Classes and structs. */
class ClassSymbol extends ScopedSymbol_1.ScopedSymbol {
export class ClassSymbol extends ScopedSymbol {
isStruct = false;
reference = types_1.ReferenceKind.Irrelevant;
reference = ReferenceKind.Irrelevant;
/** Usually only one member, unless the language supports multiple inheritance (like C++). */

@@ -30,3 +25,3 @@ // eslint-disable-next-line no-use-before-define

get baseTypes() { return this.extends; }
get kind() { return types_1.TypeKind.Class; }
get kind() { return TypeKind.Class; }
/**

@@ -38,3 +33,3 @@ * @param includeInherited Not used.

getMethods(includeInherited = false) {
return this.getSymbolsOfType(MethodSymbol_1.MethodSymbol);
return this.getSymbolsOfType(MethodSymbol);
}

@@ -47,6 +42,5 @@ /**

getFields(includeInherited = false) {
return this.getSymbolsOfType(FieldSymbol_1.FieldSymbol);
return this.getSymbolsOfType(FieldSymbol);
}
}
exports.ClassSymbol = ClassSymbol;
//# sourceMappingURL=ClassSymbol.js.map

@@ -1,2 +0,2 @@

import { Parser, ParserRuleContext } from "antlr4ts";
import { Parser, ParserRuleContext } from "antlr4ng";
export type TokenList = number[];

@@ -3,0 +3,0 @@ export type RuleList = number[];

@@ -1,15 +0,8 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2016, 2021, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CodeCompletionCore = exports.CandidatesCollection = void 0;
/* eslint-disable max-classes-per-file */
const antlr4ts_1 = require("antlr4ts");
const atn_1 = require("antlr4ts/atn");
const IntervalSet_1 = require("antlr4ts/misc/IntervalSet");
const utils_1 = require("./utils");
import { ATNState, IntervalSet, ParserRuleContext, Token, Transition, } from "antlr4ng";
import { longestCommonPrefix } from "./utils.js";
/**

@@ -22,7 +15,6 @@ * All the candidates which have been found. Tokens and rules are separated.

*/
class CandidatesCollection {
export class CandidatesCollection {
tokens = new Map();
rules = new Map();
}
exports.CandidatesCollection = CandidatesCollection;
/**

@@ -52,3 +44,3 @@ * A record for a follow set along with the path at which this set was found.

/** The main class for doing the collection process. */
class CodeCompletionCore {
export class CodeCompletionCore {
static followSetsByATN = new Map();

@@ -112,3 +104,3 @@ static atnStateTypeMap = [

this.atn = parser.atn;
this.vocabulary = parser.vocabulary;
this.vocabulary = parser.getVocabulary();
this.ruleNames = parser.ruleNames;

@@ -135,4 +127,5 @@ this.ignoredTokens = new Set();

this.precedenceStack = [];
this.tokenStartIndex = context ? context.start.tokenIndex : 0;
const tokenStream = this.parser.inputStream;
this.tokenStartIndex = context?.start ? context.start.tokenIndex : 0;
// eslint-disable-next-line no-underscore-dangle
const tokenStream = this.parser._input;
this.tokens = [];

@@ -142,5 +135,5 @@ let offset = this.tokenStartIndex;

const token = tokenStream.get(offset++);
if (token.channel === antlr4ts_1.Token.DEFAULT_CHANNEL) {
if (token.channel === Token.DEFAULT_CHANNEL) {
this.tokens.push(token);
if (token.tokenIndex >= caretTokenIndex || token.type === antlr4ts_1.Token.EOF) {
if (token.tokenIndex >= caretTokenIndex || token.type === Token.EOF) {
break;

@@ -151,3 +144,3 @@ }

// the caret.
if (token.type === antlr4ts_1.Token.EOF) {
if (token.type === Token.EOF) {
break;

@@ -171,3 +164,3 @@ }

for (const token of this.candidates.tokens) {
let value = this.vocabulary.getDisplayName(token[0]);
let value = this.vocabulary.getDisplayName(token[0]) ?? "";
for (const following of token[1]) {

@@ -193,3 +186,3 @@ value += " " + this.vocabulary.getDisplayName(following);

checkPredicate(transition) {
return transition.predicate.eval(this.parser, antlr4ts_1.ParserRuleContext.emptyContext());
return transition.getPredicate().evaluate(this.parser, ParserRuleContext.EMPTY);
}

@@ -279,4 +272,4 @@ /**

if (state) {
state.getTransitions().forEach((outgoing) => {
if (outgoing.serializationType === 5 /* TransitionType.ATOM */) {
state.transitions.forEach((outgoing) => {
if (outgoing.serializationType === Transition.ATOM) {
if (!outgoing.isEpsilon) {

@@ -312,5 +305,5 @@ const list = outgoing.label.toArray();

// it is also useful to have a set with all symbols combined.
const combined = new IntervalSet_1.IntervalSet();
const combined = new IntervalSet();
for (const set of sets) {
combined.addAll(set.intervals);
combined.addSet(set.intervals);
}

@@ -336,3 +329,3 @@ return { sets, isExhaustive, combined };

stateStack.push(s);
if (s === stopState || s.stateType === atn_1.ATNStateType.RULE_STOP) {
if (s === stopState || s.stateType === ATNState.RULE_STOP) {
stateStack.pop();

@@ -342,4 +335,4 @@ return false;

let isExhaustive = true;
for (const transition of s.getTransitions()) {
if (transition.serializationType === 3 /* TransitionType.RULE */) {
for (const transition of s.transitions) {
if (transition.serializationType === Transition.RULE) {
const ruleTransition = transition;

@@ -359,3 +352,3 @@ if (ruleStack.indexOf(ruleTransition.target.ruleIndex) !== -1) {

}
else if (transition.serializationType === 4 /* TransitionType.PREDICATE */) {
else if (transition.serializationType === Transition.PREDICATE) {
if (this.checkPredicate(transition)) {

@@ -370,5 +363,5 @@ const nextStateFollowSetsIsExhaustive = this.collectFollowSets(transition.target, stopState, followSets, stateStack, ruleStack);

}
else if (transition.serializationType === 9 /* TransitionType.WILDCARD */) {
else if (transition.serializationType === Transition.WILDCARD) {
const set = new FollowSetWithPath();
set.intervals = IntervalSet_1.IntervalSet.of(antlr4ts_1.Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
set.intervals = IntervalSet.of(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
set.path = ruleStack.slice();

@@ -379,8 +372,8 @@ followSets.push(set);

let label = transition.label;
if (label && label.size > 0) {
if (transition.serializationType === 8 /* TransitionType.NOT_SET */) {
label = label.complement(IntervalSet_1.IntervalSet.of(antlr4ts_1.Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType));
if (label && label.length > 0) {
if (transition.serializationType === Transition.NOT_SET) {
label = label.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
}
const set = new FollowSetWithPath();
set.intervals = label;
set.intervals = label ?? new IntervalSet();
set.path = ruleStack.slice();

@@ -526,3 +519,3 @@ set.following = this.getFollowingTokens(transition);

}
if (currentEntry.state.stateType === atn_1.ATNStateType.RULE_STOP) {
if (currentEntry.state.stateType === ATNState.RULE_STOP) {
// Record the token index we are at, to report it to the caller.

@@ -532,3 +525,3 @@ result.add(currentEntry.tokenListIndex);

}
const transitions = currentEntry.state.getTransitions();
const transitions = currentEntry.state.transitions;
// We simulate here the same precedence handling as the parser does, which uses hard coded values.

@@ -538,3 +531,3 @@ // For rules that are not left recursive this value is ignored (since there is no precedence transition).

switch (transition.serializationType) {
case 3 /* TransitionType.RULE */: {
case Transition.RULE: {
const ruleTransition = transition;

@@ -550,3 +543,3 @@ const endStatus = this.processRule(transition.target, currentEntry.tokenListIndex, callStack, ruleTransition.precedence, indentation + 1);

}
case 4 /* TransitionType.PREDICATE */: {
case Transition.PREDICATE: {
if (this.checkPredicate(transition)) {

@@ -560,3 +553,3 @@ statePipeline.push({

}
case 10 /* TransitionType.PRECEDENCE */: {
case Transition.PRECEDENCE: {
const predTransition = transition;

@@ -571,6 +564,6 @@ if (predTransition.precedence >= this.precedenceStack[this.precedenceStack.length - 1]) {

}
case 9 /* TransitionType.WILDCARD */: {
case Transition.WILDCARD: {
if (atCaret) {
if (!this.translateStackToRuleIndex(callStack)) {
for (const token of IntervalSet_1.IntervalSet.of(antlr4ts_1.Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType)
for (const token of IntervalSet.of(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType)
.toArray()) {

@@ -601,5 +594,5 @@ if (!this.ignoredTokens.has(token)) {

let set = transition.label;
if (set && set.size > 0) {
if (transition.serializationType === 8 /* TransitionType.NOT_SET */) {
set = set.complement(IntervalSet_1.IntervalSet.of(antlr4ts_1.Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType));
if (set && set.length > 0) {
if (transition.serializationType === Transition.NOT_SET) {
set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
}

@@ -622,3 +615,3 @@ if (atCaret) {

else {
this.candidates.tokens.set(symbol, (0, utils_1.longestCommonPrefix)(followingTokens, this.candidates.tokens.get(symbol)));
this.candidates.tokens.set(symbol, longestCommonPrefix(followingTokens, this.candidates.tokens.get(symbol)));
}

@@ -654,3 +647,3 @@ }

generateBaseDescription(state) {
const stateValue = state.stateNumber === atn_1.ATNState.INVALID_STATE_NUMBER ? "Invalid" : state.stateNumber;
const stateValue = state.stateNumber === ATNState.INVALID_STATE_NUMBER ? "Invalid" : state.stateNumber;
return `[${stateValue} ${CodeCompletionCore.atnStateTypeMap[state.stateType]}] in ` +

@@ -664,3 +657,3 @@ `${this.ruleNames[state.ruleIndex]}`;

if (this.debugOutputWithTransitions) {
for (const transition of state.getTransitions()) {
for (const transition of state.transitions) {
let labels = "";

@@ -707,3 +700,2 @@ const symbols = transition.label ? transition.label.toArray() : [];

}
exports.CodeCompletionCore = CodeCompletionCore;
//# sourceMappingURL=CodeCompletionCore.js.map

@@ -1,13 +0,7 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DuplicateSymbolError = void 0;
class DuplicateSymbolError extends Error {
export class DuplicateSymbolError extends Error {
}
exports.DuplicateSymbolError = DuplicateSymbolError;
//# sourceMappingURL=DuplicateSymbolError.js.map

@@ -1,3 +0,3 @@

import { MethodSymbol } from "./MethodSymbol";
import { VariableSymbol } from "./VariableSymbol";
import { MethodSymbol } from "./MethodSymbol.js";
import { VariableSymbol } from "./VariableSymbol.js";
/** A field which belongs to a class or other outer container structure. */

@@ -4,0 +4,0 @@ export declare class FieldSymbol extends VariableSymbol {

@@ -1,17 +0,11 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldSymbol = void 0;
const VariableSymbol_1 = require("./VariableSymbol");
import { VariableSymbol } from "./VariableSymbol.js";
/** A field which belongs to a class or other outer container structure. */
class FieldSymbol extends VariableSymbol_1.VariableSymbol {
export class FieldSymbol extends VariableSymbol {
setter;
getter;
}
exports.FieldSymbol = FieldSymbol;
//# sourceMappingURL=FieldSymbol.js.map

@@ -1,4 +0,4 @@

import { Type, TypeKind, ReferenceKind } from "./types";
import { IType, TypeKind, ReferenceKind } from "./types.js";
/** A single class for all fundamental types. They are distinguished via the kind field. */
export declare class FundamentalType implements Type {
export declare class FundamentalType implements IType {
static readonly integerType: FundamentalType;

@@ -12,5 +12,5 @@ static readonly floatType: FundamentalType;

constructor(name: string, typeKind?: TypeKind, referenceKind?: ReferenceKind);
get baseTypes(): Type[];
get baseTypes(): IType[];
get kind(): TypeKind;
get reference(): ReferenceKind;
}

@@ -1,21 +0,16 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.FundamentalType = void 0;
const types_1 = require("./types");
import { TypeKind, ReferenceKind } from "./types.js";
/** A single class for all fundamental types. They are distinguished via the kind field. */
class FundamentalType {
static integerType = new FundamentalType("int", types_1.TypeKind.Integer, types_1.ReferenceKind.Instance);
static floatType = new FundamentalType("float", types_1.TypeKind.Float, types_1.ReferenceKind.Instance);
static stringType = new FundamentalType("string", types_1.TypeKind.String, types_1.ReferenceKind.Instance);
static boolType = new FundamentalType("bool", types_1.TypeKind.Boolean, types_1.ReferenceKind.Instance);
export class FundamentalType {
static integerType = new FundamentalType("int", TypeKind.Integer, ReferenceKind.Instance);
static floatType = new FundamentalType("float", TypeKind.Float, ReferenceKind.Instance);
static stringType = new FundamentalType("string", TypeKind.String, ReferenceKind.Instance);
static boolType = new FundamentalType("bool", TypeKind.Boolean, ReferenceKind.Instance);
name;
typeKind;
referenceKind;
constructor(name, typeKind = types_1.TypeKind.Unknown, referenceKind = types_1.ReferenceKind.Irrelevant) {
constructor(name, typeKind = TypeKind.Unknown, referenceKind = ReferenceKind.Irrelevant) {
this.name = name;

@@ -35,3 +30,2 @@ this.typeKind = typeKind;

}
exports.FundamentalType = FundamentalType;
//# sourceMappingURL=FundamentalType.js.map

@@ -1,7 +0,7 @@

import { Type, ReferenceKind, TypeKind } from "./types";
import { ClassSymbol } from "./ClassSymbol";
import { FieldSymbol } from "./FieldSymbol";
import { MethodSymbol } from "./MethodSymbol";
import { ScopedSymbol } from "./ScopedSymbol";
export declare class InterfaceSymbol extends ScopedSymbol implements Type {
import { IType, ReferenceKind, TypeKind } from "./types.js";
import { ClassSymbol } from "./ClassSymbol.js";
import { FieldSymbol } from "./FieldSymbol.js";
import { MethodSymbol } from "./MethodSymbol.js";
import { ScopedSymbol } from "./ScopedSymbol.js";
export declare class InterfaceSymbol extends ScopedSymbol implements IType {
reference: ReferenceKind;

@@ -11,16 +11,16 @@ /** Typescript allows an interface to extend a class, not only interfaces. */

constructor(name: string, ext: Array<ClassSymbol | InterfaceSymbol>);
get baseTypes(): Type[];
get baseTypes(): IType[];
get kind(): TypeKind;
/**
* @param includeInherited Not used.
* @param _includeInherited not used
*
* @returns a list of all methods.
*/
getMethods(includeInherited?: boolean): Promise<MethodSymbol[]>;
getMethods(_includeInherited?: boolean): Promise<MethodSymbol[]>;
/**
* @param includeInherited Not used.
* @param _includeInherited Not used.
*
* @returns all fields.
*/
getFields(includeInherited?: boolean): Promise<FieldSymbol[]>;
getFields(_includeInherited?: boolean): Promise<FieldSymbol[]>;
}

@@ -1,16 +0,11 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.InterfaceSymbol = void 0;
const types_1 = require("./types");
const FieldSymbol_1 = require("./FieldSymbol");
const MethodSymbol_1 = require("./MethodSymbol");
const ScopedSymbol_1 = require("./ScopedSymbol");
class InterfaceSymbol extends ScopedSymbol_1.ScopedSymbol {
reference = types_1.ReferenceKind.Irrelevant;
import { ReferenceKind, TypeKind } from "./types.js";
import { FieldSymbol } from "./FieldSymbol.js";
import { MethodSymbol } from "./MethodSymbol.js";
import { ScopedSymbol } from "./ScopedSymbol.js";
export class InterfaceSymbol extends ScopedSymbol {
reference = ReferenceKind.Irrelevant;
/** Typescript allows an interface to extend a class, not only interfaces. */

@@ -24,21 +19,20 @@ // eslint-disable-next-line no-use-before-define

get baseTypes() { return this.extends; }
get kind() { return types_1.TypeKind.Interface; }
get kind() { return TypeKind.Interface; }
/**
* @param includeInherited Not used.
* @param _includeInherited not used
*
* @returns a list of all methods.
*/
getMethods(includeInherited = false) {
return this.getSymbolsOfType(MethodSymbol_1.MethodSymbol);
getMethods(_includeInherited = false) {
return this.getSymbolsOfType(MethodSymbol);
}
/**
* @param includeInherited Not used.
* @param _includeInherited Not used.
*
* @returns all fields.
*/
getFields(includeInherited = false) {
return this.getSymbolsOfType(FieldSymbol_1.FieldSymbol);
getFields(_includeInherited = false) {
return this.getSymbolsOfType(FieldSymbol);
}
}
exports.InterfaceSymbol = InterfaceSymbol;
//# sourceMappingURL=InterfaceSymbol.js.map

@@ -1,6 +0,6 @@

import { TypedSymbol } from "./TypedSymbol";
import { Type } from "./types";
import { TypedSymbol } from "./TypedSymbol.js";
import { IType } from "./types.js";
export declare class LiteralSymbol extends TypedSymbol {
readonly value: unknown;
constructor(name: string, value: unknown, type?: Type);
constructor(name: string, value: unknown, type?: IType);
}

@@ -1,12 +0,7 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiteralSymbol = void 0;
const TypedSymbol_1 = require("./TypedSymbol");
class LiteralSymbol extends TypedSymbol_1.TypedSymbol {
import { TypedSymbol } from "./TypedSymbol.js";
export class LiteralSymbol extends TypedSymbol {
value;

@@ -18,3 +13,2 @@ constructor(name, value, type) {

}
exports.LiteralSymbol = LiteralSymbol;
//# sourceMappingURL=LiteralSymbol.js.map

@@ -1,2 +0,2 @@

import { RoutineSymbol } from "./RoutineSymbol";
import { RoutineSymbol } from "./RoutineSymbol.js";
export declare enum MethodFlags {

@@ -3,0 +3,0 @@ None = 0,

@@ -1,12 +0,7 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodSymbol = exports.MethodFlags = void 0;
const RoutineSymbol_1 = require("./RoutineSymbol");
var MethodFlags;
import { RoutineSymbol } from "./RoutineSymbol.js";
export var MethodFlags;
(function (MethodFlags) {

@@ -21,8 +16,7 @@ MethodFlags[MethodFlags["None"] = 0] = "None";

MethodFlags[MethodFlags["Explicit"] = 16] = "Explicit";
})(MethodFlags || (exports.MethodFlags = MethodFlags = {}));
})(MethodFlags || (MethodFlags = {}));
/** A function which belongs to a class or other outer container structure. */
class MethodSymbol extends RoutineSymbol_1.RoutineSymbol {
export class MethodSymbol extends RoutineSymbol {
methodFlags = MethodFlags.None;
}
exports.MethodSymbol = MethodSymbol;
//# sourceMappingURL=MethodSymbol.js.map

@@ -1,2 +0,2 @@

import { IScopedSymbol, ScopedSymbol } from "./ScopedSymbol";
import { IScopedSymbol, ScopedSymbol } from "./ScopedSymbol.js";
export interface INamespaceSymbol extends IScopedSymbol {

@@ -3,0 +3,0 @@ readonly inline: boolean;

@@ -1,12 +0,7 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.NamespaceSymbol = void 0;
const ScopedSymbol_1 = require("./ScopedSymbol");
class NamespaceSymbol extends ScopedSymbol_1.ScopedSymbol {
import { ScopedSymbol } from "./ScopedSymbol.js";
export class NamespaceSymbol extends ScopedSymbol {
inline;

@@ -20,3 +15,2 @@ attributes;

}
exports.NamespaceSymbol = NamespaceSymbol;
//# sourceMappingURL=NamespaceSymbol.js.map

@@ -1,3 +0,3 @@

import { VariableSymbol } from "./VariableSymbol";
import { VariableSymbol } from "./VariableSymbol.js";
export declare class ParameterSymbol extends VariableSymbol {
}

@@ -1,14 +0,8 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParameterSymbol = void 0;
const VariableSymbol_1 = require("./VariableSymbol");
class ParameterSymbol extends VariableSymbol_1.VariableSymbol {
import { VariableSymbol } from "./VariableSymbol.js";
export class ParameterSymbol extends VariableSymbol {
}
exports.ParameterSymbol = ParameterSymbol;
//# sourceMappingURL=ParameterSymbol.js.map

@@ -1,11 +0,11 @@

import { ParameterSymbol } from "./ParameterSymbol";
import { ScopedSymbol } from "./ScopedSymbol";
import { VariableSymbol } from "./VariableSymbol";
import { Type } from "./types";
import { ParameterSymbol } from "./ParameterSymbol.js";
import { ScopedSymbol } from "./ScopedSymbol.js";
import { VariableSymbol } from "./VariableSymbol.js";
import { IType } from "./types.js";
/** A standalone function/procedure/rule. */
export declare class RoutineSymbol extends ScopedSymbol {
returnType?: Type;
constructor(name: string, returnType?: Type);
getVariables(localOnly?: boolean): Promise<VariableSymbol[]>;
getParameters(localOnly?: boolean): Promise<ParameterSymbol[]>;
returnType?: IType;
constructor(name: string, returnType?: IType);
getVariables(_localOnly?: boolean): Promise<VariableSymbol[]>;
getParameters(_localOnly?: boolean): Promise<ParameterSymbol[]>;
}

@@ -1,15 +0,10 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.RoutineSymbol = void 0;
const ParameterSymbol_1 = require("./ParameterSymbol");
const ScopedSymbol_1 = require("./ScopedSymbol");
const VariableSymbol_1 = require("./VariableSymbol");
import { ParameterSymbol } from "./ParameterSymbol.js";
import { ScopedSymbol } from "./ScopedSymbol.js";
import { VariableSymbol } from "./VariableSymbol.js";
/** A standalone function/procedure/rule. */
class RoutineSymbol extends ScopedSymbol_1.ScopedSymbol {
export class RoutineSymbol extends ScopedSymbol {
returnType; // Can be null if result is void.

@@ -20,10 +15,9 @@ constructor(name, returnType) {

}
getVariables(localOnly = true) {
return this.getSymbolsOfType(VariableSymbol_1.VariableSymbol);
getVariables(_localOnly = true) {
return this.getSymbolsOfType(VariableSymbol);
}
getParameters(localOnly = true) {
return this.getSymbolsOfType(ParameterSymbol_1.ParameterSymbol);
getParameters(_localOnly = true) {
return this.getSymbolsOfType(ParameterSymbol);
}
}
exports.RoutineSymbol = RoutineSymbol;
//# sourceMappingURL=RoutineSymbol.js.map

@@ -1,3 +0,2 @@

import { SymbolConstructor } from "./types";
import { BaseSymbol } from "./BaseSymbol";
import { SymbolConstructor, BaseSymbol } from "./BaseSymbol.js";
/** Defines the */

@@ -4,0 +3,0 @@ export interface IScopedSymbol extends BaseSymbol {

@@ -1,14 +0,9 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScopedSymbol = void 0;
const BaseSymbol_1 = require("./BaseSymbol");
const DuplicateSymbolError_1 = require("./DuplicateSymbolError");
import { BaseSymbol } from "./BaseSymbol.js";
import { DuplicateSymbolError } from "./DuplicateSymbolError.js";
/** A symbol with a scope (so it can have child symbols). */
class ScopedSymbol extends BaseSymbol_1.BaseSymbol {
export class ScopedSymbol extends BaseSymbol {
/** All child symbols in definition order. */

@@ -59,3 +54,3 @@ #children = [];

if (count !== undefined) {
throw new DuplicateSymbolError_1.DuplicateSymbolError("Attempt to add duplicate symbol '" + (symbol.name ?? "<anonymous>") +
throw new DuplicateSymbolError("Attempt to add duplicate symbol '" + (symbol.name ?? "<anonymous>") +
"'");

@@ -68,3 +63,3 @@ }

if (index > -1) {
throw new DuplicateSymbolError_1.DuplicateSymbolError("Attempt to add duplicate symbol '" + (symbol.name ?? "<anonymous>") +
throw new DuplicateSymbolError("Attempt to add duplicate symbol '" + (symbol.name ?? "<anonymous>") +
"'");

@@ -264,3 +259,3 @@ }

async resolve(name, localOnly = false) {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
for (const child of this.#children) {

@@ -338,3 +333,3 @@ if (child.name === name) {

indexOfChild(child) {
return this.#children.findIndex((value, index) => { return value === child; });
return this.#children.findIndex((value) => { return value === child; });
}

@@ -391,3 +386,2 @@ /**

}
exports.ScopedSymbol = ScopedSymbol;
//# sourceMappingURL=ScopedSymbol.js.map

@@ -1,8 +0,8 @@

import { SymbolTableOptions, SymbolConstructor } from "./types";
import { BaseSymbol } from "./BaseSymbol";
import { ParseTree } from "antlr4ts/tree/ParseTree";
import { IScopedSymbol, ScopedSymbol } from "./ScopedSymbol";
import { NamespaceSymbol } from "./NamespaceSymbol";
import { ParseTree } from "antlr4ng";
import { ISymbolTableOptions } from "./types.js";
import { SymbolConstructor, BaseSymbol } from "./BaseSymbol.js";
import { IScopedSymbol, ScopedSymbol } from "./ScopedSymbol.js";
import { NamespaceSymbol } from "./NamespaceSymbol.js";
export interface ISymbolTable extends IScopedSymbol {
options: SymbolTableOptions;
options: ISymbolTableOptions;
/**

@@ -100,6 +100,6 @@ * @returns instance information, mostly relevant for unit testing.

export declare class SymbolTable extends ScopedSymbol implements ISymbolTable {
readonly options: SymbolTableOptions;
readonly options: ISymbolTableOptions;
/** Other symbol information available to this instance. */
protected dependencies: Set<SymbolTable>;
constructor(name: string, options: SymbolTableOptions);
constructor(name: string, options: ISymbolTableOptions);
get info(): {

@@ -106,0 +106,0 @@ dependencyCount: number;

@@ -1,15 +0,10 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2017, 2021, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SymbolTable = void 0;
const BaseSymbol_1 = require("./BaseSymbol");
const ScopedSymbol_1 = require("./ScopedSymbol");
const NamespaceSymbol_1 = require("./NamespaceSymbol");
import { BaseSymbol } from "./BaseSymbol.js";
import { ScopedSymbol } from "./ScopedSymbol.js";
import { NamespaceSymbol } from "./NamespaceSymbol.js";
/** The main class managing all the symbols for a top level entity like a file, library or similar. */
class SymbolTable extends ScopedSymbol_1.ScopedSymbol {
export class SymbolTable extends ScopedSymbol {
options;

@@ -33,3 +28,3 @@ /** Other symbol information available to this instance. */

addDependencies(...tables) {
tables.forEach((value, key) => {
tables.forEach((value) => {
this.dependencies.add(value);

@@ -60,3 +55,3 @@ });

if (namespace === undefined) {
namespace = this.addNewSymbolOfType(NamespaceSymbol_1.NamespaceSymbol, currentParent, parts[i]);
namespace = this.addNewSymbolOfType(NamespaceSymbol, currentParent, parts[i]);
}

@@ -66,3 +61,3 @@ currentParent = namespace;

}
return this.addNewSymbolOfType(NamespaceSymbol_1.NamespaceSymbol, currentParent, parts[parts.length - 1]);
return this.addNewSymbolOfType(NamespaceSymbol, currentParent, parts[parts.length - 1]);
}

@@ -76,3 +71,3 @@ addNewNamespaceFromPathSync(parent, path, delimiter = ".") {

if (namespace === undefined) {
namespace = this.addNewSymbolOfType(NamespaceSymbol_1.NamespaceSymbol, currentParent, parts[i]);
namespace = this.addNewSymbolOfType(NamespaceSymbol, currentParent, parts[i]);
}

@@ -82,3 +77,3 @@ currentParent = namespace;

}
return this.addNewSymbolOfType(NamespaceSymbol_1.NamespaceSymbol, currentParent, parts[parts.length - 1]);
return this.addNewSymbolOfType(NamespaceSymbol, currentParent, parts[parts.length - 1]);
}

@@ -118,3 +113,3 @@ async getAllSymbols(t, localOnly = false) {

}
if (symbol instanceof ScopedSymbol_1.ScopedSymbol) {
if (symbol instanceof ScopedSymbol) {
for (const child of symbol.children) {

@@ -129,3 +124,3 @@ const result = findRecursive(child);

};
let symbols = await this.getAllSymbols(BaseSymbol_1.BaseSymbol);
let symbols = await this.getAllSymbols(BaseSymbol);
for (const symbol of symbols) {

@@ -138,3 +133,3 @@ const result = findRecursive(symbol);

for (const dependency of this.dependencies) {
symbols = await dependency.getAllSymbols(BaseSymbol_1.BaseSymbol);
symbols = await dependency.getAllSymbols(BaseSymbol);
for (const symbol of symbols) {

@@ -161,3 +156,3 @@ const result = findRecursive(symbol);

}
if (symbol instanceof ScopedSymbol_1.ScopedSymbol) {
if (symbol instanceof ScopedSymbol) {
for (const child of symbol.children) {

@@ -172,3 +167,3 @@ const result = findRecursive(child);

};
let symbols = this.getAllSymbolsSync(BaseSymbol_1.BaseSymbol);
let symbols = this.getAllSymbolsSync(BaseSymbol);
for (const symbol of symbols) {

@@ -181,3 +176,3 @@ const result = findRecursive(symbol);

for (const dependency of this.dependencies) {
symbols = dependency.getAllSymbolsSync(BaseSymbol_1.BaseSymbol);
symbols = dependency.getAllSymbolsSync(BaseSymbol);
for (const symbol of symbols) {

@@ -217,3 +212,2 @@ const result = findRecursive(symbol);

}
exports.SymbolTable = SymbolTable;
//# sourceMappingURL=SymbolTable.js.map

@@ -1,10 +0,10 @@

import { ReferenceKind, Type, TypeKind } from "./types";
import { BaseSymbol } from "./BaseSymbol";
import { ReferenceKind, IType, TypeKind } from "./types.js";
import { BaseSymbol } from "./BaseSymbol.js";
/** An alias for another type. */
export declare class TypeAlias extends BaseSymbol implements Type {
export declare class TypeAlias extends BaseSymbol implements IType {
private targetType;
constructor(name: string, target: Type);
get baseTypes(): Type[];
constructor(name: string, target: IType);
get baseTypes(): IType[];
get kind(): TypeKind;
get reference(): ReferenceKind;
}

@@ -1,14 +0,9 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeAlias = void 0;
const types_1 = require("./types");
const BaseSymbol_1 = require("./BaseSymbol");
import { ReferenceKind, TypeKind } from "./types.js";
import { BaseSymbol } from "./BaseSymbol.js";
/** An alias for another type. */
class TypeAlias extends BaseSymbol_1.BaseSymbol {
export class TypeAlias extends BaseSymbol {
targetType;

@@ -23,9 +18,8 @@ constructor(name, target) {

get kind() {
return types_1.TypeKind.Alias;
return TypeKind.Alias;
}
get reference() {
return types_1.ReferenceKind.Irrelevant;
return ReferenceKind.Irrelevant;
}
}
exports.TypeAlias = TypeAlias;
//# sourceMappingURL=TypeAlias.js.map

@@ -1,7 +0,7 @@

import { Type } from "./types";
import { BaseSymbol } from "./BaseSymbol";
import { IType } from "./types.js";
import { BaseSymbol } from "./BaseSymbol.js";
/** A symbol with an attached type (variables, fields etc.). */
export declare class TypedSymbol extends BaseSymbol {
type: Type | undefined;
constructor(name: string, type?: Type);
type: IType | undefined;
constructor(name: string, type?: IType);
}

@@ -1,13 +0,8 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypedSymbol = void 0;
const BaseSymbol_1 = require("./BaseSymbol");
import { BaseSymbol } from "./BaseSymbol.js";
/** A symbol with an attached type (variables, fields etc.). */
class TypedSymbol extends BaseSymbol_1.BaseSymbol {
export class TypedSymbol extends BaseSymbol {
type;

@@ -19,3 +14,2 @@ constructor(name, type) {

}
exports.TypedSymbol = TypedSymbol;
//# sourceMappingURL=TypedSymbol.js.map

@@ -1,2 +0,1 @@

import { BaseSymbol } from "./BaseSymbol";
/** Visibility (aka. accessibility) of a symbol member. */

@@ -60,3 +59,3 @@ export declare enum MemberVisibility {

/** The root type interface. Used for typed symbols and type aliases. */
export interface Type {
export interface IType {
name: string;

@@ -67,10 +66,8 @@ /**

*/
baseTypes: Type[];
baseTypes: IType[];
kind: TypeKind;
reference: ReferenceKind;
}
export interface SymbolTableOptions {
export interface ISymbolTableOptions {
allowDuplicateSymbols?: boolean;
}
/** The type of constructors for symbols. Used mostly for factory and lookup functions. */
export type SymbolConstructor<T extends BaseSymbol, Args extends unknown[]> = new (...args: Args) => T;

@@ -1,12 +0,7 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReferenceKind = exports.TypeKind = exports.Modifier = exports.MemberVisibility = void 0;
/** Visibility (aka. accessibility) of a symbol member. */
var MemberVisibility;
export var MemberVisibility;
(function (MemberVisibility) {

@@ -30,5 +25,5 @@ /** Not specified, default depends on the language and type. */

MemberVisibility[MemberVisibility["Library"] = 6] = "Library";
})(MemberVisibility || (exports.MemberVisibility = MemberVisibility = {}));
})(MemberVisibility || (MemberVisibility = {}));
/** The modifier of a symbol member. */
var Modifier;
export var Modifier;
(function (Modifier) {

@@ -43,5 +38,5 @@ Modifier[Modifier["Static"] = 0] = "Static";

Modifier[Modifier["Overwritten"] = 7] = "Overwritten";
})(Modifier || (exports.Modifier = Modifier = {}));
})(Modifier || (Modifier = {}));
/** Rough categorization of a type. */
var TypeKind;
export var TypeKind;
(function (TypeKind) {

@@ -61,5 +56,5 @@ TypeKind[TypeKind["Unknown"] = 0] = "Unknown";

TypeKind[TypeKind["Alias"] = 12] = "Alias";
})(TypeKind || (exports.TypeKind = TypeKind = {}));
})(TypeKind || (TypeKind = {}));
/** Describes a reference to a type. */
var ReferenceKind;
export var ReferenceKind;
(function (ReferenceKind) {

@@ -73,3 +68,3 @@ ReferenceKind[ReferenceKind["Irrelevant"] = 0] = "Irrelevant";

ReferenceKind[ReferenceKind["Instance"] = 3] = "Instance";
})(ReferenceKind || (exports.ReferenceKind = ReferenceKind = {}));
})(ReferenceKind || (ReferenceKind = {}));
//# sourceMappingURL=types.js.map

@@ -1,11 +0,6 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.longestCommonPrefix = void 0;
const longestCommonPrefix = (arr1, arr2) => {
export const longestCommonPrefix = (arr1, arr2) => {
if (!arr1 || !arr2) {

@@ -22,3 +17,2 @@ return [];

};
exports.longestCommonPrefix = longestCommonPrefix;
//# sourceMappingURL=utils.js.map

@@ -1,6 +0,6 @@

import { TypedSymbol } from "./TypedSymbol";
import { Type } from "./types";
import { TypedSymbol } from "./TypedSymbol.js";
import { IType } from "./types.js";
export declare class VariableSymbol extends TypedSymbol {
value: unknown;
constructor(name: string, value: unknown, type?: Type);
constructor(name: string, value: unknown, type?: IType);
}

@@ -1,12 +0,7 @@

"use strict";
/*
* This file is released under the MIT license.
* Copyright (c) 2023, Mike Lischke
*
* See LICENSE file for more info.
* Copyright (c) Mike Lischke. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariableSymbol = void 0;
const TypedSymbol_1 = require("./TypedSymbol");
class VariableSymbol extends TypedSymbol_1.TypedSymbol {
import { TypedSymbol } from "./TypedSymbol.js";
export class VariableSymbol extends TypedSymbol {
value;

@@ -18,3 +13,2 @@ constructor(name, value, type) {

}
exports.VariableSymbol = VariableSymbol;
//# sourceMappingURL=VariableSymbol.js.map
{
"name": "antlr4-c3",
"version": "3.1.1",
"version": "3.2.0",
"description": "A code completion core implementation for ANTLR4 based parsers",

@@ -18,3 +18,3 @@ "author": "Mike Lischke",

],
"type": "commonjs",
"type": "module",
"main": "./lib/index.js",

@@ -27,24 +27,23 @@ "scripts": {

"test-coverage": "jest --testMatch [ \"**/tests/**/*.spec.ts\" ] --coverage --silent",
"generate": "antlr4ts tests/CPP14.g4 tests/Expr.g4 tests/Whitebox.g4 -no-listener -no-visitor -o tests/generated -Xexact-output-dir",
"generate": "java -jar antlr/antlr4-4.13.2-SNAPSHOT-complete.jar -Dlanguage=TypeScript tests/CPP14.g4 tests/Expr.g4 tests/Whitebox.g4 -no-listener -no-visitor -o tests/generated -Xexact-output-dir",
"eslint": "eslint ."
},
"dependencies": {
"antlr4ts": "0.5.0-alpha.4"
},
"devDependencies": {
"@types/jest": "29.5.3",
"@types/node": "20.4.8",
"@types/jest": "29.5.4",
"@types/node": "20.5.9",
"@types/unicode-properties": "1.3.0",
"@typescript-eslint/eslint-plugin": "6.3.0",
"@typescript-eslint/parser": "6.3.0",
"antlr4ts-cli": "0.5.0-alpha.4",
"eslint": "8.46.0",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-jsdoc": "46.4.6",
"@typescript-eslint/eslint-plugin": "6.6.0",
"@typescript-eslint/parser": "6.6.0",
"eslint": "8.48.0",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsdoc": "46.5.1",
"eslint-plugin-prefer-arrow": "1.2.3",
"jest": "29.6.2",
"jest": "29.6.4",
"ts-jest": "29.1.1",
"ts-node": "10.9.1",
"typescript": "5.1.6"
"typescript": "5.2.2"
},
"dependencies": {
"antlr4ng": "1.0.1"
}
}

@@ -8,3 +8,3 @@ [![Build & Test](https://github.com/mike-lischke/antlr4-c3/actions/workflows/nodejs.yml/badge.svg?branch=master)](https://github.com/mike-lischke/antlr4-c3/actions/workflows/nodejs.yml)[![Downloads](https://img.shields.io/npm/dw/antlr4-c3?color=blue)](https://www.npmjs.com/package/antlr4-c3)

The original implementation is provided as a node module (works in both, Node.js and browsers), and is written in TypeScript. A port to Java is available under `ports/java`. Implementations under the `ports` folder might not be up to date compared to the Typescript version.
The original implementation is provided as a node module (works in both, Node.js and browsers), and is written in TypeScript. Ports to Java, C#, C++ are available in the `ports` folder. These ports might not be up to date compared to the TypeScript version.

@@ -87,3 +87,3 @@ # Abstract

> Since this library is made for ANTLR4 based parser, it requires the same [typescript runtime](https://github.com/tunnelvisionlabs/antlr4ts) as your parser (namely antlr4s). You have to make sure you can actually parse input before continuing with antlr4-c3.
> Since this library is made for ANTLR4 based parser, it requires a [JavaScript/TypeScript runtime](https://github.com/mike-lischke/antlr4ng), just like your parser (namely antlr4ng).

@@ -224,2 +224,8 @@ ```typescript

### 3.2.0
- A new [TypeScript runtime](https://github.com/mike-lischke/antlr4ng) powers this package now (antlr4ng).
- The package is now published as ES module, which is supported by all modern browsers and Node.js.
- The contributors list has been moved to a separate file, because now contributions are tracked via git's signed-off commits.
### 3.1.1

@@ -226,0 +232,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc