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.13.0-rc.5 to 0.13.0-rc.6

160

dist/src/ast-types.d.ts

@@ -408,151 +408,15 @@ interface Location {

export declare type Statement = IfStatement | WhileStatement | ForStatement | Block | InlineAssemblyStatement | DoWhileStatement | ContinueStatement | BreakStatement | ReturnStatement | EmitStatement | ThrowStatement | SimpleStatement | VariableDeclarationStatement | UncheckedStatement | TryStatement;
interface ASTVisitorEnter {
SourceUnit?: (node: SourceUnit) => any;
PragmaDirective?: (node: PragmaDirective) => any;
ImportDirective?: (node: ImportDirective) => any;
ContractDefinition?: (node: ContractDefinition) => any;
InheritanceSpecifier?: (node: InheritanceSpecifier) => any;
StateVariableDeclaration?: (node: StateVariableDeclaration) => any;
UsingForDeclaration?: (node: UsingForDeclaration) => any;
StructDefinition?: (node: StructDefinition) => any;
ModifierDefinition?: (node: ModifierDefinition) => any;
ModifierInvocation?: (node: ModifierInvocation) => any;
FunctionDefinition?: (node: FunctionDefinition) => any;
EventDefinition?: (node: EventDefinition) => any;
EnumValue?: (node: EnumValue) => any;
EnumDefinition?: (node: EnumDefinition) => any;
VariableDeclaration?: (node: VariableDeclaration) => any;
UserDefinedTypeName?: (node: UserDefinedTypeName) => any;
Mapping?: (node: Mapping) => any;
ArrayTypeName?: (node: ArrayTypeName) => any;
FunctionTypeName?: (node: FunctionTypeName) => any;
Block?: (node: Block) => any;
ExpressionStatement?: (node: ExpressionStatement) => any;
IfStatement?: (node: IfStatement) => any;
WhileStatement?: (node: WhileStatement) => any;
ForStatement?: (node: ForStatement) => any;
InlineAssemblyStatement?: (node: InlineAssemblyStatement) => any;
DoWhileStatement?: (node: DoWhileStatement) => any;
ContinueStatement?: (node: ContinueStatement) => any;
Break?: (node: Break) => any;
Continue?: (node: Continue) => any;
BreakStatement?: (node: BreakStatement) => any;
ReturnStatement?: (node: ReturnStatement) => any;
EmitStatement?: (node: EmitStatement) => any;
ThrowStatement?: (node: ThrowStatement) => any;
VariableDeclarationStatement?: (node: VariableDeclarationStatement) => any;
ElementaryTypeName?: (node: ElementaryTypeName) => any;
FunctionCall?: (node: FunctionCall) => any;
AssemblyBlock?: (node: AssemblyBlock) => any;
AssemblyCall?: (node: AssemblyCall) => any;
AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => any;
AssemblyAssignment?: (node: AssemblyAssignment) => any;
AssemblyStackAssignment?: (node: AssemblyStackAssignment) => any;
LabelDefinition?: (node: LabelDefinition) => any;
AssemblySwitch?: (node: AssemblySwitch) => any;
AssemblyCase?: (node: AssemblyCase) => any;
AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => any;
AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => any;
AssemblyFor?: (node: AssemblyFor) => any;
AssemblyIf?: (node: AssemblyIf) => any;
SubAssembly?: (node: SubAssembly) => any;
TupleExpression?: (node: TupleExpression) => any;
TypeNameExpression?: (node: TypeNameExpression) => any;
NameValueExpression?: (node: NameValueExpression) => any;
BooleanLiteral?: (node: BooleanLiteral) => any;
NumberLiteral?: (node: NumberLiteral) => any;
Identifier?: (node: Identifier) => any;
BinaryOperation?: (node: BinaryOperation) => any;
UnaryOperation?: (node: UnaryOperation) => any;
NewExpression?: (node: NewExpression) => any;
Conditional?: (node: Conditional) => any;
StringLiteral?: (node: StringLiteral) => any;
HexLiteral?: (node: HexLiteral) => any;
HexNumber?: (node: HexNumber) => any;
DecimalNumber?: (node: DecimalNumber) => any;
MemberAccess?: (node: MemberAccess) => any;
IndexAccess?: (node: IndexAccess) => any;
IndexRangeAccess?: (node: IndexRangeAccess) => any;
NameValueList?: (node: NameValueList) => any;
UncheckedStatement?: (node: UncheckedStatement) => any;
TryStatement?: (node: TryStatement) => any;
CatchClause?: (node: CatchClause) => any;
FileLevelConstant?: (node: FileLevelConstant) => any;
AssemblyMemberAccess?: (node: AssemblyMemberAccess) => any;
}
interface ASTVisitorExit {
'SourceUnit:exit'?: (node: SourceUnit) => any;
'PragmaDirective:exit'?: (node: PragmaDirective) => any;
'ImportDirective:exit'?: (node: ImportDirective) => any;
'ContractDefinition:exit'?: (node: ContractDefinition) => any;
'InheritanceSpecifier:exit'?: (node: InheritanceSpecifier) => any;
'StateVariableDeclaration:exit'?: (node: StateVariableDeclaration) => any;
'UsingForDeclaration:exit'?: (node: UsingForDeclaration) => any;
'StructDefinition:exit'?: (node: StructDefinition) => any;
'ModifierDefinition:exit'?: (node: ModifierDefinition) => any;
'ModifierInvocation:exit'?: (node: ModifierInvocation) => any;
'FunctionDefinition:exit'?: (node: FunctionDefinition) => any;
'EventDefinition:exit'?: (node: EventDefinition) => any;
'EnumValue:exit'?: (node: EnumValue) => any;
'EnumDefinition:exit'?: (node: EnumDefinition) => any;
'VariableDeclaration:exit'?: (node: VariableDeclaration) => any;
'UserDefinedTypeName:exit'?: (node: UserDefinedTypeName) => any;
'Mapping:exit'?: (node: Mapping) => any;
'ArrayTypeName:exit'?: (node: ArrayTypeName) => any;
'FunctionTypeName:exit'?: (node: FunctionTypeName) => any;
'Block:exit'?: (node: Block) => any;
'ExpressionStatement:exit'?: (node: ExpressionStatement) => any;
'IfStatement:exit'?: (node: IfStatement) => any;
'WhileStatement:exit'?: (node: WhileStatement) => any;
'ForStatement:exit'?: (node: ForStatement) => any;
'InlineAssemblyStatement:exit'?: (node: InlineAssemblyStatement) => any;
'DoWhileStatement:exit'?: (node: DoWhileStatement) => any;
'ContinueStatement:exit'?: (node: ContinueStatement) => any;
'Break:exit'?: (node: Break) => any;
'Continue:exit'?: (node: Continue) => any;
'BreakStatement:exit'?: (node: BreakStatement) => any;
'ReturnStatement:exit'?: (node: ReturnStatement) => any;
'EmitStatement:exit'?: (node: EmitStatement) => any;
'ThrowStatement:exit'?: (node: ThrowStatement) => any;
'VariableDeclarationStatement:exit'?: (node: VariableDeclarationStatement) => any;
'ElementaryTypeName:exit'?: (node: ElementaryTypeName) => any;
'FunctionCall:exit'?: (node: FunctionCall) => any;
'AssemblyBlock:exit'?: (node: AssemblyBlock) => any;
'AssemblyCall:exit'?: (node: AssemblyCall) => any;
'AssemblyLocalDefinition:exit'?: (node: AssemblyLocalDefinition) => any;
'AssemblyAssignment:exit'?: (node: AssemblyAssignment) => any;
'AssemblyStackAssignment:exit'?: (node: AssemblyStackAssignment) => any;
'LabelDefinition:exit'?: (node: LabelDefinition) => any;
'AssemblySwitch:exit'?: (node: AssemblySwitch) => any;
'AssemblyCase:exit'?: (node: AssemblyCase) => any;
'AssemblyFunctionDefinition:exit'?: (node: AssemblyFunctionDefinition) => any;
'AssemblyFunctionReturns:exit'?: (node: AssemblyFunctionReturns) => any;
'AssemblyFor:exit'?: (node: AssemblyFor) => any;
'AssemblyIf:exit'?: (node: AssemblyIf) => any;
'SubAssembly:exit'?: (node: SubAssembly) => any;
'TupleExpression:exit'?: (node: TupleExpression) => any;
'TypeNameExpression:exit'?: (node: TypeNameExpression) => any;
'NameValueExpression:exit'?: (node: NameValueExpression) => any;
'BooleanLiteral:exit'?: (node: BooleanLiteral) => any;
'NumberLiteral:exit'?: (node: NumberLiteral) => any;
'Identifier:exit'?: (node: Identifier) => any;
'BinaryOperation:exit'?: (node: BinaryOperation) => any;
'UnaryOperation:exit'?: (node: UnaryOperation) => any;
'NewExpression:exit'?: (node: NewExpression) => any;
'Conditional:exit'?: (node: Conditional) => any;
'StringLiteral:exit'?: (node: StringLiteral) => any;
'HexLiteral:exit'?: (node: HexLiteral) => any;
'HexNumber:exit'?: (node: HexNumber) => any;
'DecimalNumber:exit'?: (node: DecimalNumber) => any;
'MemberAccess:exit'?: (node: MemberAccess) => any;
'IndexAccess:exit'?: (node: IndexAccess) => any;
'IndexRangeAccess:exit'?: (node: IndexRangeAccess) => any;
'NameValueList:exit'?: (node: NameValueList) => any;
'UncheckedStatement:exit'?: (node: UncheckedStatement) => any;
'TryStatement:exit'?: (node: TryStatement) => any;
'CatchClause:exit'?: (node: CatchClause) => any;
'FileLevelConstant:exit'?: (node: FileLevelConstant) => any;
'AssemblyMemberAccess:exit'?: (node: AssemblyMemberAccess) => any;
}
declare type ASTMap<U> = {
[K in ASTNodeTypeString]: U extends {
type: K;
} ? U : never;
};
declare type ASTTypeMap = ASTMap<ASTNode>;
declare type ASTVisitorEnter = {
[K in keyof ASTTypeMap]?: (ast: ASTTypeMap[K], parent?: ASTNode) => any;
};
declare type ASTVisitorExit = {
[K in keyof ASTTypeMap as `${K}:exit`]?: (ast: ASTTypeMap[K], parent?: ASTNode) => any;
};
export declare type ASTVisitor = ASTVisitorEnter & ASTVisitorExit;
export {};

4

dist/src/parser.d.ts

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

import { ASTVisitor, SourceUnit } from './ast-types';
import { ASTNode, ASTVisitor, SourceUnit } from './ast-types';
import { ParseOptions, Token, TokenizeOptions } from './types';

@@ -20,3 +20,3 @@ interface ParserErrorItem {

export declare function parse(input: string, options?: ParseOptions): ParseResult;
export declare function visit(node: unknown, visitor: ASTVisitor): void;
export declare function visit(node: unknown, visitor: ASTVisitor, nodeParent?: ASTNode): void;
export {};
{
"name": "@solidity-parser/parser",
"version": "0.13.0-rc.5",
"version": "0.13.0-rc.6",
"description": "A Solidity parser built from a robust ANTLR 4 grammar",

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

@@ -662,154 +662,11 @@ // Base on the original type definitions for solidity-parser-antlr 0.2

interface ASTVisitorEnter {
SourceUnit?: (node: SourceUnit) => any
PragmaDirective?: (node: PragmaDirective) => any
ImportDirective?: (node: ImportDirective) => any
ContractDefinition?: (node: ContractDefinition) => any
InheritanceSpecifier?: (node: InheritanceSpecifier) => any
StateVariableDeclaration?: (node: StateVariableDeclaration) => any
UsingForDeclaration?: (node: UsingForDeclaration) => any
StructDefinition?: (node: StructDefinition) => any
ModifierDefinition?: (node: ModifierDefinition) => any
ModifierInvocation?: (node: ModifierInvocation) => any
FunctionDefinition?: (node: FunctionDefinition) => any
EventDefinition?: (node: EventDefinition) => any
EnumValue?: (node: EnumValue) => any
EnumDefinition?: (node: EnumDefinition) => any
VariableDeclaration?: (node: VariableDeclaration) => any
UserDefinedTypeName?: (node: UserDefinedTypeName) => any
Mapping?: (node: Mapping) => any
ArrayTypeName?: (node: ArrayTypeName) => any
FunctionTypeName?: (node: FunctionTypeName) => any
Block?: (node: Block) => any
ExpressionStatement?: (node: ExpressionStatement) => any
IfStatement?: (node: IfStatement) => any
WhileStatement?: (node: WhileStatement) => any
ForStatement?: (node: ForStatement) => any
InlineAssemblyStatement?: (node: InlineAssemblyStatement) => any
DoWhileStatement?: (node: DoWhileStatement) => any
ContinueStatement?: (node: ContinueStatement) => any
Break?: (node: Break) => any
Continue?: (node: Continue) => any
BreakStatement?: (node: BreakStatement) => any
ReturnStatement?: (node: ReturnStatement) => any
EmitStatement?: (node: EmitStatement) => any
ThrowStatement?: (node: ThrowStatement) => any
VariableDeclarationStatement?: (node: VariableDeclarationStatement) => any
ElementaryTypeName?: (node: ElementaryTypeName) => any
FunctionCall?: (node: FunctionCall) => any
AssemblyBlock?: (node: AssemblyBlock) => any
AssemblyCall?: (node: AssemblyCall) => any
AssemblyLocalDefinition?: (node: AssemblyLocalDefinition) => any
AssemblyAssignment?: (node: AssemblyAssignment) => any
AssemblyStackAssignment?: (node: AssemblyStackAssignment) => any
LabelDefinition?: (node: LabelDefinition) => any
AssemblySwitch?: (node: AssemblySwitch) => any
AssemblyCase?: (node: AssemblyCase) => any
AssemblyFunctionDefinition?: (node: AssemblyFunctionDefinition) => any
AssemblyFunctionReturns?: (node: AssemblyFunctionReturns) => any
AssemblyFor?: (node: AssemblyFor) => any
AssemblyIf?: (node: AssemblyIf) => any
SubAssembly?: (node: SubAssembly) => any
TupleExpression?: (node: TupleExpression) => any
TypeNameExpression?: (node: TypeNameExpression) => any
NameValueExpression?: (node: NameValueExpression) => any
BooleanLiteral?: (node: BooleanLiteral) => any
NumberLiteral?: (node: NumberLiteral) => any
Identifier?: (node: Identifier) => any
BinaryOperation?: (node: BinaryOperation) => any
UnaryOperation?: (node: UnaryOperation) => any
NewExpression?: (node: NewExpression) => any
Conditional?: (node: Conditional) => any
StringLiteral?: (node: StringLiteral) => any
HexLiteral?: (node: HexLiteral) => any
HexNumber?: (node: HexNumber) => any
DecimalNumber?: (node: DecimalNumber) => any
MemberAccess?: (node: MemberAccess) => any
IndexAccess?: (node: IndexAccess) => any
IndexRangeAccess?: (node: IndexRangeAccess) => any
NameValueList?: (node: NameValueList) => any
UncheckedStatement?: (node: UncheckedStatement) => any
TryStatement?: (node: TryStatement) => any
CatchClause?: (node: CatchClause) => any
FileLevelConstant?: (node: FileLevelConstant) => any
AssemblyMemberAccess?: (node: AssemblyMemberAccess) => any
}
type ASTMap<U> = { [K in ASTNodeTypeString]: U extends { type: K } ? U : never };
type ASTTypeMap = ASTMap<ASTNode>;
type ASTVisitorEnter = {
[K in keyof ASTTypeMap]?: (ast: ASTTypeMap[K], parent?: ASTNode) => any
};
type ASTVisitorExit = {
[K in keyof ASTTypeMap as `${K}:exit`]?: (ast: ASTTypeMap[K], parent?: ASTNode) => any
};
interface ASTVisitorExit {
'SourceUnit:exit'?: (node: SourceUnit) => any
'PragmaDirective:exit'?: (node: PragmaDirective) => any
'ImportDirective:exit'?: (node: ImportDirective) => any
'ContractDefinition:exit'?: (node: ContractDefinition) => any
'InheritanceSpecifier:exit'?: (node: InheritanceSpecifier) => any
'StateVariableDeclaration:exit'?: (node: StateVariableDeclaration) => any
'UsingForDeclaration:exit'?: (node: UsingForDeclaration) => any
'StructDefinition:exit'?: (node: StructDefinition) => any
'ModifierDefinition:exit'?: (node: ModifierDefinition) => any
'ModifierInvocation:exit'?: (node: ModifierInvocation) => any
'FunctionDefinition:exit'?: (node: FunctionDefinition) => any
'EventDefinition:exit'?: (node: EventDefinition) => any
'EnumValue:exit'?: (node: EnumValue) => any
'EnumDefinition:exit'?: (node: EnumDefinition) => any
'VariableDeclaration:exit'?: (node: VariableDeclaration) => any
'UserDefinedTypeName:exit'?: (node: UserDefinedTypeName) => any
'Mapping:exit'?: (node: Mapping) => any
'ArrayTypeName:exit'?: (node: ArrayTypeName) => any
'FunctionTypeName:exit'?: (node: FunctionTypeName) => any
'Block:exit'?: (node: Block) => any
'ExpressionStatement:exit'?: (node: ExpressionStatement) => any
'IfStatement:exit'?: (node: IfStatement) => any
'WhileStatement:exit'?: (node: WhileStatement) => any
'ForStatement:exit'?: (node: ForStatement) => any
'InlineAssemblyStatement:exit'?: (node: InlineAssemblyStatement) => any
'DoWhileStatement:exit'?: (node: DoWhileStatement) => any
'ContinueStatement:exit'?: (node: ContinueStatement) => any
'Break:exit'?: (node: Break) => any
'Continue:exit'?: (node: Continue) => any
'BreakStatement:exit'?: (node: BreakStatement) => any
'ReturnStatement:exit'?: (node: ReturnStatement) => any
'EmitStatement:exit'?: (node: EmitStatement) => any
'ThrowStatement:exit'?: (node: ThrowStatement) => any
'VariableDeclarationStatement:exit'?: (
node: VariableDeclarationStatement
) => any
'ElementaryTypeName:exit'?: (node: ElementaryTypeName) => any
'FunctionCall:exit'?: (node: FunctionCall) => any
'AssemblyBlock:exit'?: (node: AssemblyBlock) => any
'AssemblyCall:exit'?: (node: AssemblyCall) => any
'AssemblyLocalDefinition:exit'?: (node: AssemblyLocalDefinition) => any
'AssemblyAssignment:exit'?: (node: AssemblyAssignment) => any
'AssemblyStackAssignment:exit'?: (node: AssemblyStackAssignment) => any
'LabelDefinition:exit'?: (node: LabelDefinition) => any
'AssemblySwitch:exit'?: (node: AssemblySwitch) => any
'AssemblyCase:exit'?: (node: AssemblyCase) => any
'AssemblyFunctionDefinition:exit'?: (node: AssemblyFunctionDefinition) => any
'AssemblyFunctionReturns:exit'?: (node: AssemblyFunctionReturns) => any
'AssemblyFor:exit'?: (node: AssemblyFor) => any
'AssemblyIf:exit'?: (node: AssemblyIf) => any
'SubAssembly:exit'?: (node: SubAssembly) => any
'TupleExpression:exit'?: (node: TupleExpression) => any
'TypeNameExpression:exit'?: (node: TypeNameExpression) => any
'NameValueExpression:exit'?: (node: NameValueExpression) => any
'BooleanLiteral:exit'?: (node: BooleanLiteral) => any
'NumberLiteral:exit'?: (node: NumberLiteral) => any
'Identifier:exit'?: (node: Identifier) => any
'BinaryOperation:exit'?: (node: BinaryOperation) => any
'UnaryOperation:exit'?: (node: UnaryOperation) => any
'NewExpression:exit'?: (node: NewExpression) => any
'Conditional:exit'?: (node: Conditional) => any
'StringLiteral:exit'?: (node: StringLiteral) => any
'HexLiteral:exit'?: (node: HexLiteral) => any
'HexNumber:exit'?: (node: HexNumber) => any
'DecimalNumber:exit'?: (node: DecimalNumber) => any
'MemberAccess:exit'?: (node: MemberAccess) => any
'IndexAccess:exit'?: (node: IndexAccess) => any
'IndexRangeAccess:exit'?: (node: IndexRangeAccess) => any
'NameValueList:exit'?: (node: NameValueList) => any
'UncheckedStatement:exit'?: (node: UncheckedStatement) => any
'TryStatement:exit'?: (node: TryStatement) => any
'CatchClause:exit'?: (node: CatchClause) => any
'FileLevelConstant:exit'?: (node: FileLevelConstant) => any
'AssemblyMemberAccess:exit'?: (node: AssemblyMemberAccess) => any
}
export type ASTVisitor = ASTVisitorEnter & ASTVisitorExit

@@ -816,0 +673,0 @@

@@ -107,5 +107,5 @@ import { ANTLRInputStream, CommonTokenStream } from 'antlr4ts'

export function visit(node: unknown, visitor: ASTVisitor): void {
export function visit(node: unknown, visitor: ASTVisitor, nodeParent?: ASTNode): void {
if (Array.isArray(node)) {
node.forEach((child) => visit(child, visitor))
node.forEach((child) => visit(child, visitor, nodeParent))
}

@@ -119,3 +119,3 @@

// TODO can we avoid this `as any`
cont = visitor[node.type]!(node as any)
cont = visitor[node.type]!(node as any, nodeParent)
}

@@ -128,3 +128,3 @@

// TODO can we avoid this `as any`
visit((node as any)[prop], visitor)
visit((node as any)[prop], visitor, node)
}

@@ -136,4 +136,4 @@ }

// TODO can we avoid this `as any`
visitor[selector]!(node as any)
visitor[selector]!(node as any, nodeParent)
}
}

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

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