Added function registering, added gettext
This commit is contained in:
parent
b553e1791b
commit
65c9d12baa
|
@ -42,6 +42,7 @@
|
||||||
//#include "sym_table.h"
|
//#include "sym_table.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "../gm-support.h"
|
||||||
|
|
||||||
static Stmt *prog_start;
|
static Stmt *prog_start;
|
||||||
static int dollars_ok;
|
static int dollars_ok;
|
||||||
|
@ -306,9 +307,9 @@ excepts:
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (!tmp->codes)
|
if (!tmp->codes)
|
||||||
yyerror("Unreachable EXCEPT clause");
|
yyerror(_("Unreachable EXCEPT clause"));
|
||||||
else if (count > 255)
|
else if (count > 255)
|
||||||
yyerror("Too many EXCEPT clauses (max. 255)");
|
yyerror(_("Too many EXCEPT clauses (max. 255)"));
|
||||||
}
|
}
|
||||||
except
|
except
|
||||||
{
|
{
|
||||||
|
@ -420,7 +421,7 @@ expr:
|
||||||
| '$'
|
| '$'
|
||||||
{
|
{
|
||||||
if (!dollars_ok)
|
if (!dollars_ok)
|
||||||
yyerror("Illegal context for `$' expression.");
|
yyerror(_("Illegal context for `$' expression."));
|
||||||
$$ = alloc_expr(EXPR_LENGTH);
|
$$ = alloc_expr(EXPR_LENGTH);
|
||||||
}
|
}
|
||||||
| expr '=' expr
|
| expr '=' expr
|
||||||
|
@ -433,15 +434,15 @@ expr:
|
||||||
e->e.scatter = scatter_from_arglist(e->e.list);
|
e->e.scatter = scatter_from_arglist(e->e.list);
|
||||||
vet_scatter(e->e.scatter);
|
vet_scatter(e->e.scatter);
|
||||||
} else
|
} else
|
||||||
yyerror("Empty list in scattering assignment.");
|
yyerror(_("Empty list in scattering assignment."));
|
||||||
} else {
|
} else {
|
||||||
if (e->kind == EXPR_RANGE)
|
if (e->kind == EXPR_RANGE)
|
||||||
e = e->e.range.base;
|
e = e->e.range.base;
|
||||||
while (e->kind == EXPR_INDEX)
|
while (e->kind == EXPR_INDEX)
|
||||||
e = e->e.bin.lhs;
|
e = e->e.bin.lhs;
|
||||||
if (e->kind != EXPR_ID && e->kind != EXPR_PROP)
|
if (e->kind != EXPR_ID && e->kind != EXPR_PROP)
|
||||||
yyerror("Illegal expression on left side of"
|
yyerror(_("Illegal expression on left side of"
|
||||||
" assignment.");
|
" assignment."));
|
||||||
}
|
}
|
||||||
$$ = alloc_binary(EXPR_ASGN, $1, $3);
|
$$ = alloc_binary(EXPR_ASGN, $1, $3);
|
||||||
}
|
}
|
||||||
|
@ -465,7 +466,7 @@ expr:
|
||||||
|
|
||||||
fname->e.var.v.str = $1;
|
fname->e.var.v.str = $1;
|
||||||
a->next = $3;
|
a->next = $3;
|
||||||
warning("Unknown built-in function: ", $1);
|
warning(_("Unknown built-in function: "), $1);
|
||||||
$$->e.call.func = number_func_by_name("call_function");
|
$$->e.call.func = number_func_by_name("call_function");
|
||||||
$$->e.call.args = a;
|
$$->e.call.args = a;
|
||||||
} else {
|
} else {
|
||||||
|
@ -787,7 +788,7 @@ start_over:
|
||||||
goto start_over;
|
goto start_over;
|
||||||
}
|
}
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
yyerror("End of program while in a comment");
|
yyerror(_("End of program while in a comment"));
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -807,7 +808,7 @@ start_over:
|
||||||
c = lex_getc();
|
c = lex_getc();
|
||||||
}
|
}
|
||||||
if (!isdigit(c)) {
|
if (!isdigit(c)) {
|
||||||
yyerror("Malformed object number");
|
yyerror(_("Malformed object number"));
|
||||||
lex_ungetc(c);
|
lex_ungetc(c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -863,7 +864,7 @@ start_over:
|
||||||
c = lex_getc();
|
c = lex_getc();
|
||||||
}
|
}
|
||||||
if (!isdigit(c)) {
|
if (!isdigit(c)) {
|
||||||
yyerror("Malformed floating-point literal");
|
yyerror(_("Malformed floating-point literal"));
|
||||||
lex_ungetc(c);
|
lex_ungetc(c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -882,7 +883,7 @@ start_over:
|
||||||
|
|
||||||
d = strtod(reset_stream(token_stream), 0);
|
d = strtod(reset_stream(token_stream), 0);
|
||||||
if (!IS_REAL(d)) {
|
if (!IS_REAL(d)) {
|
||||||
yyerror("Floating-point literal out of range");
|
yyerror(_("Floating-point literal out of range"));
|
||||||
d = 0.0;
|
d = 0.0;
|
||||||
}
|
}
|
||||||
yylval.real = alloc_float(d);
|
yylval.real = alloc_float(d);
|
||||||
|
@ -910,7 +911,7 @@ start_over:
|
||||||
return t;
|
return t;
|
||||||
} else { /* New keyword being used as an identifier */
|
} else { /* New keyword being used as an identifier */
|
||||||
if (!must_rename_keywords)
|
if (!must_rename_keywords)
|
||||||
warning("Renaming old use of new keyword: ", buf);
|
warning(_("Renaming old use of new keyword: "), buf);
|
||||||
must_rename_keywords = 1;
|
must_rename_keywords = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -927,7 +928,7 @@ start_over:
|
||||||
if (c == '\\')
|
if (c == '\\')
|
||||||
c = lex_getc();
|
c = lex_getc();
|
||||||
if (c == '\n' || c == EOF) {
|
if (c == '\n' || c == EOF) {
|
||||||
yyerror("Missing quote");
|
yyerror(_("Missing quote"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
stream_add_char(token_stream, c);
|
stream_add_char(token_stream, c);
|
||||||
|
@ -978,7 +979,7 @@ scatter_from_arglist(Arg_List *a)
|
||||||
dealloc_node(a->expr);
|
dealloc_node(a->expr);
|
||||||
dealloc_node(a);
|
dealloc_node(a);
|
||||||
} else {
|
} else {
|
||||||
yyerror("Scattering assignment targets must be simple variables.");
|
yyerror(_("Scattering assignment targets must be simple variables."));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -994,7 +995,7 @@ vet_scatter(Scatter *sc)
|
||||||
for (; sc; sc = sc->next) {
|
for (; sc; sc = sc->next) {
|
||||||
if (sc->kind == SCAT_REST) {
|
if (sc->kind == SCAT_REST) {
|
||||||
if (seen_rest)
|
if (seen_rest)
|
||||||
yyerror("More than one `@' target in scattering assignment.");
|
yyerror(_("More than one `@' target in scattering assignment."));
|
||||||
else
|
else
|
||||||
seen_rest = 1;
|
seen_rest = 1;
|
||||||
}
|
}
|
||||||
|
@ -1002,7 +1003,7 @@ vet_scatter(Scatter *sc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 255)
|
if (count > 255)
|
||||||
yyerror("Too many targets in scattering assignment.");
|
yyerror(_("Too many targets in scattering assignment."));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct loop_entry {
|
struct loop_entry {
|
||||||
|
@ -1067,9 +1068,9 @@ check_loop_name(const char *name, enum loop_exit_kind kind)
|
||||||
if (!name) {
|
if (!name) {
|
||||||
if (!loop_stack || loop_stack->is_barrier) {
|
if (!loop_stack || loop_stack->is_barrier) {
|
||||||
if (kind == LOOP_BREAK)
|
if (kind == LOOP_BREAK)
|
||||||
yyerror("No enclosing loop for `break' statement");
|
yyerror(_("No enclosing loop for `break' statement"));
|
||||||
else
|
else
|
||||||
yyerror("No enclosing loop for `continue' statement");
|
yyerror(_("No enclosing loop for `continue' statement"));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1101,6 +1102,8 @@ parse_program(DB_Version version, Parser_Client c, void *data)
|
||||||
dollars_ok = 0;
|
dollars_ok = 0;
|
||||||
loop_stack = 0;
|
loop_stack = 0;
|
||||||
language_version = version;
|
language_version = version;
|
||||||
|
|
||||||
|
register_bi_functions();
|
||||||
|
|
||||||
begin_code_allocation();
|
begin_code_allocation();
|
||||||
yyparse();
|
yyparse();
|
||||||
|
|
Reference in New Issue