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

@solidity-parser/parser

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solidity-parser/parser - npm Package Compare versions

Comparing version 0.14.1 to 0.14.2-beta.0

dist/Solidity-EZVQ6AE4.tokens

19

dist/src/antlr/SolidityLexer.d.ts

@@ -130,11 +130,12 @@ import { ATN } from "antlr4ts/atn/ATN";

static readonly ViewKeyword = 124;
static readonly ConstructorKeyword = 125;
static readonly FallbackKeyword = 126;
static readonly ReceiveKeyword = 127;
static readonly Identifier = 128;
static readonly StringLiteralFragment = 129;
static readonly VersionLiteral = 130;
static readonly WS = 131;
static readonly COMMENT = 132;
static readonly LINE_COMMENT = 133;
static readonly GlobalKeyword = 125;
static readonly ConstructorKeyword = 126;
static readonly FallbackKeyword = 127;
static readonly ReceiveKeyword = 128;
static readonly Identifier = 129;
static readonly StringLiteralFragment = 130;
static readonly VersionLiteral = 131;
static readonly WS = 132;
static readonly COMMENT = 133;
static readonly LINE_COMMENT = 134;
static readonly channelNames: string[];

@@ -141,0 +142,0 @@ static readonly modeNames: string[];

@@ -20,2 +20,3 @@ import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";

import { UsingForDeclarationContext } from "./SolidityParser";
import { UsingForObjectContext } from "./SolidityParser";
import { StructDefinitionContext } from "./SolidityParser";

@@ -286,2 +287,12 @@ import { ModifierDefinitionContext } from "./SolidityParser";

/**
* Enter a parse tree produced by `SolidityParser.usingForObject`.
* @param ctx the parse tree
*/
enterUsingForObject?: (ctx: UsingForObjectContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.usingForObject`.
* @param ctx the parse tree
*/
exitUsingForObject?: (ctx: UsingForObjectContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.structDefinition`.

@@ -288,0 +299,0 @@ * @param ctx the parse tree

@@ -20,2 +20,3 @@ import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";

import { UsingForDeclarationContext } from "./SolidityParser";
import { UsingForObjectContext } from "./SolidityParser";
import { StructDefinitionContext } from "./SolidityParser";

@@ -217,2 +218,8 @@ import { ModifierDefinitionContext } from "./SolidityParser";

/**
* Visit a parse tree produced by `SolidityParser.usingForObject`.
* @param ctx the parse tree
* @return the visitor result
*/
visitUsingForObject?: (ctx: UsingForObjectContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.structDefinition`.

@@ -219,0 +226,0 @@ * @param ctx the parse tree

@@ -68,3 +68,5 @@ interface Location {

typeName: TypeName | null;
libraryName: string;
functions: string[];
libraryName: string | null;
isGlobal: boolean;
}

@@ -282,2 +284,3 @@ export interface StructDefinition extends BaseASTNode {

name: string;
expression: AssemblyExpression;
}

@@ -428,3 +431,3 @@ export interface LabelDefinition extends BaseASTNode {

export declare type Expression = IndexAccess | IndexRangeAccess | TupleExpression | BinaryOperation | Conditional | MemberAccess | FunctionCall | UnaryOperation | NewExpression | PrimaryExpression | NameValueExpression;
export declare type PrimaryExpression = BooleanLiteral | HexLiteral | StringLiteral | NumberLiteral | Identifier | TupleExpression | TypeNameExpression;
export declare type PrimaryExpression = BooleanLiteral | HexLiteral | StringLiteral | NumberLiteral | Identifier | TupleExpression | TypeName;
export declare type SimpleStatement = VariableDeclarationStatement | ExpressionStatement;

@@ -431,0 +434,0 @@ export declare type TypeName = ElementaryTypeName | UserDefinedTypeName | Mapping | ArrayTypeName | FunctionTypeName;

{
"name": "@solidity-parser/parser",
"version": "0.14.1",
"version": "0.14.2-beta.0",
"description": "A Solidity parser built from a robust ANTLR 4 grammar",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

@@ -24,2 +24,3 @@ // Generated from antlr/Solidity.g4 by ANTLR 4.9.0-SNAPSHOT

import { UsingForDeclarationContext } from "./SolidityParser";
import { UsingForObjectContext } from "./SolidityParser";
import { StructDefinitionContext } from "./SolidityParser";

@@ -310,2 +311,13 @@ import { ModifierDefinitionContext } from "./SolidityParser";

/**
* Enter a parse tree produced by `SolidityParser.usingForObject`.
* @param ctx the parse tree
*/
enterUsingForObject?: (ctx: UsingForObjectContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.usingForObject`.
* @param ctx the parse tree
*/
exitUsingForObject?: (ctx: UsingForObjectContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.structDefinition`.

@@ -312,0 +324,0 @@ * @param ctx the parse tree

@@ -24,2 +24,3 @@ // Generated from antlr/Solidity.g4 by ANTLR 4.9.0-SNAPSHOT

import { UsingForDeclarationContext } from "./SolidityParser";
import { UsingForObjectContext } from "./SolidityParser";
import { StructDefinitionContext } from "./SolidityParser";

@@ -241,2 +242,9 @@ import { ModifierDefinitionContext } from "./SolidityParser";

/**
* Visit a parse tree produced by `SolidityParser.usingForObject`.
* @param ctx the parse tree
* @return the visitor result
*/
visitUsingForObject?: (ctx: UsingForObjectContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.structDefinition`.

@@ -243,0 +251,0 @@ * @param ctx the parse tree

@@ -157,3 +157,5 @@ // Base on the original type definitions for solidity-parser-antlr 0.2

typeName: TypeName | null
libraryName: string
functions: string[]
libraryName: string | null
isGlobal: boolean;
}

@@ -375,2 +377,3 @@ export interface StructDefinition extends BaseASTNode {

name: string
expression: AssemblyExpression
}

@@ -670,3 +673,3 @@ export interface LabelDefinition extends BaseASTNode {

| TupleExpression
| TypeNameExpression
| TypeName
export type SimpleStatement = VariableDeclarationStatement | ExpressionStatement

@@ -673,0 +676,0 @@ export type TypeName =

@@ -527,6 +527,29 @@ import { ParserRuleContext } from 'antlr4ts'

const node: AST.UsingForDeclaration = {
type: 'UsingForDeclaration',
typeName,
libraryName: this._toText(ctx.userDefinedTypeName()),
const isGlobal = ctx.GlobalKeyword() !== undefined;
// the object of the `usingForDeclaration` can be a single identifier
// (the library name) or a group of functions:
// using Lib for uint;
// using { f } for uint;
let node: AST.UsingForDeclaration
const usingForObject = ctx.usingForObject()
const firstChild = this._toText(usingForObject.getChild(0))
if (firstChild === '{') {
node = {
type: 'UsingForDeclaration',
isGlobal,
typeName,
libraryName: null,
functions: usingForObject
.userDefinedTypeName()
.map((x) => this._toText(x)),
}
} else {
node = {
type: 'UsingForDeclaration',
isGlobal,
typeName,
libraryName: this._toText(usingForObject.userDefinedTypeName(0)),
functions: [],
}
}

@@ -740,3 +763,3 @@

name: this._toText(ctx.identifier()),
definition: this.visitElementaryTypeName(ctx.elementaryTypeName())
definition: this.visitElementaryTypeName(ctx.elementaryTypeName()),
}

@@ -1398,34 +1421,4 @@

if (
ctx.children!.length == 3 &&
this._toText(ctx.getChild(1)) === '[' &&
this._toText(ctx.getChild(2)) === ']'
) {
let node: any = this.visit(ctx.getChild(0))
if (node.type === 'Identifier') {
node = {
type: 'UserDefinedTypeName',
namePath: node.name,
}
} else if (node.type == 'TypeNameExpression') {
node = node.typeName
} else {
node = {
type: 'ElementaryTypeName',
name: this._toText(ctx.getChild(0)),
}
}
const typeName: AST.ArrayTypeName = {
type: 'ArrayTypeName',
baseTypeName: this._addMeta(node, ctx),
length: null,
}
const result: AST.TypeNameExpression = {
type: 'TypeNameExpression',
typeName: this._addMeta(typeName, ctx),
}
return this._addMeta(result, ctx)
if (ctx.typeName()) {
return this.visitTypeName(ctx.typeName()!)
}

@@ -1898,2 +1891,3 @@

name: this._toText(ctx.identifier()),
expression: this.visitAssemblyExpression(ctx.assemblyExpression()),
}

@@ -1900,0 +1894,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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is too big to display

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