commit 10a3de5beed24850ffda5a0610af89b87a9d7e8d
parent 3a9b88fddeeb3588a6a6d7983e9b07ec6b44e9eb
Author: citbl <citbl@citbl.org>
Date: Thu, 4 Jun 2026 22:11:46 +1000
minor
Diffstat:
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/parser.adb b/src/parser.adb
@@ -11,6 +11,19 @@ package body Parser is
return P;
end Init;
+ -- peek
+
+ function Peek (P : in Parser) return Token is
+ T : Token;
+ begin
+ if P.Pos < P.Tokens.Last_Index then
+ T := P.Tokens (P.Pos + 1);
+ end if;
+ return Token'(Kind => EOF, Lexeme => To_Unbounded_String(""), Line => 1, Col => 1);
+ end Peek;
+
+ -- parse program
+
function Parse_Program (P : in out Parser) return Node_Ref is
N : Node_Ref;
begin
@@ -33,15 +46,6 @@ package body Parser is
return N;
end Parse_Program;
- function Peek (P : in Parser) return Token is
- T : Token;
- begin
- if P.Pos < P.Tokens.Last_Index then
- T := P.Tokens (P.Pos + 1);
- end if;
- return Token'(Kind => EOF, Lexeme => To_Unbounded_String(""), Line => 1, Col => 1);
- end Peek;
-
-- parse
procedure Parse (P : in out Parser) is