@solidity-parser/parser
Advanced tools
Comparing version 0.11.1 to 0.12.0
@@ -299,2 +299,3 @@ import { Token } from './types'; | ||
parts: string[]; | ||
isUnicode: boolean[]; | ||
} | ||
@@ -301,0 +302,0 @@ export interface Identifier extends BaseASTNode { |
{ | ||
"name": "@solidity-parser/parser", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"description": "A Solidity parser built from a robust ANTLR 4 grammar", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js", |
@@ -391,2 +391,3 @@ // Base on the original type definitions for solidity-parser-antlr 0.2 | ||
parts: string[] | ||
isUnicode: boolean[] | ||
} | ||
@@ -393,0 +394,0 @@ export interface Identifier extends BaseASTNode { |
@@ -546,9 +546,20 @@ import antlr4 from 'antlr4' | ||
if (ctx.identifier() && toText(ctx.identifier()) !== 'Error') { | ||
throw new Error('Expected "Error" identifier in catch clause') | ||
if ( | ||
ctx.identifier() && | ||
toText(ctx.identifier()) !== 'Error' && | ||
toText(ctx.identifier()) !== 'Panic' | ||
) { | ||
throw new Error('Expected "Error" or "Panic" identifier in catch clause') | ||
} | ||
let kind = null; | ||
if (ctx.identifier()) { | ||
kind = toText(ctx.identifier()) | ||
} | ||
return { | ||
// deprecated, use the `kind` property instead, | ||
isReasonStringType: | ||
!!ctx.identifier() && toText(ctx.identifier()) === 'Error', | ||
kind, | ||
parameters, | ||
@@ -1011,7 +1022,12 @@ body: (this as any).visit(ctx.block()), | ||
if (ctx.stringLiteral()) { | ||
const parts = ctx | ||
const fragments = ctx | ||
.stringLiteral() | ||
.StringLiteralFragment() | ||
.map((stringLiteralFragmentCtx: any) => { | ||
const text = toText(stringLiteralFragmentCtx) | ||
let text = toText(stringLiteralFragmentCtx) | ||
const isUnicode = text.slice(0, 7) === 'unicode'; | ||
if (isUnicode) { | ||
text = text.slice(7); | ||
} | ||
const singleQuotes = text[0] === "'" | ||
@@ -1023,5 +1039,7 @@ const textWithoutQuotes = text.substring(1, text.length - 1) | ||
return value | ||
return { value, isUnicode } | ||
}) | ||
const parts = fragments.map((x: any) => x.value) | ||
return { | ||
@@ -1031,2 +1049,3 @@ type: 'StringLiteral', | ||
parts, | ||
isUnicode: fragments.map((x: any) => x.isUnicode), | ||
} | ||
@@ -1291,2 +1310,3 @@ } | ||
parts: [value], | ||
isUnicode: [false] // assembly doesn't seem to support unicode literals right now | ||
} | ||
@@ -1336,2 +1356,3 @@ } | ||
parts: [value], | ||
isUnicode: [false], // assembly doesn't seem to support unicode literals right now | ||
} | ||
@@ -1338,0 +1359,0 @@ } |
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 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
6148693
63107