reader: implement read_err_to_cstr

This commit is contained in:
2026-02-05 04:07:59 +00:00
parent 75daad53ea
commit 10d6876de4

43
src/reader.c Normal file
View File

@@ -0,0 +1,43 @@
/* reader.c: Stream reader implementation
* Created: 2026-02-04
* Author: Aryadev Chavali
* License: See end of file
* Commentary:
*/
#include <ctype.h>
#include <string.h>
#include <alisp/base.h>
#include <alisp/reader.h>
const char *read_err_to_cstr(read_err_t err)
{
switch (err)
{
case READ_ERR_OK:
return "OK";
break;
case READ_ERR_EOF:
return "EOF";
break;
case READ_ERR_UNKNOWN_CHAR:
return "UNKNOWN_CHAR";
break;
default:
FAIL("Unreachable");
}
}
/* Copyright (C) 2026 Aryadev Chavali
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for
* details.
* You may distribute and modify this code under the terms of the GNU General
* Public License Version 2, which you should have received a copy of along with
* this program. If not, please go to <https://www.gnu.org/licenses/>.
*/