Skip to content

Commit bc8f90d

Browse files
committed
more docs
1 parent 83af0a6 commit bc8f90d

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/scanner.c

+23-1
Original file line numberDiff line numberDiff line change
@@ -2348,7 +2348,9 @@ static Symbol semicolon() {
23482348
// --------------------------------------------------------------------------------------------------------
23492349

23502350
/**
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.
23522354
*/
23532355
static Symbol process_token_safe(Lexed next) {
23542356
switch (next) {
@@ -2397,6 +2399,9 @@ static Symbol process_token_safe(Lexed next) {
23972399
return FAIL;
23982400
}
23992401

2402+
/**
2403+
* Process a `Lexed` token if it results in a symbolic operator.
2404+
*/
24002405
static Symbol process_token_symop(bool whitespace, Lexed next) {
24012406
switch (next) {
24022407
case LDollar:
@@ -2430,6 +2435,9 @@ static Symbol process_token_symop(bool whitespace, Lexed next) {
24302435
return FAIL;
24312436
}
24322437

2438+
/**
2439+
* Process a `Lexed` token for an interior position.
2440+
*/
24332441
static Symbol process_token_interior(Lexed next) {
24342442
switch (next) {
24352443
case LBraceClose:
@@ -2449,6 +2457,9 @@ static Symbol process_token_interior(Lexed next) {
24492457
return FAIL;
24502458
}
24512459

2460+
/**
2461+
* Process a `Lexed` token to initialize the context stack.
2462+
*/
24522463
static Symbol process_token_init(uint32_t indent, Lexed next) {
24532464
switch (next) {
24542465
case LModule:
@@ -2524,6 +2535,10 @@ static Symbol newline_post() {
25242535
return res;
25252536
}
25262537

2538+
/**
2539+
* Repeatedly lex lookahead until encountering something that is neither a comment nor CPP, skipping whitespace and
2540+
* newlines in between.
2541+
*/
25272542
static void newline_lookahead() {
25282543
for (;;) {
25292544
switch (PEEK) {
@@ -2578,6 +2593,10 @@ static void newline_lookahead() {
25782593
}
25792594
}
25802595

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+
*/
25812600
static Symbol newline_start() {
25822601
dbg("newline lookahead\n");
25832602
newline->state = NInit;
@@ -2586,6 +2605,9 @@ static Symbol newline_start() {
25862605
else return newline_post();
25872606
}
25882607

2608+
/**
2609+
* Perform newline lookahead with preset indent, used at the beginning of a file and after pragmas.
2610+
*/
25892611
static Symbol newline_resume() {
25902612
dbg("newline resume\n");
25912613
uint32_t indent = newline->indent;

0 commit comments

Comments
 (0)