Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-sitter-go

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-sitter-go - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

corpus/declarations.txt

145

grammar.js

@@ -59,17 +59,16 @@ const

inline: $ => [
$._type,
$._type_identifier,
$._field_identifier,
$._package_identifier,
],
conflicts: $ => [
// A(b)
// ^-- type conversion or function call?
[$._simple_type, $._expression],
[$.qualified_identifier, $._expression],
[$.qualified_type, $._expression],
[$.func_literal, $.function_type],
[$.function_type],
// func() (a)
// ^-- parameter list or type?
[$._parameter_list, $._simple_type],
// if foo{}
// ^-- expression or type?
[$.composite_literal, $._expression]
[$.composite_literal, $._expression],
],

@@ -86,3 +85,3 @@

'package',
$.identifier
$._package_identifier
),

@@ -106,3 +105,6 @@

import_spec: $ => seq(
optional(choice($.identifier, '.')),
optional(choice(
$._package_identifier,
'.'
)),
$._string_literal

@@ -136,3 +138,3 @@ ),

const_spec: $ => seq(
$.identifier_list,
commaSep1($.identifier),
optional(seq(

@@ -158,3 +160,3 @@ optional($._type),

var_spec: $ => seq(
$.identifier_list,
commaSep1($.identifier),
choice(

@@ -180,3 +182,3 @@ seq(

$.parameters,
$.identifier,
$._field_identifier,
$.parameters,

@@ -216,22 +218,21 @@ optional(choice($.parameters, $._simple_type)),

type_spec: $ => seq($.identifier, $._type),
identifier_list: $ => seq(
$.identifier,
repeat(seq(',', $.identifier))
type_spec: $ => seq(
$._type_identifier,
$._type
),
expression_list: $ => seq(
$._expression,
repeat(seq(',', $._expression))
),
field_name_list: $ => commaSep1($._field_identifier),
expression_list: $ => commaSep1($._expression),
_type: $ => choice(
$._simple_type,
seq('(', $._type, ')')
$.parenthesized_type
),
parenthesized_type: $ => seq('(', $._type, ')'),
_simple_type: $ => choice(
$.identifier,
$.qualified_identifier,
$._type_identifier,
$.qualified_type,
$.pointer_type,

@@ -280,4 +281,13 @@ $.struct_type,

choice(
seq($.identifier_list, $._type),
seq(optional('*'), choice($.identifier, $.qualified_identifier))
seq(
commaSep1($._field_identifier),
$._type
),
seq(
optional('*'),
choice(
$._type_identifier,
$.qualified_type
)
)
),

@@ -295,4 +305,4 @@ optional($._string_literal)

_method_spec_list: $ => sepTrailing(terminator, $._method_spec_list, choice(
$.identifier,
$.qualified_identifier,
$._type_identifier,
$.qualified_type,
$.method_spec

@@ -302,3 +312,3 @@ )),

method_spec: $ => seq(
$.identifier,
$._field_identifier,
$.parameters,

@@ -408,11 +418,11 @@ optional(choice($.parameters, $._simple_type))

label_statement: $ => seq($.identifier, ':'),
label_statement: $ => seq(alias($.identifier, $.label_name), ':'),
fallthrough_statement: $ => 'fallthrough',
break_statement: $ => seq('break', optional($.identifier)),
break_statement: $ => seq('break', optional(alias($.identifier, $.label_name))),
continue_statement: $ => seq('continue', optional($.identifier)),
continue_statement: $ => seq('continue', optional(alias($.identifier, $.label_name))),
goto_statement: $ => seq('goto', $.identifier),
goto_statement: $ => seq('goto', alias($.identifier, $.label_name)),

@@ -535,2 +545,3 @@ return_statement: $ => seq('return', optional($.expression_list)),

$.identifier,
alias(choice('new', 'make'), $.identifier),
$.composite_literal,

@@ -543,26 +554,26 @@ $.func_literal,

$.rune_literal,
seq('(', $._expression, ')')
$.parenthesized_expression
),
call_expression: $ => prec(PREC.primary, seq(
parenthesized_expression: $ => seq(
'(',
$._expression,
'(',
choice(
seq(
optional($._argument_list),
optional(seq('...', optional(',')))
),
seq(
$._type,
optional(seq(
',',
$._expression,
optional(seq(
',',
$._expression
))
))
)
')'
),
call_expression: $ => prec(PREC.primary, choice(
seq(
alias(choice('new', 'make'), $.identifier),
'(',
$._type,
optional(seq(',', commaSep1($._expression))),
')'
),
')'
seq(
$._expression,
'(',
optional($._argument_list),
optional(seq('...', optional(','))),
')'
)
)),

@@ -575,3 +586,3 @@

'.',
$.identifier
$._field_identifier
)),

@@ -619,4 +630,4 @@

$.struct_type,
$.identifier,
$.qualified_identifier
$._type_identifier,
$.qualified_type
),

@@ -639,6 +650,6 @@ $.literal_value

choice(
$._expression,
$.literal_value
seq($._expression, ':'),
seq($.literal_value, ':'),
prec(1, seq($._field_identifier, ':'))
),
':',
choice(

@@ -675,7 +686,3 @@ $._expression,

qualified_identifier: $ => seq(
$.identifier,
'.',
$.identifier
),
qualified_type: $ => seq($._package_identifier, '.', $._type_identifier),

@@ -687,2 +694,6 @@ identifier: $ => token(seq(

_type_identifier: $ => alias($.identifier, $.type_identifier),
_field_identifier: $ => alias($.identifier, $.field_identifier),
_package_identifier: $ => alias($.identifier, $.package_identifier),
_string_literal: $ => choice(

@@ -689,0 +700,0 @@ $.raw_string_literal,

@@ -1,1 +0,9 @@

module.exports = require("./build/Release/tree_sitter_go_binding");
try {
module.exports = require("./build/Release/tree_sitter_go_binding");
} catch (error) {
try {
module.exports = require("./build/Debug/tree_sitter_go_binding");
} catch (_) {
throw error
}
}
{
"name": "tree-sitter-go",
"version": "0.2.0",
"version": "0.3.0",
"description": "Go grammar for tree-sitter",

@@ -16,8 +16,8 @@ "main": "index.js",

"devDependencies": {
"tree-sitter-cli": "^0.5.0"
"tree-sitter-cli": "^0.6.6"
},
"scripts": {
"build": "tree-sitter generate && node-gyp build",
"test": "tree-sitter test"
"test": "tree-sitter test && tree-sitter parse examples/* --quiet --time"
}
}

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

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