:<
This commit is contained in:
@@ -30,7 +30,9 @@
|
||||
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
|
||||
typedef struct noomC_LocalInfo {
|
||||
enum { NOOMC_GLOBAL, NOOMC_LOCAL, NOOMC_UPVAL } type;
|
||||
enum { NOOMC_GLOBAL,
|
||||
NOOMC_LOCAL,
|
||||
NOOMC_UPVAL } type;
|
||||
unsigned int idx;
|
||||
} noomC_LocalInfo;
|
||||
|
||||
@@ -165,8 +167,7 @@ static noom_Exit noomC_compile_expr(
|
||||
noomV_Function* func,
|
||||
const noomP_Node* node,
|
||||
// retc of -1 means all values!!!!!!!!!!!
|
||||
int retc
|
||||
) {
|
||||
int retc) {
|
||||
noom_Exit result;
|
||||
if (node->type == NOOMP_NODE_NILLITERAL) {
|
||||
compiler->curstack++;
|
||||
|
||||
@@ -82,8 +82,7 @@ noom_uint_t noom_format_error(const noomP_Parser* parser, const char* program_na
|
||||
if (parser->code[i] == '\n') {
|
||||
row++;
|
||||
column = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
column++;
|
||||
}
|
||||
}
|
||||
@@ -127,8 +126,7 @@ noom_uint_t noom_format_error(const noomP_Parser* parser, const char* program_na
|
||||
|
||||
if (row == 0) {
|
||||
num_buf[num_len++] = '0';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
noom_uint_t temp = row;
|
||||
noom_uint_t divisor = 1;
|
||||
while (temp / divisor >= 10) divisor *= 10;
|
||||
|
||||
@@ -47,8 +47,7 @@ double noom_strtod(const char* s, const char** endptr, int* error) {
|
||||
|
||||
num *= noom_pow(2.0, exponent_negative ? -exponent : exponent);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
noom_bool_t are_we_cooked = 1;
|
||||
while (noomL_isnumber(*s)) {
|
||||
num = num * 10.0 + (*s - '0');
|
||||
|
||||
23
src/main.c
23
src/main.c
@@ -84,8 +84,7 @@ int execute(const char* code, noom_LuaVersion version, const char* program_name,
|
||||
puts("\x1b[0m");
|
||||
puts("PARSE OUTPUT:");
|
||||
print_node(program, 0);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
noom_uint_t bleh = noom_format_error(&parser, program_name, NULL, 0);
|
||||
char* buf = noom_alloc(bleh);
|
||||
noom_format_error(&parser, program_name, buf, bleh);
|
||||
@@ -269,8 +268,7 @@ int main(int argc, char** argv) {
|
||||
const char* version_string = 0;
|
||||
if (argv[i][2] != '\0') {
|
||||
version_string = argv[i] + 2;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (++i >= argc) {
|
||||
err = "-l needs an argument";
|
||||
goto die;
|
||||
@@ -314,7 +312,8 @@ int main(int argc, char** argv) {
|
||||
char* code = read_file(params.script_path);
|
||||
if (code == 0) return 1;
|
||||
int offset = 0;
|
||||
if (code[0] == '#' && code[1] == '!') for (offset = 2; code[offset] && code[offset] != '\n'; offset++);
|
||||
if (code[0] == '#' && code[1] == '!')
|
||||
for (offset = 2; code[offset] && code[offset] != '\n'; offset++);
|
||||
const int e = execute(code + offset, params.lua_version, argv[0], params.script_path);
|
||||
noom_free(code);
|
||||
return e;
|
||||
@@ -336,12 +335,12 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
die:
|
||||
fprintf(stderr, "%s: %s\n"
|
||||
"usage: %s [options] [script [args]]\n"
|
||||
"Available options are:\n"
|
||||
" - execute stdin\n"
|
||||
" -e stat execute string 'stat'\n"
|
||||
" -v show version\n"
|
||||
" -l [51|52|53|54] select lua version\n",
|
||||
argv[0], err, argv[0]);
|
||||
"usage: %s [options] [script [args]]\n"
|
||||
"Available options are:\n"
|
||||
" - execute stdin\n"
|
||||
" -e stat execute string 'stat'\n"
|
||||
" -v show version\n"
|
||||
" -l [51|52|53|54] select lua version\n",
|
||||
argv[0], err, argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user