grammar.js: allow concatenated strings in deprecation attribute description

Summary:
As title.
This fixes our CI, for parse-elp

Reviewed By: TD5

Differential Revision: D46477987

fbshipit-source-id: d40e42a72479ac562fe27d1a5ac83b9258985965
syntax_id
Alan Zimmerman 2023-06-06 05:13:12 +07:00 committed by Facebook GitHub Bot
parent 6228b1df25
commit c431b0b2d9
5 changed files with 22628 additions and 22447 deletions

@ -29,8 +29,8 @@ const PREC = {
CALL: 80,
REMOTE: 1,
BIT_EXPR: 2,
COND_MATCH: 81, // `?=` in maybe expr. Should has lowest priority https://www.erlang.org/eeps/eep-0049#operator-priority
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,
@ -98,7 +98,8 @@ module.exports = grammar({
$._catch_pat,
$._deprecated_details,
$._deprecated_fun_arity,
$._desc
$._desc,
$._string_like
],
@ -297,7 +298,14 @@ module.exports = grammar({
_desc: $ => choice(
field("atom", $.atom),
field("comment", $.string),
field("comment", $.multi_string),
),
multi_string: $ => prec.right(field("elems", repeat1($._string_like))),
_string_like: $ => choice(
$.string,
$._macro_body_expr
),
_deprecated_fun_arity: $ => choice(

@ -1432,9 +1432,37 @@
"name": "comment",
"content": {
"type": "SYMBOL",
"name": "string"
"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": {
@ -6122,7 +6150,8 @@
"_catch_pat",
"_deprecated_details",
"_deprecated_fun_arity",
"_desc"
"_desc",
"_string_like"
],
"@generated": true
}

@ -156,7 +156,7 @@
"named": true
},
{
"type": "string",
"type": "multi_string",
"named": true
}
]
@ -625,6 +625,24 @@
}
]
},
{
"type": "_string_like",
"named": true,
"subtypes": [
{
"type": "macro_call_expr",
"named": true
},
{
"type": "macro_string",
"named": true
},
{
"type": "string",
"named": true
}
]
},
{
"type": "ann_type",
"named": true,
@ -2145,6 +2163,22 @@
}
}
},
{
"type": "multi_string",
"named": true,
"fields": {
"elems": {
"multiple": true,
"required": true,
"types": [
{
"type": "_string_like",
"named": true
}
]
}
}
},
{
"type": "opaque",
"named": true,

File diff suppressed because it is too large Load Diff

@ -103,7 +103,8 @@ deprecated function/arity/desc attribute
(atom)
(integer)
(deprecation_desc
(string)))))
(multi_string
(string))))))
================================================================================
deprecated '_', '_', atom attribute
@ -158,7 +159,8 @@ deprecated list attribute
(atom)
(integer)
(deprecation_desc
(string)))
(multi_string
(string))))
(deprecated_fa
(atom)
(integer))
@ -166,6 +168,25 @@ deprecated list attribute
(atom)
(deprecated_wildcard)
(deprecation_desc
(multi_string
(string)))))))
================================================================================
deprecated multi-string description
================================================================================
-deprecated({new, 1, "str1" "str2"}).
--------------------------------------------------------------------------------
(source_file
(deprecated_attribute
(deprecated_fa
(atom)
(integer)
(deprecation_desc
(multi_string
(string)
(string))))))
================================================================================