commit 69e640d695bb5b9a554393e7bb8be60830a9ab28
parent fcf44fe26af9048bbb2def386a21ea3b2baa4060
Author: citbl <citbl@citbl.org>
Date: Fri, 12 Jun 2026 20:44:33 +1000
add line/cols
Diffstat:
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/parser.adb b/src/parser.adb
@@ -104,7 +104,7 @@ package body Parser is
E : Expr_Ref;
begin
T := Match (P, Str_Literal);
- E := new Expr'(Kind => String_Literal, Lit_Str => T.Lexeme);
+ E := new Expr'(Kind => String_Literal, Lit_Str => T.Lexeme, File_Name => P.File_Name, Line => T.Line, Col => T.Col);
return E;
end Parse_Expr;
@@ -172,8 +172,11 @@ package body Parser is
Stmts : Stmt_Vectors.Vector;
Pa : Param;
Params : Param_Vectors.Vector;
+ Line, Col : Positive;
begin
T := Consume (P); -- fx
+ Line := T.Line;
+ Col := T.Col;
if T.Lexeme = "fx" then
Public := true;
end if;
@@ -214,6 +217,9 @@ package body Parser is
Params => Params,
Public => Public,
Return_Kind => To_Unbounded_String (""),
+ File_Name => P.File_Name,
+ Line => Line,
+ Col => Col,
Stmts => Stmts));
end Parse_Func_Decl;
@@ -300,3 +306,4 @@ package body Parser is
end Print_AST;
end Parser;
+
diff --git a/src/parser.ads b/src/parser.ads
@@ -93,6 +93,10 @@ package Parser is
when String_Literal =>
Lit_Str : Unbounded_String;
+
+ File_Name : File_Name_Ref;
+ Line : Positive;
+ Col : Positive;
end case;
end record;
@@ -102,6 +106,9 @@ package Parser is
Return_Kind : Unbounded_String;
Stmts : Stmt_Vectors.Vector;
Public : Boolean;
+ File_Name : File_Name_Ref;
+ Line : Positive;
+ Col : Positive;
end record;
type Decl_Kind is (Function_Kind);