New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tree-sitter-solidity

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-sitter-solidity - npm Package Compare versions

Comparing version 1.2.2 to 1.2.6

binding.gyp

186

grammar.js
// Precedence is used by the parser to determine which rule to apply when there are two rules that can be applied.
// We use the PREC dict to globally define rule pprecidence
// We use the PREC dict to globally define rule precedence
const PREC = {

@@ -56,3 +56,3 @@ COMMENT: 1,

[$.variable_declaration_tuple, $.tuple_expression],
[$._yul_expression, $.yul_assignment],

@@ -76,3 +76,3 @@ // Ambiguity: identifier ':'

$._declaration,
),
),

@@ -151,3 +151,3 @@ // -- [ Directives ] --

),
_import_alias: $ => seq("as", field("alias", $.identifier)),

@@ -166,2 +166,3 @@

$.user_defined_type_definition,
$.event_definition,
),

@@ -171,5 +172,5 @@

'type',
field("name", $.identifier),
'is',
$.primitive_type,
field("name", $.identifier),
'is',
$.primitive_type,
$._semicolon

@@ -183,3 +184,3 @@ ),

'=',
field("value", $._expression),
field("value", $.expression),
$._semicolon

@@ -198,4 +199,4 @@ ),

error_declaration: $ => seq(
'error',
field("name", $.identifier),
'error',
field("name", $.identifier),
'(', commaSep($.error_parameter), ')',

@@ -206,3 +207,3 @@ $._semicolon

error_parameter: $ => seq(
field("type", $.type_name),
field("type", $.type_name),
field("name", optional($.identifier)),

@@ -236,3 +237,3 @@ ),

"{",
repeat($._contract_member),
repeat($._contract_member),
"}",

@@ -258,5 +259,3 @@ ),

field("name", $.identifier),
'{',
repeat1($.struct_member),
'}',
field('body', $.struct_body),
),

@@ -270,5 +269,15 @@

struct_body: $ => seq(
'{',
repeat1($.struct_member),
'}',
),
enum_declaration: $ => seq(
'enum',
field("name", $.identifier),
field('body', $.enum_body),
),
enum_body: $ => seq(
'{',

@@ -279,8 +288,7 @@ commaSep(alias($.identifier, $.enum_value)),

event_definition: $ => seq(
'event',
'event',
field('name', $.identifier),
$._event_parameter_list ,
optional('anonymous'),
optional('anonymous'),
$._semicolon

@@ -291,7 +299,7 @@ ),

"(",
commaSep($.event_paramater),
commaSep($.event_parameter),
")"
),
event_paramater: $ => seq(
event_parameter: $ => seq(
field("type", $.type_name),

@@ -357,3 +365,3 @@ optional("indexed"),

),
yul_label: $ => seq($.identifier, ":"),

@@ -450,2 +458,5 @@ yul_leave: $ => "leave",

'mload',
'mcopy',
'tload',
'tstore',
'mstore',

@@ -489,2 +500,5 @@ 'mstore8',

'blockhash',
'blobhash',
'basefee',
'blobfee',
'coinbase',

@@ -500,5 +514,5 @@ 'timestamp',

block_statement: $ => seq(
optional($.unchecked),
'{',
repeat($._statement),
optional($.unchecked),
'{',
repeat($._statement),
"}"

@@ -508,4 +522,4 @@ ),

choice(
seq($.variable_declaration, optional(seq('=', field("value", $._expression)))),
seq($.variable_declaration_tuple, '=', field("value", $._expression)),
seq($.variable_declaration, optional(seq('=', field("value", $.expression)))),
seq($.variable_declaration_tuple, '=', field("value", $.expression)),
),

@@ -534,9 +548,9 @@ $._semicolon

expression_statement: $ => seq($._expression, $._semicolon),
expression_statement: $ => seq($.expression, $._semicolon),
if_statement: $ => prec.right(seq(
'if', '(',
field("condition", $._expression),
')',
field("body", $._statement),
field("condition", $.expression),
')',
field("body", $._statement),
field("else",

@@ -555,3 +569,3 @@ optional(

field("condition", choice($.expression_statement, $._semicolon)),
field("update", optional($._expression)),
field("update", optional($.expression)),
')', field("body", $._statement),

@@ -561,13 +575,13 @@ ),

while_statement: $ => seq(
'while', '(',field("condition", $._expression), ')', field("body", $._statement),
'while', '(',field("condition", $.expression), ')', field("body", $._statement),
),
do_while_statement: $ => seq(
'do', field("body", $._statement), 'while', '(', field("condition", $._expression), ')', $._semicolon,
'do', field("body", $._statement), 'while', '(', field("condition", $.expression), ')', $._semicolon,
),
continue_statement: $ => seq('continue', $._semicolon),
break_statement: $ => seq('break', $._semicolon),
revert_statement: $ => prec(PREC.REVERT, seq(
'revert',
optional(field("error", $._expression)),
optional(field("error", $.expression)),
optional(alias($._call_arguments, $.revert_arguments)),

@@ -578,6 +592,6 @@ $._semicolon

try_statement: $ => seq(
'try',
field("attempt", $._expression),
optional(seq('returns', $._parameter_list)),
field("body", $.block_statement),
'try',
field("attempt", $.expression),
optional(seq('returns', $._parameter_list)),
field("body", $.block_statement),
repeat1($.catch_clause),

@@ -587,4 +601,4 @@ ),

catch_clause: $ => seq(
'catch',
optional(seq(optional($.identifier), $._parameter_list)),
'catch',
optional(seq(optional($.identifier), $._parameter_list)),
field("body", $.block_statement),

@@ -594,4 +608,4 @@ ),

return_statement: $ => seq(
'return',
optional($._expression),
'return',
optional($.expression),
$._semicolon

@@ -601,5 +615,5 @@ ),

emit_statement: $ => seq(
'emit',
field("name", $._expression),
$._call_arguments,
'emit',
field("name", $.expression),
$._call_arguments,
$._semicolon

@@ -622,3 +636,3 @@ ),

optional(seq(
'=', field("value", $._expression)
'=', field("value", $.expression)
)),

@@ -726,9 +740,9 @@ $._semicolon

call_argument: $ => choice(
$._expression,
$.expression,
seq("{", commaSep($.call_struct_argument), "}"),
),
call_struct_argument: $ => seq(
field("name", $.identifier),
":",
field("value", $._expression)
field("name", $.identifier),
":",
field("value", $.expression)
),

@@ -743,3 +757,3 @@

// Expressions
_expression: $ => choice(
expression: $ => choice(
$.binary_expression,

@@ -777,3 +791,3 @@ $.unary_expression,

ternary_expression: $ => prec.left(seq($._expression, "?", $._expression, ':', $._expression)),
ternary_expression: $ => prec.left(seq($.expression, "?", $.expression, ':', $.expression)),

@@ -783,5 +797,5 @@ // TODO: make sure call arguments are part of solidity

tuple_expression: $ => prec(1, seq('(', commaSep(optional($._expression)), ')' )),
tuple_expression: $ => prec(1, seq('(', commaSep(optional($.expression)), ')' )),
inline_array_expression: $ => seq('[', commaSep($._expression), ']' ),
inline_array_expression: $ => seq('[', commaSep($.expression), ']' ),

@@ -813,5 +827,5 @@ binary_expression: $ => choice(

prec.left(precedence, seq(
field('left', $._expression),
field('left', $.expression),
field('operator', operator),
field('right', $._expression)
field('right', $.expression)
))

@@ -830,3 +844,3 @@ )

field('operator', operator),
field('argument', $._expression)
field('argument', $.expression)
))

@@ -837,3 +851,3 @@ )),

seq(
field('argument', $._expression),
field('argument', $.expression),
field('operator', choice('++', '--'))

@@ -843,3 +857,3 @@ ),

field('operator', choice('++', '--')),
field('argument', $._expression)
field('argument', $.expression)
),

@@ -850,3 +864,3 @@ )),

field('object', choice(
$._expression,
$.expression,
$.identifier,

@@ -859,5 +873,5 @@ )),

array_access: $ => seq(
field('base', $._expression),
field('base', $.expression),
'[',
optional(field('index', $._expression)),
optional(field('index', $.expression)),
']'

@@ -867,7 +881,7 @@ ),

slice_access: $ => seq(
field('base', $._expression),
field('base', $.expression),
'[',
optional(field('from', $._expression)),
optional(field('from', $.expression)),
':',
optional(field('to', $._expression)),
optional(field('to', $.expression)),
']'

@@ -877,3 +891,3 @@ ),

struct_expression: $ => seq(
field("type", $._expression),
field("type", $.expression),
"{",

@@ -887,22 +901,22 @@ commaSep($.struct_field_assignment),

":",
field("value", $._expression),
field("value", $.expression),
),
parenthesized_expression: $ => prec(2, seq('(', $._expression, ')')),
parenthesized_expression: $ => prec(2, seq('(', $.expression, ')')),
assignment_expression: $ => prec.right(PREC.ASSIGN, seq(
field('left', $._expression),
field('left', $.expression),
'=',
field('right', $._expression)
field('right', $.expression)
)),
augmented_assignment_expression: $ => prec.right(PREC.ASSIGN, seq(
field('left', $._expression),
field('left', $.expression),
choice('+=', '-=', '*=', '/=', '%=', '^=', '&=', '|=', '>>=', '>>>=',
'<<=',),
field('right', $._expression)
field('right', $.expression)
)),
call_expression: $ => prec.right(PREC.CALL, seq(
field("function", $._expression),
field("function", $.expression),
$._call_arguments

@@ -922,7 +936,7 @@ )),

_array_type: $ => prec(1, seq($.type_name, '[', optional($._expression), ']')),
_array_type: $ => prec(1, seq($.type_name, '[', optional($.expression), ']')),
_function_type: $ => prec.right(seq(
'function',
field("parameters", $._parameter_list),
'function',
field("parameters", $._parameter_list),
repeat(choice(

@@ -960,12 +974,12 @@ $.visibility,

user_defined_type: $ => $._identifier_path,
user_defined_type: $ => $._identifier_path,
_identifier_path: $ => prec.left(dotSep1( $.identifier)),
_mapping: $ => seq(
'mapping', '(',
field("key_type", $._mapping_key),
'mapping', '(',
field("key_type", $._mapping_key),
optional(field('key_identifier', $.identifier)),
'=>',
field("value_type", $.type_name),
'=>',
field("value_type", $.type_name),
optional(field('value_identifier', $.identifier)),

@@ -1040,3 +1054,3 @@ ')',

boolean_literal: $ => choice($.true, $.false),
hex_string_literal: $ => prec.left(repeat1(seq(

@@ -1059,5 +1073,5 @@ 'hex',

)),
_single_quoted_unicode_char: $ =>
_single_quoted_unicode_char: $ =>
token.immediate(prec(PREC.STRING, /[^'\\\n]+|\\\r?\n/)),
_double_quoted_unicode_char: $ =>
_double_quoted_unicode_char: $ =>
token.immediate(prec(PREC.STRING, /[^"\\\n]+|\\\r?\n/)),

@@ -1064,0 +1078,0 @@ unicode_string_literal: $ => prec.left(repeat1(seq(

{
"name": "tree-sitter-solidity",
"version": "1.2.2",
"version": "1.2.6",
"description": "A tree sitter parser for Solidity",
"main": "bindings/node",
"types": "bindings/node",
"scripts": {
"test": "tree-sitter generate && tree-sitter test"
"test": "tree-sitter generate && tree-sitter test",
"install": "node-gyp-build",
"prebuildify": "prebuildify --napi --strip"
},

@@ -12,7 +15,17 @@ "author": "Joran Honig",

"dependencies": {
"nan": "^2.15.0",
"yarn": "^1.22.21"
"yarn": "^1.22.21",
"node-addon-api": "^7.1.0",
"node-gyp-build": "^4.8.0"
},
"peerDependencies": {
"tree-sitter": "^0.21.0"
},
"peerDependenciesMeta": {
"tree_sitter": {
"optional": true
}
},
"devDependencies": {
"tree-sitter-cli": "^0.21"
"tree-sitter-cli": "^0.22.4",
"prebuildify": "^6.0.0"
},

@@ -30,3 +43,11 @@ "tree-sitter": [

}
],
"files": [
"grammar.js",
"binding.gyp",
"prebuilds/**",
"bindings/node/*",
"queries/*",
"src/**"
]
}

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

Sorry, the diff of this file is not supported yet

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