summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilfred Hughes <me@wilfred.me.uk>2023-08-08 23:00:30 -0700
committerWilfred Hughes <me@wilfred.me.uk>2023-08-08 23:01:48 -0700
commitdb8797d6c20b7148e3ce79705adb1ac97f24b913 (patch)
tree396185ae9c996863158d70bf214918787c25fdef
parenta187d7a1341847a66e3b5139d359d5a5254e5438 (diff)
parent7aa24fe8616072fc1a659f72d5b60bd8c01fb5cc (diff)
-rw-r--r--CHANGELOG.md4
-rw-r--r--vendored_parsers/tree-sitter-erlang/CHANGELOG.md7
-rw-r--r--vendored_parsers/tree-sitter-erlang/Cargo.toml6
-rw-r--r--vendored_parsers/tree-sitter-erlang/Makefile6
-rw-r--r--vendored_parsers/tree-sitter-erlang/bindings/node/index.js16
-rw-r--r--vendored_parsers/tree-sitter-erlang/bindings/rust/build.rs16
-rw-r--r--vendored_parsers/tree-sitter-erlang/bindings/rust/lib.rs16
-rw-r--r--vendored_parsers/tree-sitter-erlang/grammar.js92
-rw-r--r--vendored_parsers/tree-sitter-erlang/package-lock.json39
-rw-r--r--vendored_parsers/tree-sitter-erlang/package.json18
-rw-r--r--vendored_parsers/tree-sitter-erlang/queries/highlights.scm228
-rw-r--r--vendored_parsers/tree-sitter-erlang/src/grammar.json489
-rw-r--r--vendored_parsers/tree-sitter-erlang/src/node-types.json320
-rw-r--r--vendored_parsers/tree-sitter-erlang/src/parser.c55192
-rw-r--r--vendored_parsers/tree-sitter-erlang/test/corpus/attributes.txt155
-rw-r--r--vendored_parsers/tree-sitter-erlang/test/corpus/expr.txt323
-rw-r--r--vendored_parsers/tree-sitter-erlang/test/highlight/attributes.erl189
-rw-r--r--vendored_parsers/tree-sitter-erlang/test/highlight/compile.erl2183
-rw-r--r--vendored_parsers/tree-sitter-erlang/test/highlight/expressions.erl32
19 files changed, 34431 insertions, 24900 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56e85b9d6..d5f72a2dc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
## 0.50 (unreleased)
+### Parsing
+
+Updated Erlang parser.
+
### Display
Tweaked the colours on the file header, to make metadata less
diff --git a/vendored_parsers/tree-sitter-erlang/CHANGELOG.md b/vendored_parsers/tree-sitter-erlang/CHANGELOG.md
index b944da393..3beac6563 100644
--- a/vendored_parsers/tree-sitter-erlang/CHANGELOG.md
+++ b/vendored_parsers/tree-sitter-erlang/CHANGELOG.md
@@ -1,3 +1,8 @@
-1.0.0 (September 26, 2022)
+0.1.0 (June 16, 2023)
+* Add support for OTP 26 constructs
+ * maybe
+ * map comprehension
+
+0.0.1 (September 26, 2022)
* Initial Release
diff --git a/vendored_parsers/tree-sitter-erlang/Cargo.toml b/vendored_parsers/tree-sitter-erlang/Cargo.toml
index 85a22ff41..298767147 100644
--- a/vendored_parsers/tree-sitter-erlang/Cargo.toml
+++ b/vendored_parsers/tree-sitter-erlang/Cargo.toml
@@ -5,7 +5,7 @@ edition = "2018"
keywords = ["incremental", "parsing", "erlang"]
license = "MIT"
name = "tree-sitter-erlang"
-version = "0.0.1"
+version = "0.1.0"
build = "bindings/rust/build.rs"
include = [
@@ -19,7 +19,7 @@ include = [
path = "bindings/rust/lib.rs"
[dependencies]
-tree-sitter = "0.20.9"
+tree-sitter = "0.20.10"
[build-dependencies]
-cc = "1.0.73"
+cc = "1.0.79"
diff --git a/vendored_parsers/tree-sitter-erlang/Makefile b/vendored_parsers/tree-sitter-erlang/Makefile
index 4789a50a4..4e2f9527e 100644
--- a/vendored_parsers/tree-sitter-erlang/Makefile
+++ b/vendored_parsers/tree-sitter-erlang/Makefile
@@ -10,6 +10,12 @@ fmt:
test: gen
$(TREE_SITTER) test
+.PHONY: test-highlight
+test-highlight:
+ # Note: test-highlight uses a filter for non-existent corpus
+ # tests, so only highlights run. And does not gen.
+ $(TREE_SITTER) test-highlight
+
.PHONY: update
update: gen
$(TREE_SITTER) test -- --update
diff --git a/vendored_parsers/tree-sitter-erlang/bindings/node/index.js b/vendored_parsers/tree-sitter-erlang/bindings/node/index.js
index c7b4885d8..71f2055e6 100644
--- a/vendored_parsers/tree-sitter-erlang/bindings/node/index.js
+++ b/vendored_parsers/tree-sitter-erlang/bindings/node/index.js
@@ -1,3 +1,19 @@
+/**
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
try {
module.exports = require("../../build/Release/tree_sitter_erlang_binding");
} catch (error1) {
diff --git a/vendored_parsers/tree-sitter-erlang/bindings/rust/build.rs b/vendored_parsers/tree-sitter-erlang/bindings/rust/build.rs
index 5b5cdebd7..ea165b2b1 100644
--- a/vendored_parsers/tree-sitter-erlang/bindings/rust/build.rs
+++ b/vendored_parsers/tree-sitter-erlang/bindings/rust/build.rs
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// Note: If this file does not exist, it is generated by `tree-sitter generate`.
fn main() {
diff --git a/vendored_parsers/tree-sitter-erlang/bindings/rust/lib.rs b/vendored_parsers/tree-sitter-erlang/bindings/rust/lib.rs
index 629ccbd00..4add90eac 100644
--- a/vendored_parsers/tree-sitter-erlang/bindings/rust/lib.rs
+++ b/vendored_parsers/tree-sitter-erlang/bindings/rust/lib.rs
@@ -1,3 +1,19 @@
+/*
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// Note: If this file does not exist, it is generated by `tree-sitter generate`.
//! This crate provides erlang language support for the [tree-sitter][] parsing library.
diff --git a/vendored_parsers/tree-sitter-erlang/grammar.js b/vendored_parsers/tree-sitter-erlang/grammar.js
index c3886e582..a1f952492 100644
--- a/vendored_parsers/tree-sitter-erlang/grammar.js
+++ b/vendored_parsers/tree-sitter-erlang/grammar.js
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) Facebook, Inc. and its affiliates.
+/**
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,8 @@ const PREC = {
REMOTE: 1,
BIT_EXPR: 2,
+ COND_MATCH: 81, // `?=` in maybe expr. Should has lowest priority https://www.erlang.org/eeps/eep-0049#operator-priority
+
// In macro def, prefer expressions, if type and expr would parse
DYN_CR_CLAUSES: 1,
DYN_FUNCTION_CLAUSES: 2,
@@ -101,6 +103,10 @@ module.exports = grammar({
$._expr,
$._expr_max,
$._catch_pat,
+ $._deprecated_details,
+ $._deprecated_fun_arity,
+ $._desc,
+ $._string_like
],
@@ -140,6 +146,7 @@ module.exports = grammar({
$.optional_callbacks_attribute,
$.compile_options_attribute,
$.file_attribute,
+ $.deprecated_attribute,
$.record_decl,
$.type_alias,
$.opaque,
@@ -263,6 +270,58 @@ module.exports = grammar({
field("original_line", $.integer),
')', '.'),
+ deprecated_attribute: $ => seq(
+ '-',
+ atom_const('deprecated'),
+ '(',
+ field("attr", $._deprecated_details),
+ ')',
+ '.'
+ ),
+
+ _deprecated_details: $ => choice(
+ $.deprecated_module,
+ $.deprecated_fa,
+ $.deprecated_fas,
+ ),
+
+ deprecated_module: $ => field("module", $.atom),
+
+ deprecated_fas: $ => seq(
+ '[',
+ sepBy1(',', field("fa", $.deprecated_fa)),
+ ']',
+ ),
+ deprecated_fa: $ => seq(
+ '{',
+ field("fun", $.atom),
+ ',',
+ field("arity", $._deprecated_fun_arity),
+ field("desc", optional($.deprecation_desc)),
+ '}',
+ ),
+
+ deprecation_desc: $ => seq(',', field("desc", $._desc)),
+
+ _desc: $ => choice(
+ field("atom", $.atom),
+ field("comment", $.multi_string),
+ ),
+
+ multi_string: $ => prec.right(field("elems", repeat1($._string_like))),
+
+ _string_like: $ => choice(
+ $.string,
+ $._macro_body_expr
+ ),
+
+ _deprecated_fun_arity: $ => choice(
+ $.integer,
+ $.deprecated_wildcard,
+ ),
+
+ deprecated_wildcard: $ => "'_'",
+
type_alias: $ => seq('-', atom_const('type'), $._type_def, '.'),
opaque: $ => seq('-', atom_const('opaque'), $._type_def, '.'),
@@ -367,6 +426,7 @@ module.exports = grammar({
$._record_expr,
$.remote,
$._expr_max,
+ $.cond_match_expr,
),
dotdotdot: $ => '...',
@@ -379,6 +439,12 @@ module.exports = grammar({
'=',
field("rhs", prec.right($._expr)),
)),
+ cond_match_expr: $ =>
+ prec.right(PREC.COND_MATCH, seq(
+ field("lhs", $._expr),
+ '?=',
+ field("rhs", prec.right($._expr)),
+ )),
binary_op_expr: $ => choice(
prec.right(PREC.BANG, seq(
field("lhs", $._expr),
@@ -435,6 +501,7 @@ module.exports = grammar({
$.binary,
$.list_comprehension,
$.binary_comprehension,
+ $.map_comprehension,
$.tuple,
$.paren_expr,
$.block_expr,
@@ -443,6 +510,7 @@ module.exports = grammar({
$.receive_expr,
$._fun_expr,
$.try_expr,
+ $.maybe_expr,
),
remote: $ => prec.right(PREC.REMOTE, seq(field("module", $.remote_module), field("fun", $._expr_max))),
@@ -512,6 +580,13 @@ module.exports = grammar({
field("lc_exprs", $.lc_exprs),
'>>'
),
+ map_comprehension: $ => seq(
+ '#',
+ '{',
+ field("expr", $.map_field),
+ field("lc_exprs", $.lc_exprs),
+ '}',
+ ),
lc_exprs: $ => seq('||', sepBy1(',', field("exprs", $._lc_expr))),
@@ -519,6 +594,7 @@ module.exports = grammar({
$._expr,
$.generator,
$.b_generator,
+ $.map_generator,
),
generator: $ => seq(
@@ -531,6 +607,11 @@ module.exports = grammar({
'<=',
field("rhs", $._expr),
),
+ map_generator: $ => seq(
+ field("lhs", $.map_field),
+ '<-',
+ field("rhs", $._expr),
+ ),
tuple: $ => seq(
'{',
@@ -793,6 +874,13 @@ module.exports = grammar({
)),
),
+ maybe_expr: $ => choice(
+ seq('maybe', sepBy1(',', field("exprs", $._expr)), 'end'),
+ seq('maybe', sepBy1(',', field("exprs", $._expr)), $._maybe_else_clause),
+ ),
+
+ _maybe_else_clause: $ => seq('else', optional($._cr_clauses), 'end'),
+
_macro_def_replacement: $ => choice(
prec.dynamic(PREC.DYN_EXPR, $._expr),
prec.dynamic(PREC.DYN_FUNCTION_CLAUSES, $.replacement_function_clauses),
diff --git a/vendored_parsers/tree-sitter-erlang/package-lock.json b/vendored_parsers/tree-sitter-erlang/package-lock.json
index 9a3e9e2c6..17aee298c 100644
--- a/vendored_parsers/tree-sitter-erlang/package-lock.json
+++ b/vendored_parsers/tree-sitter-erlang/package-lock.json
@@ -1,7 +1,7 @@
{
"name": "tree-sitter-erlang",
"version": "0.0.0",
- "lockfileVersion": 2,
+ "lockfileVersion": 3,
"requires": true,
"packages": {
"": {
@@ -11,18 +11,18 @@
"dependencies": {
"nan": "^2.14.1",
"prettier": "^2.2.1",
- "tree-sitter-cli": "^0.20.7"
+ "tree-sitter-cli": "^0.20.8"
}
},
"node_modules/nan": {
- "version": "2.16.0",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz",
- "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA=="
+ "version": "2.17.0",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
+ "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
},
"node_modules/prettier": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
- "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
+ "version": "2.8.8",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
+ "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"bin": {
"prettier": "bin-prettier.js"
},
@@ -34,30 +34,13 @@
}
},
"node_modules/tree-sitter-cli": {
- "version": "0.20.7",
- "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.7.tgz",
- "integrity": "sha512-MHABT8oCPr4D0fatsPo6ATQ9H4h9vHpPRjlxkxJs80tpfAEKGn6A1zU3eqfCKBcgmfZDe9CiL3rKOGMzYHwA3w==",
+ "version": "0.20.8",
+ "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.8.tgz",
+ "integrity": "sha512-XjTcS3wdTy/2cc/ptMLc/WRyOLECRYcMTrSWyhZnj1oGSOWbHLTklgsgRICU3cPfb0vy+oZCC33M43u6R1HSCA==",
"hasInstallScript": true,
"bin": {
"tree-sitter": "cli.js"
}
}
- },
- "dependencies": {
- "nan": {
- "version": "2.16.0",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.16.0.tgz",
- "integrity": "sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA=="
- },
- "prettier": {
- "version": "2.7.1",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
- "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g=="
- },
- "tree-sitter-cli": {
- "version": "0.20.7",
- "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.20.7.tgz",
- "integrity": "sha512-MHABT8oCPr4D0fatsPo6ATQ9H4h9vHpPRjlxkxJs80tpfAEKGn6A1zU3eqfCKBcgmfZDe9CiL3rKOGMzYHwA3w=="
- }
}
}
diff --git a/vendored_parsers/tree-sitter-erlang/package.json b/vendored_parsers/tree-sitter-erlang/package.json
index e0f9ca429..44ae49fcb 100644
--- a/vendored_parsers/tree-sitter-erlang/package.json
+++ b/vendored_parsers/tree-sitter-erlang/package.json
@@ -4,6 +4,7 @@
"description": "Tree Sitter grammar for Erlang",
"scripts": {
"test": "tree-sitter test",
+ "test-highlight": "tree-sitter test -f does-not-exist",
"generate": "tree-sitter generate",
"parse": "tree-sitter parse"
},
@@ -12,7 +13,20 @@
"dependencies": {
"nan": "^2.14.1",
"prettier": "^2.2.1",
- "tree-sitter-cli": "^0.20.7"
+ "tree-sitter-cli": "^0.20.8"
},
- "main": "bindings/node"
+ "main": "bindings/node",
+ "tree-sitter": [
+ {
+ "scope": "source.erlang",
+ "file-types": [
+ "erl",
+ "hrl",
+ "app.src",
+ "app",
+ "escript",
+ "rebar.config"
+ ]
+ }
+ ]
}
diff --git a/vendored_parsers/tree-sitter-erlang/queries/highlights.scm b/vendored_parsers/tree-sitter-erlang/queries/highlights.scm
new file mode 100644
index 000000000..5fb817efc
--- /dev/null
+++ b/vendored_parsers/tree-sitter-erlang/queries/highlights.scm
@@ -0,0 +1,228 @@
+;; Copyright (c) Facebook, Inc. and its affiliates.
+;;
+;; Licensed under the Apache License, Version 2.0 (the "License");
+;; you may not use this file except in compliance with the License.
+;; You may obtain a copy of the License at
+;;
+;; http://www.apache.org/licenses/LICENSE-2.0
+;;
+;; Unless required by applicable law or agreed to in writing, software
+;; distributed under the License is distributed on an "AS IS" BASIS,
+;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+;; See the License for the specific language governing permissions and
+;; limitations under the License.
+;; ---------------------------------------------------------------------
+
+;; Based initially on the contents of https://github.com/WhatsApp/tree-sitter-erlang/issues/2 by @Wilfred
+;; and https://github.com/the-mikedavis/tree-sitter-erlang/blob/main/queries/highlights.scm
+;;
+;; The tests are also based on those in
+;; https://github.com/the-mikedavis/tree-sitter-erlang/tree/main/test/highlight
+;;
+
+
+;; First match wins in this file
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Attributes
+
+;; module attribute
+(module_attribute
+ name: (atom) @module)
+
+;; behaviour
+(behaviour_attribute name: (atom) @module)
+
+;; export
+
+;; Import attribute
+(import_attribute
+ module: (atom) @module)
+
+;; export_type
+
+;; optional_callbacks
+
+;; compile
+(compile_options_attribute
+ options: (tuple
+ expr: (atom)
+ expr: (list
+ exprs: (binary_op_expr
+ lhs: (atom)
+ rhs: (integer)))))
+
+;; file attribute
+
+;; record
+(record_decl name: (atom) @type)
+(record_decl name: (macro_call_expr name: (var) @constant))
+(record_field name: (atom) @property)
+
+;; type alias
+
+;; opaque
+
+;; Spec attribute
+(spec fun: (atom) @function)
+(spec
+ module: (module name: (atom) @module)
+ fun: (atom) @function)
+
+;; callback
+(callback fun: (atom) @function)
+
+;; wild attribute
+(wild_attribute name: (attr_name name: (atom) @keyword))
+
+;; fun decl
+
+;; include/include_lib
+
+;; ifdef/ifndef
+(pp_ifdef name: (_) @keyword.directive)
+(pp_ifndef name: (_) @keyword.directive)
+
+;; define
+(pp_define
+ lhs: (macro_lhs
+ name: (_) @keyword.directive
+ args: (var_args args: (var))))
+(pp_define
+ lhs: (macro_lhs
+ name: (var) @constant))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Functions
+(fa fun: (atom) @function)
+(type_name name: (atom) @function)
+(call expr: (atom) @function)
+(function_clause name: (atom) @function)
+(internal_fun fun: (atom) @function)
+
+;; This is a fudge, we should check that the operator is '/'
+;; But our grammar does not (currently) provide it
+(binary_op_expr lhs: (atom) @function rhs: (integer))
+
+;; Others
+(remote_module module: (atom) @module)
+(remote fun: (atom) @function)
+(macro_call_expr name: (var) @keyword.directive args: (_) )
+(macro_call_expr name: (var) @constant)
+(macro_call_expr name: (atom) @keyword.directive)
+(record_field_name name: (atom) @property)
+(record_name name: (atom) @type)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Reserved words
+[ "after"
+ "and"
+ "band"
+ "begin"
+ "behavior"
+ "behaviour"
+ "bnot"
+ "bor"
+ "bsl"
+ "bsr"
+ "bxor"
+ "callback"
+ "case"
+ "catch"
+ "compile"
+ "define"
+ "div"
+ "elif"
+ "else"
+ "end"
+ "endif"
+ "export"
+ "export_type"
+ "file"
+ "fun"
+ "if"
+ "ifdef"
+ "ifndef"
+ "import"
+ "include"
+ "include_lib"
+ "module"
+ "of"
+ "opaque"
+ "optional_callbacks"
+ "or"
+ "receive"
+ "record"
+ "spec"
+ "try"
+ "type"
+ "undef"
+ "unit"
+ "when"
+ "xor"] @keyword
+
+["andalso" "orelse"] @keyword.operator
+
+;; Punctuation
+["," "." ";"] @punctuation.delimiter
+["(" ")" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
+
+;; Operators
+["!"
+ "->"
+ "<-"
+ "#"
+ "::"
+ "|"
+ ":"
+ "="
+ "||"
+
+ "+"
+ "-"
+ "bnot"
+ "not"
+
+ "/"
+ "*"
+ "div"
+ "rem"
+ "band"
+ "and"
+
+ "+"
+ "-"
+ "bor"
+ "bxor"
+ "bsl"
+ "bsr"
+ "or"
+ "xor"
+
+ "++"
+ "--"
+
+ "=="
+ "/="
+ "=<"
+ "<"
+ ">="
+ ">"
+ "=:="
+ "=/="
+ ] @operator
+
+;;; Comments
+((var) @comment.discard
+ (#match? @comment.discard "^_"))
+
+(dotdotdot) @comment.discard
+(comment) @comment
+
+;; Primitive types
+(string) @string
+(char) @constant
+(integer) @number
+(var) @variable
+(atom) @string.special.symbol
diff --git a/vendored_parsers/tree-sitter-erlang/src/grammar.json b/vendored_parsers/tree-sitter-erlang/src/grammar.json
index f9fe7a04d..8e74e0a85 100644
--- a/vendored_parsers/tree-sitter-erlang/src/grammar.json
+++ b/vendored_parsers/tree-sitter-erlang/src/grammar.json
@@ -50,6 +50,10 @@
},
{
"type": "SYMBOL",
+ "name": "deprecated_attribute"
+ },
+ {
+ "type": "SYMBOL",
"name": "record_decl"
},
{
@@ -1228,6 +1232,256 @@
}
]
},
+ "deprecated_attribute": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "-"
+ },
+ {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "deprecated"
+ },
+ {
+ "type": "ALIAS",
+ "content": {
+ "type": "STRING",
+ "value": "'deprecated'"
+ },
+ "named": false,
+ "value": "deprecated"
+ }
+ ]
+ },
+ {
+ "type": "STRING",
+ "value": "("
+ },
+ {
+ "type": "FIELD",
+ "name": "attr",
+ "content": {
+ "type": "SYMBOL",
+ "name": "_deprecated_details"
+ }
+ },
+ {
+ "type": "STRING",
+ "value": ")"
+ },
+ {
+ "type": "STRING",
+ "value": "."
+ }
+ ]
+ },
+ "_deprecated_details": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "deprecated_module"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "deprecated_fa"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "deprecated_fas"
+ }
+ ]
+ },
+ "deprecated_module": {
+ "type": "FIELD",
+ "name": "module",
+ "content": {
+ "type": "SYMBOL",
+ "name": "atom"
+ }
+ },
+ "deprecated_fas": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "["
+ },
+ {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "FIELD",
+ "name": "fa",
+ "content": {
+ "type": "SYMBOL",
+ "name": "deprecated_fa"
+ }
+ },
+ {
+ "type": "REPEAT",
+ "content": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": ","
+ },
+ {
+ "type": "FIELD",
+ "name": "fa",
+ "content": {
+ "type": "SYMBOL",
+ "name": "deprecated_fa"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "type": "STRING",
+ "value": "]"
+ }
+ ]
+ },
+ "deprecated_fa": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": "{"
+ },
+ {
+ "type": "FIELD",
+ "name": "fun",
+ "content": {
+ "type": "SYMBOL",
+ "name": "atom"
+ }
+ },
+ {
+ "type": "STRING",
+ "value": ","
+ },
+ {
+ "type": "FIELD",
+ "name": "arity",
+ "content": {
+ "type": "SYMBOL",
+ "name": "_deprecated_fun_arity"
+ }
+ },
+ {
+ "type": "FIELD",
+ "name": "desc",
+ "content": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "deprecation_desc"
+ },
+ {
+ "type": "BLANK"
+ }
+ ]
+ }
+ },
+ {
+ "type": "STRING",
+ "value": "}"
+ }
+ ]
+ },
+ "deprecation_desc": {
+ "type": "SEQ",
+ "members": [
+ {
+ "type": "STRING",
+ "value": ","
+ },
+ {
+ "type": "FIELD",
+ "name": "desc",
+ "content": {
+ "type": "SYMBOL",
+ "name": "_desc"
+ }
+ }
+ ]
+ },
+ "_desc": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "FIELD",
+ "name": "atom",
+ "content": {
+ "type": "SYMBOL",
+ "name": "atom"
+ }
+ },
+ {
+ "type": "FIELD",
+ "name": "comment",
+ "content": {
+ "type": "SYMBOL",
+ "name": "multi_string"
+ }
+ }
+ ]
+ },
+ "multi_string": {
+ "type": "PREC_RIGHT",
+ "value": 0,
+ "content": {
+ "type": "FIELD",
+ "name": "elems",
+ "content": {
+ "type": "REPEAT1",
+ "content": {
+ "type": "SYMBOL",
+ "name": "_string_like"
+ }
+ }
+ }
+ },
+ "_string_like": {
+ "type": "CHOICE",
+ "members": [
+ {
+ "type": "SYMBOL",
+ "name": "string"
+ },
+ {
+ "type": "SYMBOL",
+ "name": "_macro_body_expr"
+ }
+ ]
+ },
+ "_deprecated_fun_arity": {
+ "type": "CHOICE",
+ "members": [
+ {<