@solidity-parser/parser
Advanced tools
Comparing version 0.10.2 to 0.11.0
@@ -11,3 +11,3 @@ import { Token } from './types'; | ||
} | ||
export declare type ASTNodeTypeString = 'SourceUnit' | 'PragmaDirective' | 'PragmaName' | 'PragmaValue' | 'ImportDirective' | 'ContractDefinition' | 'InheritanceSpecifier' | 'StateVariableDeclaration' | 'UsingForDeclaration' | 'StructDefinition' | 'ModifierDefinition' | 'ModifierInvocation' | 'FunctionDefinition' | 'EventDefinition' | 'EnumValue' | 'EnumDefinition' | 'VariableDeclaration' | 'UserDefinedTypeName' | 'Mapping' | 'ArrayTypeName' | 'FunctionTypeName' | 'StorageLocation' | 'StateMutability' | 'Block' | 'ExpressionStatement' | 'IfStatement' | 'WhileStatement' | 'ForStatement' | 'InlineAssemblyStatement' | 'DoWhileStatement' | 'ContinueStatement' | 'Break' | 'Continue' | 'BreakStatement' | 'ReturnStatement' | 'EmitStatement' | 'ThrowStatement' | 'VariableDeclarationStatement' | 'IdentifierList' | 'ElementaryTypeName' | 'FunctionCall' | 'AssemblyBlock' | 'AssemblyItem' | 'AssemblyCall' | 'AssemblyLocalDefinition' | 'AssemblyAssignment' | 'AssemblyStackAssignment' | 'LabelDefinition' | 'AssemblySwitch' | 'AssemblyCase' | 'AssemblyFunctionDefinition' | 'AssemblyFunctionReturns' | 'AssemblyFor' | 'AssemblyIf' | 'AssemblyLiteral' | 'SubAssembly' | 'TupleExpression' | 'TypeNameExpression' | 'NameValueExpression' | 'BooleanLiteral' | 'NumberLiteral' | 'Identifier' | 'BinaryOperation' | 'UnaryOperation' | 'NewExpression' | 'Conditional' | 'StringLiteral' | 'HexLiteral' | 'HexNumber' | 'DecimalNumber' | 'MemberAccess' | 'IndexAccess' | 'IndexRangeAccess' | 'NameValueList'; | ||
export declare type ASTNodeTypeString = 'SourceUnit' | 'PragmaDirective' | 'PragmaName' | 'PragmaValue' | 'ImportDirective' | 'ContractDefinition' | 'InheritanceSpecifier' | 'StateVariableDeclaration' | 'UsingForDeclaration' | 'StructDefinition' | 'ModifierDefinition' | 'ModifierInvocation' | 'FunctionDefinition' | 'EventDefinition' | 'EnumValue' | 'EnumDefinition' | 'VariableDeclaration' | 'UserDefinedTypeName' | 'Mapping' | 'ArrayTypeName' | 'FunctionTypeName' | 'StorageLocation' | 'StateMutability' | 'Block' | 'ExpressionStatement' | 'IfStatement' | 'WhileStatement' | 'ForStatement' | 'InlineAssemblyStatement' | 'DoWhileStatement' | 'ContinueStatement' | 'Break' | 'Continue' | 'BreakStatement' | 'ReturnStatement' | 'EmitStatement' | 'ThrowStatement' | 'VariableDeclarationStatement' | 'IdentifierList' | 'ElementaryTypeName' | 'FunctionCall' | 'AssemblyBlock' | 'AssemblyItem' | 'AssemblyCall' | 'AssemblyLocalDefinition' | 'AssemblyAssignment' | 'AssemblyStackAssignment' | 'LabelDefinition' | 'AssemblySwitch' | 'AssemblyCase' | 'AssemblyFunctionDefinition' | 'AssemblyFunctionReturns' | 'AssemblyFor' | 'AssemblyIf' | 'AssemblyLiteral' | 'SubAssembly' | 'TupleExpression' | 'TypeNameExpression' | 'NameValueExpression' | 'BooleanLiteral' | 'NumberLiteral' | 'Identifier' | 'BinaryOperation' | 'UnaryOperation' | 'NewExpression' | 'Conditional' | 'StringLiteral' | 'HexLiteral' | 'HexNumber' | 'DecimalNumber' | 'MemberAccess' | 'IndexAccess' | 'IndexRangeAccess' | 'NameValueList' | 'UncheckedStatement'; | ||
export interface BaseASTNode { | ||
@@ -152,2 +152,6 @@ type: ASTNodeTypeString; | ||
} | ||
export interface UncheckedStatement extends BaseASTNode { | ||
type: 'UncheckedStatement'; | ||
block: Block; | ||
} | ||
export interface WhileStatement extends BaseASTNode { | ||
@@ -351,3 +355,3 @@ type: 'WhileStatement'; | ||
} | ||
export declare type ASTNode = SourceUnit | PragmaDirective | ImportDirective | ContractDefinition | InheritanceSpecifier | StateVariableDeclaration | UsingForDeclaration | StructDefinition | ModifierDefinition | ModifierInvocation | FunctionDefinition | EventDefinition | EnumValue | EnumDefinition | VariableDeclaration | TypeName | UserDefinedTypeName | Mapping | FunctionTypeName | Block | ExpressionStatement | IfStatement | WhileStatement | ForStatement | InlineAssemblyStatement | DoWhileStatement | ContinueStatement | BreakStatement | ReturnStatement | EmitStatement | ThrowStatement | VariableDeclarationStatement | ElementaryTypeName | AssemblyBlock | AssemblyCall | AssemblyLocalDefinition | AssemblyAssignment | AssemblyStackAssignment | LabelDefinition | AssemblySwitch | AssemblyCase | AssemblyFunctionDefinition | AssemblyFunctionReturns | AssemblyFor | AssemblyIf | AssemblyLiteral | SubAssembly | TupleExpression | TypeNameExpression | BinaryOperation | Conditional | IndexAccess | IndexRangeAccess | AssemblyItem | Expression; | ||
export declare type ASTNode = SourceUnit | PragmaDirective | ImportDirective | ContractDefinition | InheritanceSpecifier | StateVariableDeclaration | UsingForDeclaration | StructDefinition | ModifierDefinition | ModifierInvocation | FunctionDefinition | EventDefinition | 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 | TypeNameExpression | BinaryOperation | Conditional | IndexAccess | IndexRangeAccess | AssemblyItem | Expression; | ||
export declare type AssemblyItem = Identifier | AssemblyBlock | AssemblyExpression | AssemblyLocalDefinition | AssemblyAssignment | AssemblyStackAssignment | LabelDefinition | AssemblySwitch | AssemblyFunctionDefinition | AssemblyFor | AssemblyIf | Break | Continue | SubAssembly | NumberLiteral | StringLiteral | HexNumber | HexLiteral | DecimalNumber; | ||
@@ -359,2 +363,2 @@ export declare type AssemblyExpression = AssemblyCall | AssemblyLiteral; | ||
export declare type TypeName = ElementaryTypeName | UserDefinedTypeName | Mapping | ArrayTypeName | FunctionTypeName; | ||
export declare type Statement = IfStatement | WhileStatement | ForStatement | Block | InlineAssemblyStatement | DoWhileStatement | ContinueStatement | BreakStatement | ReturnStatement | EmitStatement | ThrowStatement | SimpleStatement | VariableDeclarationStatement; | ||
export declare type Statement = IfStatement | WhileStatement | ForStatement | Block | InlineAssemblyStatement | DoWhileStatement | ContinueStatement | BreakStatement | ReturnStatement | EmitStatement | ThrowStatement | SimpleStatement | VariableDeclarationStatement | UncheckedStatement; |
@@ -110,2 +110,3 @@ declare const SolidityLexer_base: any; | ||
const T__93: number; | ||
const T__94: number; | ||
const Int: number; | ||
@@ -112,0 +113,0 @@ const Uint: number; |
@@ -98,2 +98,4 @@ declare const SolidityListener_base: any; | ||
exitSimpleStatement(ctx: any): void; | ||
enterUncheckedStatement(ctx: any): void; | ||
exitUncheckedStatement(ctx: any): void; | ||
enterForStatement(ctx: any): void; | ||
@@ -100,0 +102,0 @@ exitForStatement(ctx: any): void; |
@@ -65,2 +65,3 @@ declare const SolidityParser_base: any; | ||
simpleStatement(): SimpleStatementContext; | ||
uncheckedStatement(): UncheckedStatementContext; | ||
forStatement(): ForStatementContext; | ||
@@ -208,2 +209,3 @@ inlineAssemblyStatement(): InlineAssemblyStatementContext; | ||
export const T__93: number; | ||
export const T__94: number; | ||
export const Int: number; | ||
@@ -292,2 +294,3 @@ export const Uint: number; | ||
export const RULE_simpleStatement: number; | ||
export const RULE_uncheckedStatement: number; | ||
export const RULE_forStatement: number; | ||
@@ -385,2 +388,3 @@ export const RULE_inlineAssemblyStatement: number; | ||
export { SimpleStatementContext }; | ||
export { UncheckedStatementContext }; | ||
export { ForStatementContext }; | ||
@@ -928,2 +932,3 @@ export { InlineAssemblyStatementContext }; | ||
simpleStatement(): any; | ||
uncheckedStatement(): any; | ||
enterRule(listener: any): void; | ||
@@ -1000,2 +1005,12 @@ exitRule(listener: any): void; | ||
} | ||
declare const UncheckedStatementContext_base: any; | ||
declare class UncheckedStatementContext extends UncheckedStatementContext_base { | ||
[x: string]: any; | ||
constructor(parser: any, parent: any, invokingState: any); | ||
parser: any; | ||
ruleIndex: number; | ||
block(): any; | ||
enterRule(listener: any): void; | ||
exitRule(listener: any): void; | ||
} | ||
declare const ForStatementContext_base: any; | ||
@@ -1002,0 +1017,0 @@ declare class ForStatementContext extends ForStatementContext_base { |
{ | ||
"name": "@solidity-parser/parser", | ||
"version": "0.10.2", | ||
"version": "0.11.0", | ||
"description": "A Solidity parser built from a robust ANTLR 4 grammar", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -94,2 +94,3 @@ // Base on the original type definitions for solidity-parser-antlr 0.2 | ||
| 'NameValueList' | ||
| 'UncheckedStatement' | ||
export interface BaseASTNode { | ||
@@ -234,2 +235,6 @@ type: ASTNodeTypeString | ||
} | ||
export interface UncheckedStatement extends BaseASTNode { | ||
type: 'UncheckedStatement' | ||
block: Block | ||
} | ||
export interface WhileStatement extends BaseASTNode { | ||
@@ -493,14 +498,3 @@ type: 'WhileStatement' | ||
| Block | ||
| ExpressionStatement | ||
| IfStatement | ||
| WhileStatement | ||
| ForStatement | ||
| InlineAssemblyStatement | ||
| DoWhileStatement | ||
| ContinueStatement | ||
| BreakStatement | ||
| ReturnStatement | ||
| EmitStatement | ||
| ThrowStatement | ||
| VariableDeclarationStatement | ||
| Statement | ||
| ElementaryTypeName | ||
@@ -589,1 +583,2 @@ | AssemblyBlock | ||
| VariableDeclarationStatement | ||
| UncheckedStatement |
@@ -263,6 +263,5 @@ import antlr4 from 'antlr4' | ||
case 'function': | ||
name = | ||
ctx.functionDescriptor().identifier(0) | ||
? toText(ctx.functionDescriptor().identifier(0)) | ||
: '' | ||
name = ctx.functionDescriptor().identifier(0) | ||
? toText(ctx.functionDescriptor().identifier(0)) | ||
: '' | ||
@@ -654,2 +653,8 @@ parameters = (this as any).visit(ctx.parameterList()) | ||
UncheckedStatement(ctx: Ctx) { | ||
return { | ||
block: (this as any).visit(ctx.block()), | ||
} | ||
}, | ||
Expression(ctx: Ctx): ASTTypes.Expression { | ||
@@ -1394,6 +1399,5 @@ let op | ||
let returnArgs = ctx.assemblyFunctionReturns() | ||
returnArgs = | ||
returnArgs | ||
? (this as any).visit(returnArgs.assemblyIdentifierList().identifier()) | ||
: [] | ||
returnArgs = returnArgs | ||
? (this as any).visit(returnArgs.assemblyIdentifierList().identifier()) | ||
: [] | ||
@@ -1400,0 +1404,0 @@ return { |
@@ -431,2 +431,11 @@ // Generated from antlr/Solidity.g4 by ANTLR 4.9 | ||
// Enter a parse tree produced by SolidityParser#uncheckedStatement. | ||
enterUncheckedStatement(ctx) { | ||
} | ||
// Exit a parse tree produced by SolidityParser#uncheckedStatement. | ||
exitUncheckedStatement(ctx) { | ||
} | ||
// Enter a parse tree produced by SolidityParser#forStatement. | ||
@@ -433,0 +442,0 @@ enterForStatement(ctx) { |
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 not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6136326
63024