"Garbage data at end of statement" message now includes the unexpected character.

git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@170 4df02467-bbd4-4a76-a152-e7ce94205b78
This commit is contained in:
marcobaye 2020-05-18 21:51:43 +00:00
parent c07f373b53
commit 4eb3ffa149
6 changed files with 31 additions and 6 deletions

View File

@ -478,9 +478,11 @@ static const char *long_option(const char *string)
config.honor_leading_zeroes = FALSE;
else if (strcmp(string, OPTION_STRICT_SEGMENTS) == 0)
config.segment_warning_is_error = TRUE;
else if (strcmp(string, OPTION_TEST) == 0)
else if (strcmp(string, OPTION_TEST) == 0) {
if (config.test_new_features)
config.backslash_escaping = TRUE;
config.test_new_features = TRUE;
PLATFORM_LONGOPTION_CODE
} PLATFORM_LONGOPTION_CODE
else if (strcmp(string, OPTION_COLOR) == 0)
config.format_color = TRUE;
else if (strcmp(string, OPTION_VERSION) == 0)

View File

@ -29,16 +29,31 @@ struct number {
} val;
int addr_refs; // address reference count (only look at this if value is DEFINED)
};
// structure for ints/floats/TODO...
// structure for ints/floats/lists/strings (TODO)
struct type;
struct string;
struct listitem;
struct object {
struct type *type;
union {
struct number number;
struct string *string;
struct listitem *listhead;
// TODO - add string struct
} u;
};
struct string {
int length;
int refs;
char payload[1]; // real structs are malloc'd to correct size
};
struct listitem {
struct listitem *next;
struct listitem *prev;
int length; // only used if item is list head (head itself is not included in length)
int refs; // only used if item is list head
struct object payload;
};
// debugging flag, should be undefined in release version
// #define FDEBUG

View File

@ -130,6 +130,7 @@ void config_default(struct config *conf)
conf->honor_leading_zeroes = TRUE; // disabled by --ignore-zeroes
conf->segment_warning_is_error = FALSE; // enabled by --strict-segments TODO - toggle default?
conf->test_new_features = FALSE; // enabled by --test
conf->backslash_escaping = FALSE; // enabled by --test --test
}
// memory allocation stuff

View File

@ -75,6 +75,7 @@ struct config {
boolean honor_leading_zeroes; // TRUE, disabled by --ignore-zeroes
boolean segment_warning_is_error; // FALSE, enabled by --strict-segments
boolean test_new_features; // FALSE, enabled by --test
boolean backslash_escaping; // FALSE, enabled by --test --test
};
extern struct config config;

View File

@ -327,7 +327,13 @@ void Input_ensure_EOS(void) // Now GotByte = first char to test
{
SKIPSPACE();
if (GotByte) {
Throw_error("Garbage data at end of statement.");
char buf[80]; // actually needed are 51
char quote = '\'';
if (GotByte == '\'')
quote = '"';
sprintf(buf, "Garbage data at end of statement (unexpected %c%c%c).", quote, GotByte, quote); // FIXME - change in docs!
Throw_error(buf);
Input_skip_remainder();
}
}

View File

@ -9,7 +9,7 @@
#define RELEASE "0.96.5" // update before release FIXME
#define CODENAME "Fenchurch" // update before release
#define CHANGE_DATE "15 May" // update before release FIXME
#define CHANGE_DATE "18 May" // update before release FIXME
#define CHANGE_YEAR "2020" // update before release
//#define HOME_PAGE "http://home.pages.de/~mac_bacon/smorbrod/acme/"
#define HOME_PAGE "http://sourceforge.net/p/acme-crossass/" // FIXME