@@ -2348,7 +2348,9 @@ static Symbol semicolon() {
2348
2348
// --------------------------------------------------------------------------------------------------------
2349
2349
2350
2350
/**
2351
- * This is called by `newline_post` before marking, so they must not fail after advancing.
2351
+ * Process a `Lexed` token if it results in a layout end or an extra.
2352
+ *
2353
+ * This is called by `newline_post` before marking, so the actions must not fail after advancing.
2352
2354
*/
2353
2355
static Symbol process_token_safe (Lexed next ) {
2354
2356
switch (next ) {
@@ -2397,6 +2399,9 @@ static Symbol process_token_safe(Lexed next) {
2397
2399
return FAIL ;
2398
2400
}
2399
2401
2402
+ /**
2403
+ * Process a `Lexed` token if it results in a symbolic operator.
2404
+ */
2400
2405
static Symbol process_token_symop (bool whitespace , Lexed next ) {
2401
2406
switch (next ) {
2402
2407
case LDollar :
@@ -2430,6 +2435,9 @@ static Symbol process_token_symop(bool whitespace, Lexed next) {
2430
2435
return FAIL ;
2431
2436
}
2432
2437
2438
+ /**
2439
+ * Process a `Lexed` token for an interior position.
2440
+ */
2433
2441
static Symbol process_token_interior (Lexed next ) {
2434
2442
switch (next ) {
2435
2443
case LBraceClose :
@@ -2449,6 +2457,9 @@ static Symbol process_token_interior(Lexed next) {
2449
2457
return FAIL ;
2450
2458
}
2451
2459
2460
+ /**
2461
+ * Process a `Lexed` token to initialize the context stack.
2462
+ */
2452
2463
static Symbol process_token_init (uint32_t indent , Lexed next ) {
2453
2464
switch (next ) {
2454
2465
case LModule :
@@ -2524,6 +2535,10 @@ static Symbol newline_post() {
2524
2535
return res ;
2525
2536
}
2526
2537
2538
+ /**
2539
+ * Repeatedly lex lookahead until encountering something that is neither a comment nor CPP, skipping whitespace and
2540
+ * newlines in between.
2541
+ */
2527
2542
static void newline_lookahead () {
2528
2543
for (;;) {
2529
2544
switch (PEEK ) {
@@ -2578,6 +2593,10 @@ static void newline_lookahead() {
2578
2593
}
2579
2594
}
2580
2595
2596
+ /**
2597
+ * Perform newline lookahead, then either finish the run if the position was advanced into the next token, or directly
2598
+ * start newline processing if not.
2599
+ */
2581
2600
static Symbol newline_start () {
2582
2601
dbg ("newline lookahead\n" );
2583
2602
newline -> state = NInit ;
@@ -2586,6 +2605,9 @@ static Symbol newline_start() {
2586
2605
else return newline_post ();
2587
2606
}
2588
2607
2608
+ /**
2609
+ * Perform newline lookahead with preset indent, used at the beginning of a file and after pragmas.
2610
+ */
2589
2611
static Symbol newline_resume () {
2590
2612
dbg ("newline resume\n" );
2591
2613
uint32_t indent = newline -> indent ;
0 commit comments