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 2.0.2 to 2.1.0

.github/workflows/node.js.yml

31

.eslintrc.json

@@ -15,3 +15,4 @@ {

"ignorePatterns": [
"**/generated/*"
"**/generated/*",
"out/*"
],

@@ -23,5 +24,3 @@ "parser": "@typescript-eslint/parser",

"implicitStrict": true,
"ecmaFeatures": {
"jsx": false
},
"ecmaFeatures": {},
"ecmaVersion": 8

@@ -37,5 +36,2 @@ },

"settings": {
"react": {
"version": "detect"
}
},

@@ -358,15 +354,3 @@ "rules": {

"valid-typeof": "off",
"no-restricted-properties": [
"error",
{
"object": "require",
"property": "ensure",
"message": "Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting"
},
{
"object": "System",
"property": "import",
"message": "Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting"
}
],
"getter-return": [

@@ -400,3 +384,2 @@ "warn"

"import/order": "off",
"import/no-webpack-loader-syntax": "off",
"max-classes-per-file": [

@@ -557,4 +540,8 @@ "error",

"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off"
"jsdoc/require-returns-type": "off",
"jsdoc/tag-lines": [
// Have to switch this off, as it is not good enough to be used.
"off"
]
}
}
{
"version": "0.1",
"version": "0.2",
"words": [

@@ -10,4 +10,9 @@ "ANTLR",

"ignoreWords": [
"Xexact",
"philipps"
],
"ignorePaths": [
".eslintrc.json",
"package.json"
]
}
}

@@ -55,3 +55,2 @@ import { ParseTree } from "antlr4ts/tree/ParseTree";

constructor(name?: string);
setParent(parent: Symbol | undefined): void;
get parent(): Symbol | undefined;

@@ -63,8 +62,10 @@ get firstSibling(): Symbol;

get next(): Symbol | undefined;
get root(): Symbol | undefined;
get symbolTable(): SymbolTable | undefined;
get symbolPath(): Symbol[];
setParent(parent: Symbol | undefined): void;
removeFromParent(): void;
resolve(name: string, localOnly?: boolean): Promise<Symbol | undefined>;
get root(): Symbol | undefined;
get symbolTable(): SymbolTable | undefined;
resolveSync(name: string, localOnly?: boolean): Symbol | undefined;
getParentOfType<T extends Symbol>(t: new (...args: any[]) => T): T | undefined;
get symbolPath(): Symbol[];
qualifiedName(separator?: string, full?: boolean, includeAnonymous?: boolean): string;

@@ -77,7 +78,7 @@ }

export declare class TypeAlias extends Symbol implements Type {
private targetType;
constructor(name: string, target: Type);
get baseTypes(): Type[];
get kind(): TypeKind;
get reference(): ReferenceKind;
private targetType;
constructor(name: string, target: Type);
}

@@ -87,3 +88,6 @@ export declare class ScopedSymbol extends Symbol {

constructor(name?: string);
get directScopes(): Promise<ScopedSymbol[]>;
get children(): Symbol[];
get firstChild(): Symbol | undefined;
get lastChild(): Symbol | undefined;
clear(): void;

@@ -93,9 +97,12 @@ addSymbol(symbol: Symbol): void;

getNestedSymbolsOfType<T extends Symbol>(t: new (...args: any[]) => T): Promise<T[]>;
getNestedSymbolsOfTypeSync<T extends Symbol>(t: new (...args: any[]) => T): T[];
getAllNestedSymbols(name?: string): Promise<Symbol[]>;
getAllNestedSymbolsSync(name?: string): Symbol[];
getSymbolsOfType<T extends Symbol>(t: new (...args: any[]) => T): Promise<T[]>;
getAllSymbols<T extends Symbol>(t: new (...args: any[]) => T, localOnly?: boolean): Promise<T[]>;
getAllSymbolsSync<T extends Symbol>(t: new (...args: any[]) => T, localOnly?: boolean): T[];
resolve(name: string, localOnly?: boolean): Promise<Symbol | undefined>;
resolveSync(name: string, localOnly?: boolean): Symbol | undefined;
getTypedSymbols(localOnly?: boolean): TypedSymbol[];
getTypedSymbolNames(localOnly?: boolean): string[];
get directScopes(): Promise<ScopedSymbol[]>;
symbolFromPath(path: string, separator?: string): Symbol | undefined;

@@ -105,4 +112,2 @@ indexOfChild(child: Symbol): number;

previousSiblingOf(child: Symbol): Symbol | undefined;
get firstChild(): Symbol | undefined;
get lastChild(): Symbol | undefined;
nextOf(child: Symbol): Symbol | undefined;

@@ -148,5 +153,2 @@ }

export declare class ClassSymbol extends ScopedSymbol implements Type {
get baseTypes(): Type[];
get kind(): TypeKind;
get reference(): ReferenceKind;
isStruct: boolean;

@@ -156,2 +158,5 @@ readonly superClasses: ClassSymbol[];

constructor(name: string, referenceKind: ReferenceKind, ...superClass: ClassSymbol[]);
get baseTypes(): Type[];
get kind(): TypeKind;
get reference(): ReferenceKind;
getMethods(includeInherited?: boolean): Promise<MethodSymbol[]>;

@@ -161,5 +166,2 @@ getFields(includeInherited?: boolean): Promise<FieldSymbol[]>;

export declare class ArrayType extends Symbol implements Type {
get baseTypes(): Type[];
get kind(): TypeKind;
get reference(): ReferenceKind;
readonly elementType: Type;

@@ -169,2 +171,5 @@ readonly size: number;

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

@@ -175,5 +180,2 @@ export declare class SymbolTable extends ScopedSymbol {

constructor(name: string, options: SymbolTableOptions);
clear(): void;
addDependencies(...tables: SymbolTable[]): void;
removeDependency(table: SymbolTable): void;
get info(): {

@@ -183,7 +185,14 @@ dependencyCount: number;

};
addNewSymbolOfType<T extends Symbol>(t: new (...args: any[]) => T, parent: ScopedSymbol | undefined, ...args: any[]): T;
clear(): void;
addDependencies(...tables: SymbolTable[]): void;
removeDependency(table: SymbolTable): void;
addNewSymbolOfType<T extends Symbol>(t: new (...args: unknown[]) => T, parent: ScopedSymbol | undefined, ...args: unknown[]): T;
addNewNamespaceFromPath(parent: ScopedSymbol | undefined, path: string, delimiter?: string): Promise<NamespaceSymbol>;
addNewNamespaceFromPathSync(parent: ScopedSymbol | undefined, path: string, delimiter?: string): NamespaceSymbol;
getAllSymbols<T extends Symbol>(t: new (...args: any[]) => T, localOnly?: boolean): Promise<T[]>;
getAllSymbolsSync<T extends Symbol>(t: new (...args: any[]) => T, localOnly?: boolean): T[];
symbolWithContext(context: ParseTree): Promise<Symbol | undefined>;
symbolWithContextSync(context: ParseTree): Symbol | undefined;
resolve(name: string, localOnly?: boolean): Promise<Symbol | undefined>;
resolveSync(name: string, localOnly?: boolean): Symbol | undefined;
}

@@ -69,5 +69,2 @@ "use strict";

}
setParent(parent) {
this.theParent = parent;
}
get parent() {

@@ -106,16 +103,2 @@ return this.theParent;

}
removeFromParent() {
if (this.theParent instanceof ScopedSymbol) {
this.theParent.removeSymbol(this);
this.theParent = undefined;
}
}
resolve(name, localOnly = false) {
return __awaiter(this, void 0, void 0, function* () {
if (this.theParent instanceof ScopedSymbol) {
return this.theParent.resolve(name, localOnly);
}
return Promise.resolve(undefined);
});
}
get root() {

@@ -144,12 +127,2 @@ let run = this.theParent;

}
getParentOfType(t) {
let run = this.theParent;
while (run) {
if (run instanceof t) {
return run;
}
run = run.theParent;
}
return undefined;
}
get symbolPath() {

@@ -167,2 +140,35 @@ const result = [];

}
setParent(parent) {
this.theParent = parent;
}
removeFromParent() {
if (this.theParent instanceof ScopedSymbol) {
this.theParent.removeSymbol(this);
this.theParent = undefined;
}
}
resolve(name, localOnly = false) {
return __awaiter(this, void 0, void 0, function* () {
if (this.theParent instanceof ScopedSymbol) {
return this.theParent.resolve(name, localOnly);
}
return Promise.resolve(undefined);
});
}
resolveSync(name, localOnly = false) {
if (this.theParent instanceof ScopedSymbol) {
return this.theParent.resolveSync(name, localOnly);
}
return undefined;
}
getParentOfType(t) {
let run = this.theParent;
while (run) {
if (run instanceof t) {
return run;
}
run = run.theParent;
}
return undefined;
}
qualifiedName(separator = ".", full = false, includeAnonymous = false) {

@@ -209,5 +215,20 @@ if (!includeAnonymous && this.name.length === 0) {

}
get directScopes() {
return this.getSymbolsOfType(ScopedSymbol);
}
get children() {
return this._children;
}
get firstChild() {
if (this.children.length > 0) {
return this.children[0];
}
return undefined;
}
get lastChild() {
if (this.children.length > 0) {
return this.children[this.children.length - 1];
}
return undefined;
}
clear() {

@@ -259,2 +280,14 @@ this._children = [];

}
getNestedSymbolsOfTypeSync(t) {
const result = [];
this.children.forEach((child) => {
if (child instanceof t) {
result.push(child);
}
if (child instanceof ScopedSymbol) {
result.push(...child.getNestedSymbolsOfTypeSync(t));
}
});
return result;
}
getAllNestedSymbols(name) {

@@ -279,2 +312,14 @@ return __awaiter(this, void 0, void 0, function* () {

}
getAllNestedSymbolsSync(name) {
const result = [];
this.children.forEach((child) => {
if (!name || child.name === name) {
result.push(child);
}
if (child instanceof ScopedSymbol) {
result.push(...child.getAllNestedSymbolsSync(name));
}
});
return result;
}
getSymbolsOfType(t) {

@@ -312,2 +357,21 @@ return new Promise((resolve) => {

}
getAllSymbolsSync(t, localOnly = false) {
const result = [];
for (const child of this.children) {
if (child instanceof t) {
result.push(child);
}
if (child instanceof NamespaceSymbol) {
const childSymbols = child.getAllSymbolsSync(t, true);
result.push(...childSymbols);
}
}
if (!localOnly) {
if (this.parent instanceof ScopedSymbol) {
const childSymbols = this.getAllSymbolsSync(t, true);
result.push(...childSymbols);
}
}
return result;
}
resolve(name, localOnly = false) {

@@ -332,2 +396,15 @@ return __awaiter(this, void 0, void 0, function* () {

}
resolveSync(name, localOnly = false) {
for (const child of this.children) {
if (child.name === name) {
return child;
}
}
if (!localOnly) {
if (this.parent instanceof ScopedSymbol) {
return this.parent.resolveSync(name, false);
}
}
return undefined;
}
getTypedSymbols(localOnly = true) {

@@ -363,5 +440,2 @@ const result = [];

}
get directScopes() {
return this.getSymbolsOfType(ScopedSymbol);
}
symbolFromPath(path, separator = ".") {

@@ -404,14 +478,2 @@ const elements = path.split(separator);

}
get firstChild() {
if (this.children.length > 0) {
return this.children[0];
}
return undefined;
}
get lastChild() {
if (this.children.length > 0) {
return this.children[this.children.length - 1];
}
return undefined;
}
nextOf(child) {

@@ -532,2 +594,8 @@ if (!(child.parent instanceof ScopedSymbol)) {

}
get info() {
return {
dependencyCount: this.dependencies.size,
symbolCount: this.children.length,
};
}
clear() {

@@ -547,8 +615,2 @@ super.clear();

}
get info() {
return {
dependencyCount: this.dependencies.size,
symbolCount: this.children.length,
};
}
addNewSymbolOfType(t, parent, ...args) {

@@ -580,2 +642,16 @@ const result = new t(...args);

}
addNewNamespaceFromPathSync(parent, path, delimiter = ".") {
const parts = path.split(delimiter);
let i = 0;
let currentParent = (parent === undefined) ? this : parent;
while (i < parts.length - 1) {
let namespace = currentParent.resolveSync(parts[i], true);
if (namespace === undefined) {
namespace = this.addNewSymbolOfType(NamespaceSymbol, currentParent, parts[i]);
}
currentParent = namespace;
++i;
}
return this.addNewSymbolOfType(NamespaceSymbol, currentParent, parts[parts.length - 1]);
}
getAllSymbols(t, localOnly = false) {

@@ -596,2 +672,11 @@ const _super = Object.create(null, {

}
getAllSymbolsSync(t, localOnly = false) {
const result = super.getAllSymbolsSync(t, localOnly);
if (!localOnly) {
this.dependencies.forEach((dependency) => {
result.push(...dependency.getAllSymbolsSync(t, localOnly));
});
}
return result;
}
symbolWithContext(context) {

@@ -630,2 +715,33 @@ return __awaiter(this, void 0, void 0, function* () {

}
symbolWithContextSync(context) {
const findRecursive = (symbol) => {
if (symbol.context === context) {
return symbol;
}
if (symbol instanceof ScopedSymbol) {
for (const child of symbol.children) {
const result = findRecursive(child);
if (result) {
return result;
}
}
}
};
let symbols = this.getAllSymbolsSync(Symbol);
for (const symbol of symbols) {
const result = findRecursive(symbol);
if (result) {
return result;
}
}
for (const dependency of this.dependencies) {
symbols = dependency.getAllSymbolsSync(Symbol);
for (const symbol of symbols) {
const result = findRecursive(symbol);
if (result) {
result;
}
}
}
}
resolve(name, localOnly = false) {

@@ -648,4 +764,16 @@ const _super = Object.create(null, {

}
resolveSync(name, localOnly = false) {
let result = super.resolveSync(name, localOnly);
if (!result && !localOnly) {
for (const dependency of this.dependencies) {
result = dependency.resolveSync(name, false);
if (result) {
return result;
}
}
}
return result;
}
}
exports.SymbolTable = SymbolTable;
//# sourceMappingURL=SymbolTable.js.map
{
"name": "antlr4-c3",
"version": "2.0.2",
"version": "2.1.0",
"description": "A code completion core implementation for ANTLR4 based parsers",

@@ -9,4 +9,4 @@ "main": "out/index.js",

"prepublishOnly": "npm run test",
"test": "tsc --version && npm run generate && tsc && mocha out/test",
"generate": "antlr4ts test/CPP14.g4 test/Expr.g4 -no-listener -no-visitor",
"test": "tsc --version && npm run generate && tsc && npm run eslint && mocha out/test",
"generate": "antlr4ts test/CPP14.g4 test/Expr.g4 -no-listener -no-visitor -o test/generated -Xexact-output-dir",
"eslint": "eslint ."

@@ -29,21 +29,21 @@ },

"devDependencies": {
"@types/chai": "^4.2.21",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"@types/node": "^16.7.13",
"@typescript-eslint/eslint-plugin": "^4.31.0",
"@typescript-eslint/eslint-plugin-tslint": "^4.31.0",
"@typescript-eslint/parser": "^4.31.0",
"@types/node": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/eslint-plugin-tslint": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
"antlr4ts-cli": "^0.5.0-alpha.4",
"chai": "^4.3.4",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsdoc": "^36.0.8",
"eslint": "^8.5.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jsdoc": "^37.4.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-promise": "^5.1.0",
"mocha": "^9.1.1",
"eslint-plugin-promise": "^6.0.0",
"mocha": "^9.1.3",
"path": "^0.12.7",
"ts-node": "^10.2.1",
"typescript": "^4.4.2"
"tslint": "^6.1.3",
"ts-node": "^10.4.0",
"typescript": "^4.5.4"
},

@@ -50,0 +50,0 @@ "author": "Mike Lischke",

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

[![NPM](https://nodei.co/npm/antlr4-c3.png?downloads=true&downloadRank=true)](https://nodei.co/npm/antlr4-c3/)
![](https://img.shields.io/github/license/mike-lischke/antlr4-c3?style=for-the-badge)
![](https://img.shields.io/npm/dw/antlr4-c3?style=for-the-badge)

@@ -216,2 +217,8 @@ # antlr4-c3 The ANTLR4 Code Completion Core

### 2.1.0
- It turned out that synchronous symbol retrieval methods have their value, so I brought them back by adding `...Sync()` variants of all methods with an async behavior.
- Brought back and extended project tests on Github.
- Upgraded module dependencies.
- Cleaned up the code again, now with latest eslint settings.
### 2.0.2

@@ -218,0 +225,0 @@ - `getAllSymbols<T>` now returns symbols of type T (instead of `Symbol`), like all other enumeration methods.

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