Socket
Socket
Sign inDemoInstall

@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.5 to 0.15.0

dist/Solidity-3XVHMNWT.tokens

75

dist/src/antlr/SolidityLexer.d.ts

@@ -102,40 +102,39 @@ import { ATN } from "antlr4ts/atn/ATN";

static readonly T__95 = 96;
static readonly T__96 = 97;
static readonly Int = 98;
static readonly Uint = 99;
static readonly Byte = 100;
static readonly Fixed = 101;
static readonly Ufixed = 102;
static readonly BooleanLiteral = 103;
static readonly DecimalNumber = 104;
static readonly HexNumber = 105;
static readonly NumberUnit = 106;
static readonly HexLiteralFragment = 107;
static readonly ReservedKeyword = 108;
static readonly AnonymousKeyword = 109;
static readonly BreakKeyword = 110;
static readonly ConstantKeyword = 111;
static readonly ImmutableKeyword = 112;
static readonly ContinueKeyword = 113;
static readonly LeaveKeyword = 114;
static readonly ExternalKeyword = 115;
static readonly IndexedKeyword = 116;
static readonly InternalKeyword = 117;
static readonly PayableKeyword = 118;
static readonly PrivateKeyword = 119;
static readonly PublicKeyword = 120;
static readonly VirtualKeyword = 121;
static readonly PureKeyword = 122;
static readonly TypeKeyword = 123;
static readonly ViewKeyword = 124;
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 Int = 97;
static readonly Uint = 98;
static readonly Byte = 99;
static readonly Fixed = 100;
static readonly Ufixed = 101;
static readonly BooleanLiteral = 102;
static readonly DecimalNumber = 103;
static readonly HexNumber = 104;
static readonly NumberUnit = 105;
static readonly HexLiteralFragment = 106;
static readonly ReservedKeyword = 107;
static readonly AnonymousKeyword = 108;
static readonly BreakKeyword = 109;
static readonly ConstantKeyword = 110;
static readonly ImmutableKeyword = 111;
static readonly ContinueKeyword = 112;
static readonly LeaveKeyword = 113;
static readonly ExternalKeyword = 114;
static readonly IndexedKeyword = 115;
static readonly InternalKeyword = 116;
static readonly PayableKeyword = 117;
static readonly PrivateKeyword = 118;
static readonly PublicKeyword = 119;
static readonly VirtualKeyword = 120;
static readonly PureKeyword = 121;
static readonly TypeKeyword = 122;
static readonly ViewKeyword = 123;
static readonly GlobalKeyword = 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 channelNames: string[];

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

@@ -42,2 +42,4 @@ import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";

import { MappingContext } from "./SolidityParser";
import { MappingKeyNameContext } from "./SolidityParser";
import { MappingValueNameContext } from "./SolidityParser";
import { FunctionTypeNameContext } from "./SolidityParser";

@@ -94,3 +96,2 @@ import { StorageLocationContext } from "./SolidityParser";

import { AssemblyLiteralContext } from "./SolidityParser";
import { SubAssemblyContext } from "./SolidityParser";
import { TupleExpressionContext } from "./SolidityParser";

@@ -508,2 +509,22 @@ import { NumberLiteralContext } from "./SolidityParser";

/**
* Enter a parse tree produced by `SolidityParser.mappingKeyName`.
* @param ctx the parse tree
*/
enterMappingKeyName?: (ctx: MappingKeyNameContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.mappingKeyName`.
* @param ctx the parse tree
*/
exitMappingKeyName?: (ctx: MappingKeyNameContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.mappingValueName`.
* @param ctx the parse tree
*/
enterMappingValueName?: (ctx: MappingValueNameContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.mappingValueName`.
* @param ctx the parse tree
*/
exitMappingValueName?: (ctx: MappingValueNameContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.functionTypeName`.

@@ -1019,12 +1040,2 @@ * @param ctx the parse tree

/**
* Enter a parse tree produced by `SolidityParser.subAssembly`.
* @param ctx the parse tree
*/
enterSubAssembly?: (ctx: SubAssemblyContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.subAssembly`.
* @param ctx the parse tree
*/
exitSubAssembly?: (ctx: SubAssemblyContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.tupleExpression`.

@@ -1031,0 +1042,0 @@ * @param ctx the parse tree

@@ -42,2 +42,4 @@ import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";

import { MappingContext } from "./SolidityParser";
import { MappingKeyNameContext } from "./SolidityParser";
import { MappingValueNameContext } from "./SolidityParser";
import { FunctionTypeNameContext } from "./SolidityParser";

@@ -94,3 +96,2 @@ import { StorageLocationContext } from "./SolidityParser";

import { AssemblyLiteralContext } from "./SolidityParser";
import { SubAssemblyContext } from "./SolidityParser";
import { TupleExpressionContext } from "./SolidityParser";

@@ -351,2 +352,14 @@ import { NumberLiteralContext } from "./SolidityParser";

/**
* Visit a parse tree produced by `SolidityParser.mappingKeyName`.
* @param ctx the parse tree
* @return the visitor result
*/
visitMappingKeyName?: (ctx: MappingKeyNameContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.mappingValueName`.
* @param ctx the parse tree
* @return the visitor result
*/
visitMappingValueName?: (ctx: MappingValueNameContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.functionTypeName`.

@@ -658,8 +671,2 @@ * @param ctx the parse tree

/**
* Visit a parse tree produced by `SolidityParser.subAssembly`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSubAssembly?: (ctx: SubAssemblyContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.tupleExpression`.

@@ -666,0 +673,0 @@ * @param ctx the parse tree

@@ -36,3 +36,3 @@ interface Location {

}
export declare const astNodeTypes: readonly ["SourceUnit", "PragmaDirective", "ImportDirective", "ContractDefinition", "InheritanceSpecifier", "StateVariableDeclaration", "UsingForDeclaration", "StructDefinition", "ModifierDefinition", "ModifierInvocation", "FunctionDefinition", "EventDefinition", "CustomErrorDefinition", "RevertStatement", "EnumValue", "EnumDefinition", "VariableDeclaration", "UserDefinedTypeName", "Mapping", "ArrayTypeName", "FunctionTypeName", "Block", "ExpressionStatement", "IfStatement", "WhileStatement", "ForStatement", "InlineAssemblyStatement", "DoWhileStatement", "ContinueStatement", "Break", "Continue", "BreakStatement", "ReturnStatement", "EmitStatement", "ThrowStatement", "VariableDeclarationStatement", "ElementaryTypeName", "FunctionCall", "AssemblyBlock", "AssemblyCall", "AssemblyLocalDefinition", "AssemblyAssignment", "AssemblyStackAssignment", "LabelDefinition", "AssemblySwitch", "AssemblyCase", "AssemblyFunctionDefinition", "AssemblyFunctionReturns", "AssemblyFor", "AssemblyIf", "SubAssembly", "TupleExpression", "NameValueExpression", "BooleanLiteral", "NumberLiteral", "Identifier", "BinaryOperation", "UnaryOperation", "NewExpression", "Conditional", "StringLiteral", "HexLiteral", "HexNumber", "DecimalNumber", "MemberAccess", "IndexAccess", "IndexRangeAccess", "NameValueList", "UncheckedStatement", "TryStatement", "CatchClause", "FileLevelConstant", "AssemblyMemberAccess", "TypeDefinition"];
export declare const astNodeTypes: readonly ["SourceUnit", "PragmaDirective", "ImportDirective", "ContractDefinition", "InheritanceSpecifier", "StateVariableDeclaration", "UsingForDeclaration", "StructDefinition", "ModifierDefinition", "ModifierInvocation", "FunctionDefinition", "EventDefinition", "CustomErrorDefinition", "RevertStatement", "EnumValue", "EnumDefinition", "VariableDeclaration", "UserDefinedTypeName", "Mapping", "ArrayTypeName", "FunctionTypeName", "Block", "ExpressionStatement", "IfStatement", "WhileStatement", "ForStatement", "InlineAssemblyStatement", "DoWhileStatement", "ContinueStatement", "Break", "Continue", "BreakStatement", "ReturnStatement", "EmitStatement", "ThrowStatement", "VariableDeclarationStatement", "ElementaryTypeName", "FunctionCall", "AssemblyBlock", "AssemblyCall", "AssemblyLocalDefinition", "AssemblyAssignment", "AssemblyStackAssignment", "LabelDefinition", "AssemblySwitch", "AssemblyCase", "AssemblyFunctionDefinition", "AssemblyFor", "AssemblyIf", "TupleExpression", "NameValueExpression", "BooleanLiteral", "NumberLiteral", "Identifier", "BinaryOperation", "UnaryOperation", "NewExpression", "Conditional", "StringLiteral", "HexLiteral", "HexNumber", "DecimalNumber", "MemberAccess", "IndexAccess", "IndexRangeAccess", "NameValueList", "UncheckedStatement", "TryStatement", "CatchClause", "FileLevelConstant", "AssemblyMemberAccess", "TypeDefinition"];
export declare type ASTNodeTypeString = typeof astNodeTypes[number];

@@ -159,3 +159,5 @@ export interface PragmaDirective extends BaseASTNode {

keyType: ElementaryTypeName | UserDefinedTypeName;
keyName: Identifier | null;
valueType: TypeName;
valueName: Identifier | null;
}

@@ -310,5 +312,2 @@ export interface FunctionTypeName extends BaseASTNode {

}
export interface AssemblyFunctionReturns extends BaseASTNode {
type: 'AssemblyFunctionReturns';
}
export interface AssemblyFor extends BaseASTNode {

@@ -327,5 +326,2 @@ type: 'AssemblyFor';

export declare type AssemblyLiteral = StringLiteral | BooleanLiteral | DecimalNumber | HexNumber | HexLiteral;
export interface SubAssembly extends BaseASTNode {
type: 'SubAssembly';
}
export interface AssemblyMemberAccess extends BaseASTNode {

@@ -426,4 +422,4 @@ type: 'AssemblyMemberAccess';

}
export declare type ASTNode = SourceUnit | PragmaDirective | ImportDirective | ContractDefinition | InheritanceSpecifier | StateVariableDeclaration | UsingForDeclaration | StructDefinition | ModifierDefinition | ModifierInvocation | FunctionDefinition | EventDefinition | CustomErrorDefinition | EnumValue | EnumDefinition | VariableDeclaration | TypeName | UserDefinedTypeName | Mapping | FunctionTypeName | Block | Statement | ElementaryTypeName | AssemblyBlock | AssemblyCall | AssemblyLocalDefinition | AssemblyAssignment | AssemblyStackAssignment | LabelDefinition | AssemblySwitch | AssemblyCase | AssemblyFunctionDefinition | AssemblyFunctionReturns | AssemblyFor | AssemblyIf | AssemblyLiteral | SubAssembly | TupleExpression | BinaryOperation | Conditional | IndexAccess | IndexRangeAccess | AssemblyItem | Expression | NameValueList | AssemblyMemberAccess | CatchClause | FileLevelConstant | TypeDefinition;
export declare type AssemblyItem = Identifier | AssemblyBlock | AssemblyExpression | AssemblyLocalDefinition | AssemblyAssignment | AssemblyStackAssignment | LabelDefinition | AssemblySwitch | AssemblyFunctionDefinition | AssemblyFor | AssemblyIf | Break | Continue | SubAssembly | NumberLiteral | StringLiteral | HexNumber | HexLiteral | DecimalNumber;
export declare type ASTNode = SourceUnit | PragmaDirective | ImportDirective | ContractDefinition | InheritanceSpecifier | StateVariableDeclaration | UsingForDeclaration | StructDefinition | ModifierDefinition | ModifierInvocation | FunctionDefinition | EventDefinition | CustomErrorDefinition | EnumValue | EnumDefinition | VariableDeclaration | TypeName | UserDefinedTypeName | Mapping | FunctionTypeName | Block | Statement | ElementaryTypeName | AssemblyBlock | AssemblyCall | AssemblyLocalDefinition | AssemblyAssignment | AssemblyStackAssignment | LabelDefinition | AssemblySwitch | AssemblyCase | AssemblyFunctionDefinition | AssemblyFor | AssemblyIf | AssemblyLiteral | TupleExpression | BinaryOperation | Conditional | IndexAccess | IndexRangeAccess | AssemblyItem | Expression | NameValueList | AssemblyMemberAccess | CatchClause | FileLevelConstant | TypeDefinition;
export declare type AssemblyItem = Identifier | AssemblyBlock | AssemblyExpression | AssemblyLocalDefinition | AssemblyAssignment | AssemblyStackAssignment | LabelDefinition | AssemblySwitch | AssemblyFunctionDefinition | AssemblyFor | AssemblyIf | Break | Continue | NumberLiteral | StringLiteral | HexNumber | HexLiteral | DecimalNumber;
export declare type AssemblyExpression = AssemblyCall | AssemblyLiteral;

@@ -430,0 +426,0 @@ export declare type Expression = IndexAccess | IndexRangeAccess | TupleExpression | BinaryOperation | Conditional | MemberAccess | FunctionCall | UnaryOperation | NewExpression | PrimaryExpression | NameValueExpression;

{
"name": "@solidity-parser/parser",
"version": "0.14.5",
"version": "0.15.0",
"description": "A Solidity parser built from a robust ANTLR 4 grammar",

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

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

import { MappingContext } from "./SolidityParser";
import { MappingKeyNameContext } from "./SolidityParser";
import { MappingValueNameContext } from "./SolidityParser";
import { FunctionTypeNameContext } from "./SolidityParser";

@@ -98,3 +100,2 @@ import { StorageLocationContext } from "./SolidityParser";

import { AssemblyLiteralContext } from "./SolidityParser";
import { SubAssemblyContext } from "./SolidityParser";
import { TupleExpressionContext } from "./SolidityParser";

@@ -554,2 +555,24 @@ import { NumberLiteralContext } from "./SolidityParser";

/**
* Enter a parse tree produced by `SolidityParser.mappingKeyName`.
* @param ctx the parse tree
*/
enterMappingKeyName?: (ctx: MappingKeyNameContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.mappingKeyName`.
* @param ctx the parse tree
*/
exitMappingKeyName?: (ctx: MappingKeyNameContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.mappingValueName`.
* @param ctx the parse tree
*/
enterMappingValueName?: (ctx: MappingValueNameContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.mappingValueName`.
* @param ctx the parse tree
*/
exitMappingValueName?: (ctx: MappingValueNameContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.functionTypeName`.

@@ -1116,13 +1139,2 @@ * @param ctx the parse tree

/**
* Enter a parse tree produced by `SolidityParser.subAssembly`.
* @param ctx the parse tree
*/
enterSubAssembly?: (ctx: SubAssemblyContext) => void;
/**
* Exit a parse tree produced by `SolidityParser.subAssembly`.
* @param ctx the parse tree
*/
exitSubAssembly?: (ctx: SubAssemblyContext) => void;
/**
* Enter a parse tree produced by `SolidityParser.tupleExpression`.

@@ -1129,0 +1141,0 @@ * @param ctx the parse tree

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

import { MappingContext } from "./SolidityParser";
import { MappingKeyNameContext } from "./SolidityParser";
import { MappingValueNameContext } from "./SolidityParser";
import { FunctionTypeNameContext } from "./SolidityParser";

@@ -98,3 +100,2 @@ import { StorageLocationContext } from "./SolidityParser";

import { AssemblyLiteralContext } from "./SolidityParser";
import { SubAssemblyContext } from "./SolidityParser";
import { TupleExpressionContext } from "./SolidityParser";

@@ -397,2 +398,16 @@ import { NumberLiteralContext } from "./SolidityParser";

/**
* Visit a parse tree produced by `SolidityParser.mappingKeyName`.
* @param ctx the parse tree
* @return the visitor result
*/
visitMappingKeyName?: (ctx: MappingKeyNameContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.mappingValueName`.
* @param ctx the parse tree
* @return the visitor result
*/
visitMappingValueName?: (ctx: MappingValueNameContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.functionTypeName`.

@@ -755,9 +770,2 @@ * @param ctx the parse tree

/**
* Visit a parse tree produced by `SolidityParser.subAssembly`.
* @param ctx the parse tree
* @return the visitor result
*/
visitSubAssembly?: (ctx: SubAssemblyContext) => Result;
/**
* Visit a parse tree produced by `SolidityParser.tupleExpression`.

@@ -764,0 +772,0 @@ * @param ctx the parse tree

@@ -95,6 +95,4 @@ // Base on the original type definitions for solidity-parser-antlr 0.2

'AssemblyFunctionDefinition',
'AssemblyFunctionReturns',
'AssemblyFor',
'AssemblyIf',
'SubAssembly',
'TupleExpression',

@@ -250,3 +248,5 @@ 'NameValueExpression',

keyType: ElementaryTypeName | UserDefinedTypeName
keyName: Identifier | null
valueType: TypeName
valueName: Identifier | null
}

@@ -402,5 +402,2 @@ export interface FunctionTypeName extends BaseASTNode {

}
export interface AssemblyFunctionReturns extends BaseASTNode {
type: 'AssemblyFunctionReturns'
}
export interface AssemblyFor extends BaseASTNode {

@@ -424,5 +421,2 @@ type: 'AssemblyFor'

| HexLiteral
export interface SubAssembly extends BaseASTNode {
type: 'SubAssembly'
}
export interface AssemblyMemberAccess extends BaseASTNode {

@@ -613,7 +607,5 @@ type: 'AssemblyMemberAccess'

| AssemblyFunctionDefinition
| AssemblyFunctionReturns
| AssemblyFor
| AssemblyIf
| AssemblyLiteral
| SubAssembly
| TupleExpression

@@ -646,3 +638,2 @@ | BinaryOperation

| Continue
| SubAssembly
| NumberLiteral

@@ -649,0 +640,0 @@ | StringLiteral

@@ -961,6 +961,17 @@ import { ParserRuleContext } from 'antlr4ts'

public visitMapping(ctx: SP.MappingContext): AST.Mapping & WithMeta {
const mappingKeyNameCtx = ctx.mappingKeyName()
const mappingValueNameCtx = ctx.mappingValueName()
const node: AST.Mapping = {
type: 'Mapping',
keyType: this.visitMappingKey(ctx.mappingKey()),
keyName:
mappingKeyNameCtx === undefined
? null
: this.visitIdentifier(mappingKeyNameCtx.identifier()),
valueType: this.visitTypeName(ctx.typeName()),
valueName:
mappingValueNameCtx === undefined
? null
: this.visitIdentifier(mappingValueNameCtx.identifier()),
}

@@ -967,0 +978,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