@@ -255,10 +255,15 @@ module.exports = grammar({
255
255
*/
256
256
relpos_beforeafter : $ => field ( 'relpos_beforeafter' , seq ( choice ( 'BEFORE' , 'AFTER' ) , $ . marker ) ) ,
257
257
/**
258
- relpos_inside: Points to inside `identifierMarker` (its top or bottom region).
259
- Use cases: When inserting content at the top or bottom of a function, class or file.
258
+ relpos_inside: Points to inside `identifierMarker` (either the body's TOP or BOTTOM region). The reference indentation level is the body's.
259
+ Syntax: INSIDE (FUNCTION|CLASS) "<name>" [OFFSET <offset>] (TOP|BOTTOM)
260
+ Use cases: When inserting content either at the TOP or BOTTOM of a function or class body.
261
+ Examples: <ul>
262
+ <li>INSIDE FUNCTION my_function OFFSET 1 BOTTOM -- at the BOTTOM of the function body</li>
263
+ <li>INSIDE FUNCTION my_function TOP -- at the TOP of the function body</li>
264
+ </ul>
260
265
*/
261
- relpos_inside : $ => seq ( 'INSIDE' , field ( 'inside' , $ . identifierMarker ) , optional ( field ( 'topOrBottom' , choice ( 'TOP' , 'BOTTOM' ) ) ) ) ,
266
+ relpos_inside : $ => seq ( 'INSIDE' , field ( 'inside' , $ . identifierMarker ) , field ( 'topOrBottom' , choice ( 'TOP' , 'BOTTOM' ) ) ) ,
262
267
relpos_bai : $ => field ( 'relpos_bai' , choice ( $ . relpos_beforeafter , $ . relpos_inside ) ) ,
263
268
/**
264
269
relpos_at: points to a specific `lineMarker`
@@ -409,6 +414,7 @@ in the target code file.
409
414
"'" ,
410
415
repeat ( choice (
411
416
/ [ ^ ' \\ \n ] / ,
417
+ '--' ,
412
418
$ . escape_sequence
413
419
) ) ,
414
420
"'"
@@ -417,6 +423,7 @@ in the target code file.
417
423
'"' ,
418
424
repeat ( choice (
419
425
/ [ ^ " \\ \n ] / ,
426
+ '--' ,
420
427
$ . escape_sequence
421
428
) ) ,
422
429
'"'
@@ -432,6 +439,7 @@ in the target code file.
432
439
/ [ ^ " \\ ] / ,
433
440
'"' ,
434
441
'""' ,
442
+ '--' ,
435
443
$ . escape_sequence
436
444
) ) ,
437
445
'"""'
@@ -442,6 +450,7 @@ in the target code file.
442
450
/ [ ^ ' \\ ] / ,
443
451
"'" ,
444
452
"''" ,
453
+ '--' ,
445
454
$ . escape_sequence
446
455
) ) ,
447
456
"'''"
@@ -450,7 +459,10 @@ in the target code file.
450
459
451
460
number : $ => / \d + / ,
452
461
453
- comment : $ => token ( seq ( '--' , / .* / ) ) ,
462
+ comment : $ => token ( prec ( - 1 , seq (
463
+ '--' ,
464
+ optional ( / [ ^ \n ] + / )
465
+ ) ) ) ,
454
466
455
467
command_separator : $ => ';'
456
468
0 commit comments