@solidity-parser/parser
Advanced tools
Comparing version 0.13.2 to 0.13.3-rc.0
@@ -11,2 +11,3 @@ import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener"; | ||
import { ImportDirectiveContext } from "./SolidityParser"; | ||
import { ImportPathContext } from "./SolidityParser"; | ||
import { ContractDefinitionContext } from "./SolidityParser"; | ||
@@ -194,2 +195,12 @@ import { InheritanceSpecifierContext } from "./SolidityParser"; | ||
/** | ||
* Enter a parse tree produced by `SolidityParser.importPath`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterImportPath?: (ctx: ImportPathContext) => void; | ||
/** | ||
* Exit a parse tree produced by `SolidityParser.importPath`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitImportPath?: (ctx: ImportPathContext) => void; | ||
/** | ||
* Enter a parse tree produced by `SolidityParser.contractDefinition`. | ||
@@ -196,0 +207,0 @@ * @param ctx the parse tree |
@@ -11,2 +11,3 @@ import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor"; | ||
import { ImportDirectiveContext } from "./SolidityParser"; | ||
import { ImportPathContext } from "./SolidityParser"; | ||
import { ContractDefinitionContext } from "./SolidityParser"; | ||
@@ -161,2 +162,8 @@ import { InheritanceSpecifierContext } from "./SolidityParser"; | ||
/** | ||
* Visit a parse tree produced by `SolidityParser.importPath`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitImportPath?: (ctx: ImportPathContext) => Result; | ||
/** | ||
* Visit a parse tree produced by `SolidityParser.contractDefinition`. | ||
@@ -163,0 +170,0 @@ * @param ctx the parse tree |
@@ -46,2 +46,3 @@ interface Location { | ||
path: string; | ||
pathLiteral: StringLiteral; | ||
unitAlias: string | null; | ||
@@ -81,3 +82,3 @@ unitAliasIdentifier: Identifier | null; | ||
override: null | UserDefinedTypeName[]; | ||
body: Block; | ||
body: Block | null; | ||
} | ||
@@ -84,0 +85,0 @@ export interface ModifierInvocation extends BaseASTNode { |
{ | ||
"name": "@solidity-parser/parser", | ||
"version": "0.13.2", | ||
"version": "0.13.3-rc.0", | ||
"description": "A Solidity parser built from a robust ANTLR 4 grammar", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -15,2 +15,3 @@ // Generated from antlr/Solidity.g4 by ANTLR 4.9.0-SNAPSHOT | ||
import { ImportDirectiveContext } from "./SolidityParser"; | ||
import { ImportPathContext } from "./SolidityParser"; | ||
import { ContractDefinitionContext } from "./SolidityParser"; | ||
@@ -209,2 +210,13 @@ import { InheritanceSpecifierContext } from "./SolidityParser"; | ||
/** | ||
* Enter a parse tree produced by `SolidityParser.importPath`. | ||
* @param ctx the parse tree | ||
*/ | ||
enterImportPath?: (ctx: ImportPathContext) => void; | ||
/** | ||
* Exit a parse tree produced by `SolidityParser.importPath`. | ||
* @param ctx the parse tree | ||
*/ | ||
exitImportPath?: (ctx: ImportPathContext) => void; | ||
/** | ||
* Enter a parse tree produced by `SolidityParser.contractDefinition`. | ||
@@ -211,0 +223,0 @@ * @param ctx the parse tree |
@@ -15,2 +15,3 @@ // Generated from antlr/Solidity.g4 by ANTLR 4.9.0-SNAPSHOT | ||
import { ImportDirectiveContext } from "./SolidityParser"; | ||
import { ImportPathContext } from "./SolidityParser"; | ||
import { ContractDefinitionContext } from "./SolidityParser"; | ||
@@ -176,2 +177,9 @@ import { InheritanceSpecifierContext } from "./SolidityParser"; | ||
/** | ||
* Visit a parse tree produced by `SolidityParser.importPath`. | ||
* @param ctx the parse tree | ||
* @return the visitor result | ||
*/ | ||
visitImportPath?: (ctx: ImportPathContext) => Result; | ||
/** | ||
* Visit a parse tree produced by `SolidityParser.contractDefinition`. | ||
@@ -178,0 +186,0 @@ * @param ctx the parse tree |
@@ -134,2 +134,3 @@ // Base on the original type definitions for solidity-parser-antlr 0.2 | ||
path: string | ||
pathLiteral: StringLiteral | ||
unitAlias: string | null | ||
@@ -169,3 +170,3 @@ unitAliasIdentifier: Identifier | null | ||
override: null | UserDefinedTypeName[] | ||
body: Block | ||
body: Block | null | ||
} | ||
@@ -172,0 +173,0 @@ export interface ModifierInvocation extends BaseASTNode { |
@@ -974,2 +974,8 @@ import { ParserRuleContext } from 'antlr4ts' | ||
let body = null | ||
const blockCtx = ctx.block() | ||
if (blockCtx !== undefined) { | ||
body = this.visitBlock(blockCtx) | ||
} | ||
const node: AST.ModifierDefinition = { | ||
@@ -979,3 +985,3 @@ type: 'ModifierDefinition', | ||
parameters, | ||
body: this.visitBlock(ctx.block()), | ||
body, | ||
isVirtual, | ||
@@ -1507,3 +1513,3 @@ override, | ||
public visitImportDirective(ctx: SP.ImportDirectiveContext) { | ||
const pathString = this._toText(ctx.StringLiteralFragment())! | ||
const pathString = this._toText(ctx.importPath()) | ||
let unitAlias = null | ||
@@ -1552,9 +1558,16 @@ let unitAliasIdentifier = null | ||
} | ||
// else if (ctx.children!.length === 5) { | ||
// unitAlias = this._toText(ctx.getChild(3)) | ||
// } | ||
const path = pathString.substring(1, pathString.length - 1) | ||
const pathLiteral: AST.StringLiteral = { | ||
type: 'StringLiteral', | ||
value: path, | ||
parts: [path], | ||
isUnicode: [false], // paths in imports don't seem to support unicode literals | ||
} | ||
const node: AST.ImportDirective = { | ||
type: 'ImportDirective', | ||
path: pathString.substring(1, pathString.length - 1), | ||
path, | ||
pathLiteral, | ||
unitAlias, | ||
@@ -1561,0 +1574,0 @@ unitAliasIdentifier, |
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 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
9169486
97524