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 1.1.6 to 1.1.7

12

out/src/SymbolTable.d.ts

@@ -56,7 +56,9 @@ import { ParseTree } from 'antlr4ts/tree/ParseTree';

readonly parent: Symbol | undefined;
readonly first: Symbol;
readonly previous: Symbol;
readonly next: Symbol;
readonly last: Symbol;
readonly firstSibling: Symbol;
readonly previousSibling: Symbol | undefined;
readonly nextSibling: Symbol | undefined;
readonly lastSibling: Symbol;
readonly next: Symbol | undefined;
removeFromParent(): void;
resolve(name: string, localOnly?: boolean): Symbol | undefined;
readonly root: Symbol | undefined;

@@ -100,2 +102,3 @@ readonly symbolTable: SymbolTable | undefined;

readonly lastChild: Symbol | undefined;
nextOf(child: Symbol): Symbol | undefined;
private _children;

@@ -175,4 +178,5 @@ }

getAllSymbols<T extends Symbol>(t?: new (...args: any[]) => T, localOnly?: boolean): Symbol[];
symbolWithContext(context: ParseTree): Symbol | undefined;
resolve(name: string, localOnly?: boolean): Symbol | undefined;
protected dependencies: Set<SymbolTable>;
}

@@ -63,13 +63,9 @@ 'use strict';

}
get first() {
if (!(this._parent instanceof ScopedSymbol)) {
return this;
get firstSibling() {
if (this._parent instanceof ScopedSymbol) {
return this._parent.firstChild;
}
let result = this._parent.firstChild;
if (result) {
return result;
}
return this;
}
get previous() {
get previousSibling() {
if (!(this._parent instanceof ScopedSymbol)) {

@@ -82,5 +78,4 @@ return this;

}
return this;
}
get next() {
get nextSibling() {
if (!(this._parent instanceof ScopedSymbol)) {

@@ -93,14 +88,14 @@ return this;

}
return this;
}
get last() {
if (!(this._parent instanceof ScopedSymbol)) {
return this;
get lastSibling() {
if (this._parent instanceof ScopedSymbol) {
return this._parent.lastChild;
}
let result = this._parent.lastChild;
if (result) {
return result;
}
return this;
}
get next() {
if (this.parent instanceof ScopedSymbol) {
return this.parent.nextOf(this);
}
}
removeFromParent() {

@@ -112,2 +107,7 @@ if (this._parent instanceof ScopedSymbol) {

}
resolve(name, localOnly = false) {
if (this._parent instanceof ScopedSymbol) {
return this._parent.resolve(name, localOnly);
}
}
get root() {

@@ -273,3 +273,3 @@ let run = this._parent;

if (!localOnly) {
if (this._parent && this._parent instanceof ScopedSymbol)
if (this._parent instanceof ScopedSymbol)
return this._parent.resolve(name, false);

@@ -358,2 +358,18 @@ }

}
nextOf(child) {
if (!(child.parent instanceof ScopedSymbol)) {
return;
}
if (child.parent != this) {
return child.parent.nextOf(child);
}
if (child instanceof ScopedSymbol && child.children.length > 0) {
return child.children[0];
}
let sibling = this.nextSiblingOf(child);
if (sibling) {
return sibling;
}
return this.parent.nextOf(this);
}
}

@@ -524,2 +540,33 @@ exports.ScopedSymbol = ScopedSymbol;

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

@@ -526,0 +573,0 @@ let result = super.resolve(name, localOnly);

{
"name": "antlr4-c3",
"version": "1.1.6",
"version": "1.1.7",
"description": "A code completion core implmentation for ANTLR4 based parsers",

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

"@types/mocha": "^2.2.48",
"@types/node": "^6.0.97",
"antlr4ts-cli": "^0.4.0-canary.37504efa",
"@types/node": "^6.0.101",
"chai": "^3.5.0",

@@ -33,0 +32,0 @@ "mocha": "^2.5.3",

@@ -212,2 +212,7 @@ [![NPM](https://nodei.co/npm/antlr4-c3.png?downloads=true&downloadRank=true)](https://nodei.co/npm/antlr4-c3/)

### 1.1.7
- Renamed a number of methods for improved consistency (`next` -> `nextSibling` etc.) and updated some tests.
- Also simple symbols can be used to resolve other symbols (by delegating this call to their parents, if there's one).
- Added a method to find a symbol by it's associated context + added a test for that.
### 1.1.6

@@ -214,0 +219,0 @@ - Added Java port from Nick Stephen.

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