mirror of
https://github.com/kanaka/mal.git
synced 2024-11-10 12:47:45 +03:00
Ada: build in knowledge about true and false into reader
This commit is contained in:
parent
caa4fab9f4
commit
9128585993
@ -343,8 +343,18 @@ package body Reader is
|
||||
|
||||
when Sym_Tok =>
|
||||
|
||||
return New_Symbol_Mal_Type
|
||||
(Slice (Saved_Line, Tok.Start_Char, Tok.Stop_Char));
|
||||
-- Mal interpreter is required to know about true, false and nil.
|
||||
declare
|
||||
S : String := Slice (Saved_Line, Tok.Start_Char, Tok.Stop_Char);
|
||||
begin
|
||||
if S = "true" then
|
||||
return New_Bool_Mal_Type (True);
|
||||
elsif S = "false" then
|
||||
return New_Bool_Mal_Type (False);
|
||||
else
|
||||
return New_Symbol_Mal_Type (S);
|
||||
end if;
|
||||
end;
|
||||
|
||||
end case;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user