nightshade

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

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

fixes and cleanup

Diffstat:
Msrc/parser.adb | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/parser.adb b/src/parser.adb @@ -188,7 +188,6 @@ package body Parser is T := Peek (P); Put_Line (Token'Image (T)); T := Match (P, L_Paren); -- ( - Put_Line ("woefijweoif"); loop -- func decl params @@ -234,16 +233,19 @@ package body Parser is procedure Parse_Program (P : in out Parser) is TL : Top_Level_Vectors.Vector; T : Token; + Counter : Positive := 1; begin - Put_Line ("Parse_Program"); + Put_Line ("parsing"); - while Peek (P).Kind /= EOF loop + while Peek (P).Kind /= EOF and Counter < 100 loop + Counter := Counter + 1; Skip_New_Lines (P); T := Peek (P); Put_Line ("T:" & Token'Image (T)); if T.Kind = Keyword and (T.Lexeme = "fx" or T.Lexeme = "fn") then TL.Append (Parse_Func_Decl (P)); end if; + exit when T.Kind = EOF or (T.Kind = Keyword and T.Lexeme = "end"); end loop; P.Top_Program := TL; @@ -257,6 +259,7 @@ package body Parser is procedure Parse (P : in out Parser) is begin Parse_Program (P); + Put_Line("done parsing"); end Parse; procedure Print_AST (P : Parser) is