Small fixes
This commit is contained in:
parent
d333cdfad5
commit
521bd9907a
|
|
@ -33,7 +33,7 @@ static Boolean hash_table_put_funcs(HashTable *ht, SlsStr key, TokenString *item
|
|||
return hash_table_put(ht, key, (void *)item);
|
||||
}
|
||||
|
||||
static TokenString* hash_table_get_funcs(const HashTable *ht, SlsStr key, TokenString *default_item) {
|
||||
static TokenString *hash_table_get_funcs(const HashTable *ht, SlsStr key, TokenString *default_item) {
|
||||
return (TokenString*)hash_table_get(ht, key, (void *)default_item);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include "sls/string.h"
|
||||
#include "sls/interpreter.h"
|
||||
|
||||
static const size_t BUFFER_SIZE = 256;
|
||||
static const SlsStr REPL_FILE_NAME = SLS_STR_CONST("<STDIN>");
|
||||
|
||||
int repl(int argc, char *argv[]) {
|
||||
|
|
@ -28,8 +27,8 @@ int repl(int argc, char *argv[]) {
|
|||
|
||||
LexerInfo lexer_info;
|
||||
InterpreterState *interpreter_state = interpreter_create();
|
||||
char buf[BUFFER_SIZE];
|
||||
while (fgets(buf, BUFFER_SIZE, stdin)) {
|
||||
char buf[256];
|
||||
while (fgets(buf, sizeof buf, stdin)) {
|
||||
size_t len = strlen(buf);
|
||||
if (len && buf[len - 1] == '\n') buf[len - 1] = '\0';
|
||||
if (strncmp(buf, "#exit", 5) == 0) {
|
||||
|
|
@ -37,7 +36,7 @@ int repl(int argc, char *argv[]) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
SlsStr code = sls_str_malloc(buf, BUFFER_SIZE);
|
||||
SlsStr code = sls_str_malloc(buf, sizeof buf);
|
||||
init_lexer(&lexer_info, REPL_FILE_NAME, code);
|
||||
LexerResult result = lexical_analysis(&lexer_info);
|
||||
if (result.type == SLS_ERROR) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue