mirror of
https://github.com/uffejakobsen/acme.git
synced 2024-11-26 15:49:18 +00:00
added warnings about binary/octal/hex numbers without any digits, will be error in future! also renamed a function.
git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@159 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
parent
40afd3311a
commit
365306428b
@ -429,7 +429,8 @@ static void parse_binary_literal(void) // Now GotByte = "%" or "b"
|
||||
}
|
||||
break; // found illegal character
|
||||
}
|
||||
// FIXME - add error check for "binary literal has no digits!"
|
||||
if (!digits)
|
||||
Throw_warning("Binary literal without any digits"); // FIXME - make into error!
|
||||
// set force bits
|
||||
if (config.honor_leading_zeroes) {
|
||||
if (digits > 8) {
|
||||
@ -475,7 +476,8 @@ static void parse_hex_literal(void) // Now GotByte = "$" or "x"
|
||||
}
|
||||
break; // found illegal character
|
||||
}
|
||||
// FIXME - add error check for "hex literal has no digits!"
|
||||
if (!digits)
|
||||
Throw_warning("Hex literal without any digits"); // FIXME - make into error!
|
||||
// set force bits
|
||||
if (config.honor_leading_zeroes) {
|
||||
if (digits > 2) {
|
||||
@ -571,7 +573,8 @@ static void parse_octal_literal(void) // Now GotByte = "&"
|
||||
++digits;
|
||||
GetByte();
|
||||
}
|
||||
// FIXME - add error check for "octal literal has no digits!"
|
||||
if (!digits)
|
||||
Throw_warning("Octal literal without any digits"); // FIXME - make into error!
|
||||
// set force bits
|
||||
if (config.honor_leading_zeroes) {
|
||||
if (digits > 3) {
|
||||
|
@ -59,14 +59,14 @@ void flow_forloop(struct for_loop *loop)
|
||||
loop_counter.u.number.flags = NUMBER_IS_DEFINED;
|
||||
loop_counter.u.number.val.intval = loop->counter.first;
|
||||
loop_counter.u.number.addr_refs = loop->counter.addr_refs;
|
||||
symbol_set_value(loop->symbol, &loop_counter, TRUE);
|
||||
symbol_set_object(loop->symbol, &loop_counter, TRUE);
|
||||
if (loop->use_old_algo) {
|
||||
// old algo for old syntax:
|
||||
// if count == 0, skip loop
|
||||
if (loop->counter.last) {
|
||||
do {
|
||||
loop_counter.u.number.val.intval += loop->counter.increment;
|
||||
symbol_set_value(loop->symbol, &loop_counter, TRUE);
|
||||
symbol_set_object(loop->symbol, &loop_counter, TRUE);
|
||||
parse_ram_block(&loop->block);
|
||||
} while (loop_counter.u.number.val.intval < loop->counter.last);
|
||||
}
|
||||
@ -75,7 +75,7 @@ void flow_forloop(struct for_loop *loop)
|
||||
do {
|
||||
parse_ram_block(&loop->block);
|
||||
loop_counter.u.number.val.intval += loop->counter.increment;
|
||||
symbol_set_value(loop->symbol, &loop_counter, TRUE);
|
||||
symbol_set_object(loop->symbol, &loop_counter, TRUE);
|
||||
} while (loop_counter.u.number.val.intval != (loop->counter.last + loop->counter.increment));
|
||||
}
|
||||
// restore previous input:
|
||||
|
@ -59,7 +59,6 @@ extern void flow_do_while(struct do_while *loop);
|
||||
extern void flow_parse_and_close_file(FILE *fd, const char *filename);
|
||||
// parse {block} [else {block}]
|
||||
extern void flow_parse_block_else_block(boolean parse_first);
|
||||
// TODO - add an "else if" possibility
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -722,7 +722,7 @@ static enum eos po_set(void) // now GotByte = illegal char
|
||||
}
|
||||
}
|
||||
// FIXME - take a good look at the flags handling above and in the fn called below and clean this up!
|
||||
symbol_set_value(symbol, &result, TRUE);
|
||||
symbol_set_object(symbol, &result, TRUE);
|
||||
return ENSURE_EOS;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ struct symbol *symbol_find(scope_t scope, int flags)
|
||||
|
||||
// assign value to symbol. the function acts upon the symbol's flag bits and
|
||||
// produces an error if needed.
|
||||
void symbol_set_value(struct symbol *symbol, struct object *new_value, boolean change_allowed)
|
||||
void symbol_set_object(struct symbol *symbol, struct object *new_value, boolean change_allowed)
|
||||
{
|
||||
int flags; // for int/float re-definitions
|
||||
|
||||
@ -210,7 +210,7 @@ void symbol_set_label(scope_t scope, int stat_flags, int force_bit, boolean chan
|
||||
result.u.number.flags = pc.flags & NUMBER_IS_DEFINED;
|
||||
result.u.number.val.intval = pc.val.intval;
|
||||
result.u.number.addr_refs = pc.addr_refs;
|
||||
symbol_set_value(symbol, &result, change_allowed);
|
||||
symbol_set_object(symbol, &result, change_allowed);
|
||||
// global labels must open new scope for cheap locals
|
||||
if (scope == SCOPE_GLOBAL)
|
||||
section_new_cheap_scope(section_now);
|
||||
@ -239,7 +239,7 @@ void symbol_parse_definition(scope_t scope, int stat_flags)
|
||||
|| (result.type == &type_float))
|
||||
result.u.number.addr_refs = 1;
|
||||
}
|
||||
symbol_set_value(symbol, &result, FALSE);
|
||||
symbol_set_object(symbol, &result, FALSE);
|
||||
Input_ensure_EOS();
|
||||
} else {
|
||||
// implicit symbol definition (label)
|
||||
@ -259,7 +259,7 @@ void symbol_define(intval_t value)
|
||||
result.u.number.flags = NUMBER_IS_DEFINED;
|
||||
result.u.number.val.intval = value;
|
||||
symbol = symbol_find(SCOPE_GLOBAL, 0);
|
||||
symbol_set_value(symbol, &result, TRUE);
|
||||
symbol_set_object(symbol, &result, TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,8 +29,7 @@ extern struct rwnode *symbols_forest[]; // trees (because of 8-bit hash)
|
||||
|
||||
|
||||
// function acts upon the symbol's flag bits and produces an error if needed.
|
||||
// FIXME - rename to symbol_set_object!
|
||||
extern void symbol_set_value(struct symbol *symbol, struct object *new_value, boolean change_allowed);
|
||||
extern void symbol_set_object(struct symbol *symbol, struct object *new_value, boolean change_allowed);
|
||||
// parse label definition (can be either global or local).
|
||||
// name must be held in GlobalDynaBuf.
|
||||
extern void symbol_set_label(scope_t scope, int stat_flags, int force_bit, boolean change_allowed);
|
||||
|
Loading…
Reference in New Issue
Block a user