Skip to content

Commit

Permalink
WIP: time functions. Remove OP_PUSH_INT. Add OP_PUSH_INT32, OP_PUSH_I…
Browse files Browse the repository at this point in the history
…NT64.
  • Loading branch information
ilyash committed May 11, 2017
1 parent 6f3a120 commit df15b13
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 129 deletions.
2 changes: 1 addition & 1 deletion ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void print_ast(ast_node *node, int level) {
switch(node->type) {
case CALL_NODE:
case INT_NODE:
snprintf(info, AST_NODE_INFO_STR_LEN-1, "%d", node->number);
snprintf(info, AST_NODE_INFO_STR_LEN-1, "%ld", node->number);
break;
case REAL_NODE:
snprintf(info, AST_NODE_INFO_STR_LEN-1, NGS_REAL_FMT, (*(NGS_REAL *)node->data));
Expand Down
3 changes: 2 additions & 1 deletion ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ typedef struct {
typedef struct ast_node {
unsigned int type;
char *name;
int number;
// MAYBE TODO: make it int but store parsed long int values somewhere else
long int number;
void *data;
// Chidren
struct ast_node *first_child;
Expand Down
65 changes: 36 additions & 29 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#define OPCODE(buf, x) { (buf)[*idx]=x; (*idx)++; }
#define L8_STR(buf, x) { int l = strlen(x); assert(l<256); OPCODE(buf, l); memcpy((buf)+(*idx), x, l); (*idx) += l; }
#define DATA(buf, x) { memcpy((buf)+(*idx), &(x), sizeof(x)); (*idx) += sizeof(x); }
#define DATA_INT(buf, x) { *(int *)&(buf)[*idx] = x; (*idx)+=sizeof(int); }
#define DATA_INT32(buf, x) { *(int32_t *)&(buf)[*idx] = x; (*idx)+=sizeof(int32_t); }
#define DATA_INT64(buf, x) { *(int64_t *)&(buf)[*idx] = x; (*idx)+=sizeof(int64_t); }
#define DATA_UINT16(buf, x) { *(uint16_t *)&(buf)[*idx] = x; (*idx)+=sizeof(uint16_t); }
#define DATA_UINT32(buf, x) { *(uint32_t *)&(buf)[*idx] = x; (*idx)+=sizeof(uint32_t); }
#define DATA_JUMP_OFFSET(buf, x) { *(JUMP_OFFSET *)&(buf)[*idx] = x; (*idx)+=sizeof(JUMP_OFFSET); }
Expand Down Expand Up @@ -395,7 +396,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
}
}
if(have_arr_splat) {
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0);
OPCODE(*buf, OP_MAKE_ARR);
STACK_DEPTH++;
}
Expand All @@ -416,7 +417,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
// Setup named arguments
doing_named_args = 1;
// TODO: maybe special opcode for creating an empty hash?
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0);
OPCODE(*buf, OP_MAKE_HASH);
STACK_DEPTH++;
argc++;
Expand All @@ -440,7 +441,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
// Setup named arguments
doing_named_args = 1;
// TODO: maybe special opcode for creating an empty hash?
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0);
OPCODE(*buf, OP_MAKE_HASH);
argc++;
}
Expand All @@ -466,7 +467,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
}
if(!have_arr_splat) {
assert(argc <= MAX_ARGS); // TODO: Exception
OPCODE(*buf, OP_PUSH_INT); DATA(*buf, argc);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, argc);
STACK_DEPTH++;
}
if(node->first_child->type == ATTR_NODE) {
Expand Down Expand Up @@ -494,7 +495,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
compile_main_section(ctx, node->first_child->next_sibling, buf, idx, allocated, NEED_RESULT);
}
STACK_DEPTH++;
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 2);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 2);
STACK_DEPTH++;
compile_identifier(ctx, buf, idx, node->type == INDEX_NODE ? "[]" : (node->type == NS_NODE ? "::" : "."), OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
Expand All @@ -504,7 +505,13 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
case INT_NODE:
/*printf("Compiling tNUMBER @ %d\n", *idx);*/
if(need_result) {
OPCODE(*buf, OP_PUSH_INT); DATA(*buf, node->number);
// (>> TAG_BITS) is workaround for highest bits of OP_PUSH_INT32 get lost
if(node->number < (INT32_MIN >> TAG_BITS) || node->number > (INT32_MAX >> TAG_BITS)) {
OPCODE(*buf, OP_PUSH_INT64); DATA_INT64(*buf, node->number);
} else {
int n = (int) node->number;
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, n);
}
}
break;
case REAL_NODE:
Expand All @@ -530,7 +537,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
compile_main_section(ctx, ptr->first_child, buf, idx, allocated, NEED_RESULT);
compile_main_section(ctx, ptr->first_child->next_sibling, buf, idx, allocated, NEED_RESULT);
compile_main_section(ctx, node->first_child->next_sibling, buf, idx, allocated, NEED_RESULT);
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 3);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 3);
compile_identifier(ctx, buf, idx, "[]=", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
POP_IF_DONT_NEED_RESULT(*buf);
Expand All @@ -541,7 +548,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
compile_main_section(ctx, ptr->first_child, buf, idx, allocated, NEED_RESULT);
compile_attr_name(ctx, ptr->first_child->next_sibling, buf, idx, allocated, NEED_RESULT);
compile_main_section(ctx, node->first_child->next_sibling, buf, idx, allocated, NEED_RESULT);
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 3);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 3);
compile_identifier(ctx, buf, idx, ptr->type == ATTR_NODE ? ".=" : "::=", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
POP_IF_DONT_NEED_RESULT(*buf);
Expand Down Expand Up @@ -595,7 +602,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
}
}
if(have_arr_splat) {
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0);
OPCODE(*buf, OP_MAKE_ARR);
}
for(argc=0, ptr=node->first_child; ptr; argc++, ptr=ptr->next_sibling) {
Expand All @@ -610,7 +617,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
}
}
if(!have_arr_splat) {
OPCODE(*buf, OP_PUSH_INT); DATA(*buf, argc);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, argc);
OPCODE(*buf, OP_MAKE_ARR);
}
POP_IF_DONT_NEED_RESULT(*buf);
Expand Down Expand Up @@ -693,7 +700,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
DATA_N_LOCAL_VARS(*buf, n_params_optional);
DATA_N_LOCAL_VARS(*buf, n_locals);
DATA_N_UPVAR_INDEX(*buf, n_uplevels);
DATA_INT(*buf, params_flags);
DATA_INT32(*buf, params_flags);

// Doc
compile_main_section(ctx, node->first_child->next_sibling->next_sibling, buf, idx, allocated, NEED_RESULT);
Expand Down Expand Up @@ -726,10 +733,10 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
case STR_COMP_SPLAT_EXPANSION_NODE: OPCODE(*buf, OP_MAKE_STR_SPLAT_EXP); break;
}
}
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, argc);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, argc);
OPCODE(*buf, OP_MAKE_ARR);

OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 1);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 1);
// OPCODE(*buf, OP_MAKE_SPLAT_STR);
compile_identifier(ctx, buf, idx, "\"$*\"", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
Expand All @@ -747,8 +754,8 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
case 1:
break;
default:
OPCODE(*buf, OP_PUSH_INT);
DATA_INT(*buf, argc);
OPCODE(*buf, OP_PUSH_INT32);
DATA_INT32(*buf, argc);
OPCODE(*buf, OP_MAKE_STR);
}
}
Expand Down Expand Up @@ -828,7 +835,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
}
}
if(have_hash_splat) {
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0);
OPCODE(*buf, OP_MAKE_HASH);
for(argc=0, ptr=node->first_child; ptr; argc++, ptr=ptr->next_sibling) {
if(ptr->type == HASH_SPLAT_NODE) {
Expand All @@ -846,7 +853,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
compile_main_section(ctx, ptr->first_child, buf, idx, allocated, NEED_RESULT);
compile_main_section(ctx, ptr->first_child->next_sibling, buf, idx, allocated, NEED_RESULT);
}
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, argc);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, argc);
OPCODE(*buf, OP_MAKE_HASH);
}
POP_IF_DONT_NEED_RESULT(*buf);
Expand Down Expand Up @@ -934,8 +941,8 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
OPCODE(*buf, OP_PUSH_NULL);
OPCODE(*buf, OP_XCHG);

OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 1); // One argument for the call of handler function(s)
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0); // Make array with zero elements
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 1); // One argument for the call of handler function(s)
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0); // Make array with zero elements
OPCODE(*buf, OP_MAKE_ARR);
for(ptr=node->first_child->next_sibling; ptr; ptr=ptr->next_sibling) {
compile_main_section(ctx, ptr, buf, idx, allocated, NEED_RESULT);
Expand All @@ -962,7 +969,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
case COMMAND_NODE:
OPCODE(*buf, OP_PUSH_NULL); // Placeholder for return value
// argv
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0); // Make array with zero elements
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0); // Make array with zero elements
OPCODE(*buf, OP_MAKE_ARR);
for(ptr=node->first_child->next_sibling->first_child; ptr; ptr=ptr->next_sibling) {
if(ptr->type == ARR_SPLAT_NODE) {
Expand All @@ -975,7 +982,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
OPCODE(*buf, OP_ARR_APPEND);
}
// redirects
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0); // Make array with zero elements
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0); // Make array with zero elements
OPCODE(*buf, OP_MAKE_ARR);
for(ptr=node->first_child->next_sibling->next_sibling->first_child; ptr; ptr=ptr->next_sibling) {
compile_main_section(ctx, ptr, buf, idx, allocated, NEED_RESULT);
Expand All @@ -986,7 +993,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,

OPCODE(*buf, OP_MAKE_CMD);

OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 1);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 1);
compile_identifier(ctx, buf, idx, node->first_child->name, OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
POP_IF_DONT_NEED_RESULT(*buf);
Expand Down Expand Up @@ -1042,21 +1049,21 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
switch((switch_node_subtype)node->number) {
case SWITCH_NODE_SWITCH:
case SWITCH_NODE_ESWITCH:
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 2);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 2);
compile_identifier(ctx, buf, idx, "==", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
break;
case SWITCH_NODE_MATCH:
case SWITCH_NODE_EMATCH:
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 2);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 2);
compile_identifier(ctx, buf, idx, "match", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
case SWITCH_NODE_COND:
case SWITCH_NODE_ECOND:
OPCODE(*buf, OP_TO_BOOL);
break;
default:
fprintf(stderr, "ERROR: SWITCH_NODE subtype %i %i\n", node->number, SWITCH_NODE_COND);
fprintf(stderr, "ERROR: SWITCH_NODE subtype %li %i\n", node->number, SWITCH_NODE_COND);
assert(0 == "Unsupported SWITCH_NODE subtype");
}
OPCODE(*buf, OP_JMP_FALSE);
Expand All @@ -1081,7 +1088,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
}
// TOOD: optimize - OP_PUSH_NULL is not needed if result is not needed
if(node->number & 1) {
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 0);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 0);
compile_identifier(ctx, buf, idx, "SwitchFail", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
// TODO: attribute with offending value
OPCODE(*buf, OP_CALL);
Expand Down Expand Up @@ -1110,7 +1117,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
OPCODE(*buf, OP_PUSH_NULL);
compile_main_section(ctx, node->first_child, buf, idx, allocated, NEED_RESULT);
compile_main_section(ctx, node->first_child->next_sibling, buf, idx, allocated, NEED_RESULT);
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 2);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 2);
compile_identifier(ctx, buf, idx, "//", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
POP_IF_DONT_NEED_RESULT(*buf);
Expand All @@ -1119,7 +1126,7 @@ void compile_main_section(COMPILATION_CONTEXT *ctx, ast_node *node, char **buf,
case TABLE_LIT_NODE:
OPCODE(*buf, OP_PUSH_NULL);
compile_main_section(ctx, node->first_child, buf, idx, allocated, NEED_RESULT);
OPCODE(*buf, OP_PUSH_INT); DATA_INT(*buf, 1);
OPCODE(*buf, OP_PUSH_INT32); DATA_INT32(*buf, 1);
compile_identifier(ctx, buf, idx, "table", OP_FETCH_LOCAL, OP_FETCH_UPVAR, OP_FETCH_GLOBAL);
OPCODE(*buf, OP_CALL);
POP_IF_DONT_NEED_RESULT(*buf);
Expand Down
4 changes: 3 additions & 1 deletion decompile.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ void decompile(const char *buf, const size_t start, const size_t end) {
case OP_UPVAR_DEF_P:
case OP_DEF_UPVAR_FUNC:
sprintf(info_buf, " uplevel=%d, index=%d", *(UPVAR_INDEX *)&buf[idx], *(LOCAL_VAR_INDEX *)&buf[idx+sizeof(UPVAR_INDEX)]); idx+=sizeof(UPVAR_INDEX)+sizeof(LOCAL_VAR_INDEX); break;
case OP_PUSH_INT:
case OP_PUSH_INT32:
sprintf(info_buf, " %d", *(int32_t *)&buf[idx]); idx+=4; break;
case OP_PUSH_INT64:
sprintf(info_buf, " %ld", *(int64_t *)&buf[idx]); idx+=8; break;
case OP_PUSH_REAL:
sprintf(info_buf, " " NGS_REAL_FMT, *(NGS_REAL *)&buf[idx]); idx+=sizeof(NGS_REAL); break;
case OP_PUSH_L8_STR:
Expand Down
44 changes: 31 additions & 13 deletions lib/stdlib.ngs
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,7 @@ stdlib_error_fd = ENV.NGS_ERR_FD.Int() tor 2

doc Log to standard output. Later log output will be treated specially by the shell. It will have suitable representation in the UI. Use log() when it's semantically a log.
F log(s:Str) {
echo(stdlib_error_fd, "[LOG ${strftime(LOG_TIME_FORMAT)} GMT] $s")
echo(stdlib_error_fd, "[LOG ${Time()}] $s")
}

doc Same as debug('default', s)
Expand All @@ -2692,7 +2692,7 @@ F debug(s:Str) debug('default', s)
doc Debug to standard error.
doc "DEBUG" environment variable must be non-empty string to activate. Otherwise nothing is outputted.
doc TODO: Not output thread ID if there is only one thread.
doc TODO: Timestamps?
doc TODO: Timestamps? Timestamps acquiring might not be safe after fork before exec.
F debug(facility:Str, s:Str) {
if ENV.Box('DEBUG').map(split(X, ',')).map({facility in A or '*' in A}).get(false) {
echo(stdlib_error_fd, "[DEBUG $facility ${c_getpid()} ${c_pthread_self().id()}] $s")
Expand All @@ -2701,25 +2701,25 @@ F debug(facility:Str, s:Str) {

doc Write error message to standard error.
F error(s:Str) {
echo(stdlib_error_fd, "[ERROR ${strftime(LOG_TIME_FORMAT)} GMT] $s")
echo(stdlib_error_fd, "[ERROR ${Time()}] $s")
}

doc Write error message to standard error.
F warn(s:Str) {
echo(stdlib_error_fd, "[WARNING ${strftime(LOG_TIME_FORMAT)} GMT] $s")
echo(stdlib_error_fd, "[WARNING ${Time()}] $s")
}

doc Send status to standard error.
doc Later status output will be treated specially by the shell. It will have suitable representation in the UI.
doc Use status() when it's semantically a status - a task that's being done.
F status(s:Str) {
echo(stdlib_error_fd, "[STATUS ${strftime(LOG_TIME_FORMAT)} GMT] $s")
echo(stdlib_error_fd, "[STATUS ${Time()}] $s")
}

doc Write message in s to standard error and exit
F die(s:Str, exit_code=1) {
c = Str(Backtrace().frames[-2].closure) tor "at unknown location"
echo(stdlib_error_fd, "[FATAL ERROR ${strftime(LOG_TIME_FORMAT)} GMT] $s -- $c")
echo(stdlib_error_fd, "[FATAL ERROR ${Time()}] $s -- $c")
c_exit(exit_code)
}

Expand Down Expand Up @@ -4169,11 +4169,14 @@ exit_hook = Hook()
}
}

# === time =======================================
# === Time =======================================

{ type TimeFail(CException) }
{
type Time
type TimeFail(CException)
}

LOG_TIME_FORMAT = ENV.get('NGS_LOG_TIME_FORMAT', '%Y-%m-%d %H:%M:%S')
TIME_FORMAT = ENV.get('NGS_TIME_FORMAT', '%F %T %Z')

F time() {
ret = c_time()
Expand All @@ -4182,27 +4185,42 @@ F time() {
}

# TODO: handle errors
doc Low-level function. Do not use directly. Use Time type.
F gmtime(t:Int) {
ret = c_gmtime(t)
ret
}

# TODO: handle errors
doc Low-level function. Do not use directly. Use Time type.
F localtime(t:Int) {
ret = c_localtime(t)
ret
}

F strftime(format:Str) strftime(gmtime(time()), format)

F strftime(t:Int, format:Str) strftime(gmtime(t), format)

doc Low-level function. Do not use directly. Use Time type.
F strftime(tm:c_tm, format:Str) {
ret = c_strftime(tm, format)
ret is Null throws TimeFail("Failed to c_strftime()").set('tm', tm).set('format', format)
ret
}

F init(t:Time) {
t.epoch = time()
}

F init(t:Time, epoch:Int) {
t.epoch = epoch
}

doc String representation of Time
doc format - strftime(3) format
doc gmt - Use GMT time zone (defaults to local time zone)
F Str(t:Time, format:Str=TIME_FORMAT, gmt:Bool=false) strftime([localtime, gmtime][Int(gmt)](t.epoch), TIME_FORMAT)

F Int(t:Time) t.epoch



# === Random =====================================
# This is _not_ crypto safe random!
Expand Down
2 changes: 1 addition & 1 deletion syntax.leg
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ number =
|
<[-+]?[0-9]+> {
MAKE_NODE(ret, INT_NODE);
ret->number = atoi(yytext);
ret->number = atol(yytext);
$$ = ret;
}

Expand Down
Loading

0 comments on commit df15b13

Please sign in to comment.