File tree Expand file tree Collapse file tree 5 files changed +70916
-37482
lines changed Expand file tree Collapse file tree 5 files changed +70916
-37482
lines changed Original file line number Diff line number Diff line change @@ -7,19 +7,19 @@ const PREC = {
77
88 parenthesized_expression : 1 ,
99 parenthesized_list_splat : 1 ,
10- or : 10 ,
11- and : 11 ,
12- not : 12 ,
13- compare : 13 ,
14- bitwise_or : 14 ,
10+ or : 10 ,
11+ and : 11 ,
12+ not : 12 ,
13+ compare : 13 ,
14+ bitwise_or : 14 ,
1515 bitwise_and : 15 ,
16- xor : 16 ,
17- shift : 17 ,
18- plus : 18 ,
19- times : 19 ,
20- unary : 20 ,
21- power : 21 ,
22- call : 22 ,
16+ xor : 16 ,
17+ shift : 17 ,
18+ plus : 18 ,
19+ times : 19 ,
20+ unary : 20 ,
21+ power : 21 ,
22+ call : 22 ,
2323}
2424
2525const SEMICOLON = ';'
@@ -58,6 +58,19 @@ module.exports = grammar({
5858 $ . _string_start ,
5959 $ . _string_content ,
6060 $ . _string_end ,
61+
62+ // Mark comments as external tokens so that the external scanner is always
63+ // invoked, even if no external token is expected. This allows for better
64+ // error recovery, because the external scanner can maintain the overall
65+ // structure by returning dedent tokens whenever a dedent occurs, even
66+ // if no dedent is expected.
67+ $ . comment ,
68+
69+ // Allow the external scanner to check for the validity of closing brackets
70+ // so that it can avoid returning dedent tokens between brackets.
71+ ']' ,
72+ ')' ,
73+ '}' ,
6174 ] ,
6275
6376 inline : $ => [
Original file line number Diff line number Diff line change 52055205 {
52065206 "type" : " SYMBOL" ,
52075207 "name" : " _string_end"
5208+ },
5209+ {
5210+ "type" : " SYMBOL" ,
5211+ "name" : " comment"
5212+ },
5213+ {
5214+ "type" : " STRING" ,
5215+ "value" : " ]"
5216+ },
5217+ {
5218+ "type" : " STRING" ,
5219+ "value" : " )"
5220+ },
5221+ {
5222+ "type" : " STRING" ,
5223+ "value" : " }"
52085224 }
52095225 ],
52105226 "inline" : [
You can’t perform that action at this time.
0 commit comments