|
|
@ -588,16 +588,12 @@ oop newTry(oop try, oop exception, oop catch, oop finally) |
|
|
|
return obj; |
|
|
|
} |
|
|
|
|
|
|
|
#define YY_INPUT(buf, result, max_size) \ |
|
|
|
#define YY_INPUT(yy, buf, result, max_size) \ |
|
|
|
{ \ |
|
|
|
int yyc= feof(inputStack->file) ? EOF : getc(inputStack->file); \ |
|
|
|
result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \ |
|
|
|
} |
|
|
|
|
|
|
|
#define YYSTYPE oop |
|
|
|
|
|
|
|
YYSTYPE yylval; |
|
|
|
|
|
|
|
int errorLine= 1; |
|
|
|
|
|
|
|
void syntaxError(char *text) |
|
|
@ -608,9 +604,17 @@ void syntaxError(char *text) |
|
|
|
|
|
|
|
oop eval(oop scope, oop ast); |
|
|
|
|
|
|
|
struct _yycontext; |
|
|
|
#define YYSTYPE oop |
|
|
|
|
|
|
|
YYSTYPE yylval; |
|
|
|
|
|
|
|
#define YY_ACTION(T) static T |
|
|
|
|
|
|
|
int yyparsefrom(int (*yystart)(struct _yycontext *yy)); |
|
|
|
#define YY_CTX_LOCAL 1 |
|
|
|
|
|
|
|
#define YYPARSEFROM yymeta_parsefrom |
|
|
|
#define YYPARSE yymeta_parse |
|
|
|
#define YYRELEASE yymeta_release |
|
|
|
|
|
|
|
%} |
|
|
|
|
|
|
@ -2017,7 +2021,7 @@ oop evalArgs(oop scope, oop asts) |
|
|
|
|
|
|
|
oop AST= NULL; |
|
|
|
|
|
|
|
void readEvalPrint(oop scope, char *fileName) |
|
|
|
void readEvalPrint(yycontext *yy, oop scope, char *fileName) |
|
|
|
{ |
|
|
|
inputStackPush(fileName); |
|
|
|
input_t *top= inputStack; |
|
|
@ -2026,7 +2030,7 @@ void readEvalPrint(oop scope, char *fileName) |
|
|
|
int jbt= sigsetjmp(jbs->jb, 0); |
|
|
|
|
|
|
|
if (0 == jbt) { |
|
|
|
while (yyparse()) { |
|
|
|
while (YYPARSE(yy)) { |
|
|
|
if (opt_v > 1) printf("%s:%i: ", get(inputStack->name, String, value), inputStack->lineNumber); |
|
|
|
if (!yylval) { |
|
|
|
fclose(inputStack->file); |
|
|
@ -2059,13 +2063,16 @@ void readEvalPrint(oop scope, char *fileName) |
|
|
|
|
|
|
|
oop prim_import(oop scope, oop params) |
|
|
|
{ |
|
|
|
yycontext yy, *yyctx = &yy; |
|
|
|
memset(yyctx, 0, sizeof(yy)); |
|
|
|
|
|
|
|
if (map_hasIntegerKey(params, 0)) { |
|
|
|
char *file= get(get(params, Map, elements)[0].value, String, value); |
|
|
|
if (yyctx->__pos < yyctx->__limit) { |
|
|
|
yyctx->__limit--; |
|
|
|
ungetc(yyctx->__buf[yyctx->__limit], inputStack->file); |
|
|
|
} |
|
|
|
readEvalPrint(scope, file); |
|
|
|
readEvalPrint(yyctx, scope, file); |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
@ -2314,7 +2321,7 @@ oop prim_microseconds(oop scope, oop params) |
|
|
|
return makeInteger(ru.ru_utime.tv_sec * 1000*1000 + ru.ru_utime.tv_usec); |
|
|
|
} |
|
|
|
|
|
|
|
int main(int argc, char **argv) |
|
|
|
void meta_init(void) |
|
|
|
{ |
|
|
|
# if (USE_GC) |
|
|
|
GC_INIT(); |
|
|
@ -2364,6 +2371,13 @@ int main(int argc, char **argv) |
|
|
|
#undef _DO |
|
|
|
|
|
|
|
fixScope(globals); |
|
|
|
} |
|
|
|
|
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
meta_init(); |
|
|
|
|
|
|
|
yycontext yy; |
|
|
|
|
|
|
|
int repled = 0; |
|
|
|
while (argc-- > 1) { |
|
|
@ -2371,16 +2385,19 @@ int main(int argc, char **argv) |
|
|
|
if (!strcmp(*argv, "-g")) ++opt_g; |
|
|
|
else if (!strcmp(*argv, "-v")) ++opt_v; |
|
|
|
else if (!strcmp(*argv, "-")) { |
|
|
|
readEvalPrint(globals, NULL); |
|
|
|
memset(&yy, 0, sizeof(yy)); |
|
|
|
readEvalPrint(&yy, globals, NULL); |
|
|
|
repled= 1; |
|
|
|
} |
|
|
|
else { |
|
|
|
readEvalPrint(globals, *argv); |
|
|
|
memset(&yy, 0, sizeof(yy)); |
|
|
|
readEvalPrint(&yy, globals, *argv); |
|
|
|
repled= 1; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!repled) { |
|
|
|
readEvalPrint(globals, NULL); |
|
|
|
memset(&yy, 0, sizeof(yy)); |
|
|
|
readEvalPrint(&yy, globals, NULL); |
|
|
|
} |
|
|
|
|
|
|
|
if (opt_g) { |
|
|
|