Skip to content

Commit 6f339b8

Browse files
Docs: Review docstrings for lexer.
1 parent 3ddfb9f commit 6f339b8

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

compiler/src/modules/lexer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub enum TokenType {
4848
Comment, Newline, Indent, Dedent, Nl, Endmarker,
4949
}
5050

51-
// Produces a parser-ready iterator with indentation and soft keywords resolved.
51+
// Produces a parser ready iterator with indentation and soft keywords resolved.
5252
pub fn lexer(source: &str) -> impl Iterator<Item = Token> + '_ {
5353
let bytes = source.as_bytes();
5454
let len = source.len();

compiler/src/modules/lexer/scan.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use core::cmp::Ordering;
1111
const MAX_INDENT_DEPTH: usize = 100;
1212
const MAX_FSTRING_DEPTH: usize = 200;
1313

14-
// Scanner state: source bytes, position, pending queue, indent stack, f-string context.
14+
// Scanner state; source bytes, position, pending queue, indent stack, f-string context.
1515
pub(super) struct Scanner<'a> {
1616
pub src: &'a [u8],
1717
pub pos: usize,
18-
pub pending: Vec<(TokenType,usize,usize,usize)>, // Pending stack: Tokens to emit in LIFO order.
18+
pub pending: Vec<(TokenType,usize,usize,usize)>, // Pending stack; Tokens to emit in LIFO order.
1919
pub indent_stack: Vec<usize>,
2020
pub nesting: u32,
2121
pub line: usize,
@@ -116,7 +116,7 @@ impl<'a> Scanner<'a> {
116116
} else { base }
117117
}
118118

119-
/* Handles single-quote, double-quote and triple-quoted strings with escape awareness. */
119+
/* Handles single-quote, double-quote and triple quoted strings with escape awareness. */
120120

121121
fn scan_string(&mut self, quote: u8) {
122122
if self.at(0) == Some(quote) && self.at(1) == Some(quote) {
@@ -376,7 +376,7 @@ impl<'a> Scanner<'a> {
376376
return self.pending.pop();
377377
}
378378

379-
// Multi-char operators: 3-char
379+
// Multi-char operators: 3 characters
380380
if self.pos + 2 < self.src.len() {
381381
let kind = match &self.src[self.pos..self.pos + 3] {
382382
b"**=" => Some(TokenType::DoubleStarEqual),
@@ -391,7 +391,7 @@ impl<'a> Scanner<'a> {
391391
}
392392
}
393393

394-
// Multi-char operators: 2-char
394+
// Multi-char operators: 2 characters
395395
if self.pos + 1 < self.src.len() {
396396
let kind = match &self.src[self.pos..self.pos + 2] {
397397
b"!=" => Some(TokenType::NotEqual), b"%=" => Some(TokenType::PercentEqual),
@@ -412,7 +412,7 @@ impl<'a> Scanner<'a> {
412412
}
413413
}
414414

415-
// Single-char: table dispatch
415+
// Single character: table dispatch
416416
self.pos += 1;
417417
let idx = if b < 128 { SINGLE_TOK[b as usize] } else { 0 };
418418
let kind = SINGLE_MAP[idx as usize];

0 commit comments

Comments
 (0)