@@ -318,12 +318,16 @@ module.exports = grammar({
318318 maxdepth_clause : $ => seq ( 'MAX DEPTH' , field ( 'depth' , $ . number ) ) ,
319319
320320 // <specifying-locations-in-code>
321- lineMarker : $ => seq ( 'LINE' , choice (
321+
322+ line_base : $ => seq ( optional ( 'LINE' ) , choice (
322323 field ( 'lineMarker' , choice ( $ . string , $ . number ) ) , // reference the line content or a context-relative line number
323- seq ( 'REGEX' , field ( 'regexMarker' , $ . string ) ) , // match line by REGEX
324- seq ( 'PREFIX' , field ( 'prefixMarker' , $ . string ) ) , // match line by its prefix
325- seq ( 'SUFFIX' , field ( 'suffixMarker' , $ . string ) ) // match line by its suffix
326- ) , optional ( $ . offset_clause ) ) ,
324+ field ( 'empty' , 'EMPTY' ) , // match empty line
325+ seq ( 'REGEX' , field ( 'regex' , $ . string ) ) , // match line by REGEX
326+ seq ( 'PREFIX' , field ( 'prefix' , $ . string ) ) , // match line by its prefix
327+ seq ( 'SUFFIX' , field ( 'suffix' , $ . string ) ) , // match line by its suffix
328+ seq ( 'INDENT' , 'LEVEL' , field ( 'indent_level' , $ . number ) ) , // Line has indent level
329+ ) ) ,
330+ lineMarker : $ => seq ( $ . line_base , optional ( $ . offset_clause ) ) ,
327331 identifierMarker : $ => seq ( field ( 'identifier' , choice ( 'VARIABLE' , 'FUNCTION' , 'METHOD' , 'CLASS' ) ) , field ( 'identifierMarker' , $ . string ) , optional ( $ . offset_clause ) ) ,
328332 marker : $ => choice ( $ . lineMarker , $ . identifierMarker ) ,
329333 relpos_beforeafter : $ => field ( 'relpos_beforeafter' , seq ( choice ( 'BEFORE' , 'AFTER' ) , $ . marker ) ) ,
@@ -391,14 +395,7 @@ module.exports = grammar({
391395 loop_continue : $ => field ( 'continue' , 'CONTINUE' ) ,
392396 loop_control : $ => choice ( $ . loop_break , $ . loop_continue ) ,
393397 // Matchers (WHEN clause):
394- case_when : $ => seq ( 'WHEN' , choice (
395- field ( 'empty' , 'EMPTY' ) , // match empty line
396- seq ( 'REGEX' , field ( 'regex' , $ . string ) ) , // match line by REGEX
397- seq ( 'PREFIX' , field ( 'prefix' , $ . string ) ) , // Line starts with
398- seq ( 'SUFFIX' , field ( 'suffix' , $ . string ) ) , // Line ends with
399- seq ( 'INDENT' , 'LEVEL' , field ( 'indent_level' , $ . number ) ) , // Line has indent level
400- seq ( 'LINE' , 'NUMBER' , field ( 'line_number' , $ . number ) ) // Specific line number
401- ) ) ,
398+ case_when : $ => seq ( 'WHEN' , $ . line_base ) ,
402399 // Actions (THEN clause):
403400 case_action : $ => choice (
404401 $ . loop_control ,
0 commit comments