nightshade

The nightshade programming language, compiler and tools (WIP)
Log | Files | Refs | README

commit 98f0aa640f71b647b87c5e7bf723dc175b4c9919
parent a835760a2fe14d042dd9796685017fb1f9ccbc7d
Author: citbl <citbl@citbl.org>
Date:   Wed, 10 Jun 2026 17:09:56 +1000

idiomatic loops

Diffstat:
Msrc/lexer.adb | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/lexer.adb b/src/lexer.adb @@ -55,8 +55,8 @@ package body Lexer is C : Character; T : Token; begin - while true loop - while true loop + loop + loop C := Peek (L); if Is_Line_Terminator (C) then -- we care about line return in this impl @@ -75,7 +75,8 @@ package body Lexer is end if; end loop; if Peek (L) = '/' and Peek2 (L) = '/' then - while not Is_Line_Terminator (Peek (L)) loop + loop + exit when Is_Line_Terminator (Peek (L)); Nudge (L); end loop; goto Continue; @@ -100,7 +101,7 @@ package body Lexer is Line := L.Line; Col := L.Col; - while true loop + loop if Is_Alphanumeric (Peek (L)) or Peek (L) = '_' then Nudge (L); else @@ -201,7 +202,7 @@ package body Lexer is Col := L.Col; Nudge (L); -- advance `"` - while true loop + loop C := Peek (L); if C = '"' then exit; @@ -310,7 +311,7 @@ package body Lexer is Tok : Token; begin - while true loop + loop Tok := Next_Token (L); Add_Token (L, Tok); exit when Tok.Kind = EOF;