/* checks syntax and translates such directives into */
/* specifications for the object-maker. */
/* */
-/* Copyright (c) Graham Nelson 1993 - 2020 */
-/* */
-/* This file is part of Inform. */
+/* Part of Inform 6.35 */
+/* copyright (c) Graham Nelson 1993 - 2021 */
/* */
/* Inform is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
-/* along with Inform. If not, see https://gnu.org/licenses/ */
+/* along with Inform. If not, see https://gnu.org/licenses/ *
/* */
/* ------------------------------------------------------------------------- */
get_next_token();
i = token_value; name = token_text;
- if ((token_type != SYMBOL_TT) || (!(sflags[i] & UNKNOWN_SFLAG)))
+ if (token_type != SYMBOL_TT)
{ discard_token_location(beginning_debug_location);
ebf_error("new attribute name", token_text);
panic_mode_error_recovery();
put_token_back();
return;
}
+ if (!(sflags[i] & UNKNOWN_SFLAG))
+ { discard_token_location(beginning_debug_location);
+ ebf_symbol_error("new attribute name", token_text, typename(stypes[i]), slines[i]);
+ panic_mode_error_recovery();
+ put_token_back();
+ return;
+ }
directive_keywords.enabled = TRUE;
get_next_token();
get_next_token();
i = token_value; name = token_text;
- if ((token_type != SYMBOL_TT) || (!(sflags[i] & UNKNOWN_SFLAG)))
+ if (token_type != SYMBOL_TT)
{ discard_token_location(beginning_debug_location);
ebf_error("new property name", token_text);
panic_mode_error_recovery();
put_token_back();
return;
}
+ if (!(sflags[i] & UNKNOWN_SFLAG))
+ { discard_token_location(beginning_debug_location);
+ ebf_symbol_error("new property name", token_text, typename(stypes[i]), slines[i]);
+ panic_mode_error_recovery();
+ put_token_back();
+ return;
+ }
directive_keywords.enabled = TRUE;
get_next_token();
{ uchar *tmp;
if (mark+1+510 >= MAX_PROP_TABLE_SIZE)
memoryerror("MAX_PROP_TABLE_SIZE",MAX_PROP_TABLE_SIZE);
- tmp = translate_text(p+mark+1,p+mark+1+510,shortname);
+ tmp = translate_text(p+mark+1,p+mark+1+510,shortname,STRCTX_OBJNAME);
if (!tmp) error ("Short name of object exceeded 765 Z-characters");
i = subtract_pointers(tmp,(p+mark+1));
p[mark] = i/2;
}
objectsg[no_objects].shortname = compile_string(shortname_buffer,
- FALSE, FALSE);
+ STRCTX_OBJNAME);
/* The properties table consists simply of a sequence of property
blocks, one for each object in order of definition, exactly as
{ if (stypes[token_value]==INDIVIDUAL_PROPERTY_T)
this_identifier_number = svals[token_value];
else
- { char already_error[128];
- sprintf(already_error,
- "\"%s\" is a name already in use (with type %s) \
-and may not be used as a property name too",
- token_text, typename(stypes[token_value]));
- error(already_error);
+ { ebf_symbol_error("property name", token_text, typename(stypes[token_value]), slines[token_value]);
return;
}
}
{ if (stypes[token_value]==INDIVIDUAL_PROPERTY_T)
this_identifier_number = svals[token_value];
else
- { char already_error[128];
- sprintf(already_error,
- "\"%s\" is a name already in use (with type %s) \
-and may not be used as a property name too",
- token_text, typename(stypes[token_value]));
- error(already_error);
+ { ebf_symbol_error("property name", token_text, typename(stypes[token_value]), slines[token_value]);
return;
}
}
if (token_type == SEGMENT_MARKER_TT) { put_token_back(); break; }
if ((!individual_property) && (property_number==1)
- && (token_type != SQ_TT) && (token_type != DQ_TT)
+ && ((token_type != SQ_TT) || (strlen(token_text) <2 ))
+ && (token_type != DQ_TT)
)
warning ("'name' property should only contain dictionary words");
{ int n, duplicates_to_make = 0, class_number = no_objects+1,
metaclass_flag = (metaclass_name != NULL);
char duplicate_name[128];
- int class_symbol;
debug_location_beginning beginning_debug_location =
get_token_location_beginning();
}
else
{ get_next_token();
- if ((token_type != SYMBOL_TT)
- || (!(sflags[token_value] & UNKNOWN_SFLAG)))
+ if (token_type != SYMBOL_TT)
{ discard_token_location(beginning_debug_location);
ebf_error("new class name", token_text);
panic_mode_error_recovery();
return;
}
+ if (!(sflags[token_value] & UNKNOWN_SFLAG))
+ { discard_token_location(beginning_debug_location);
+ ebf_symbol_error("new class name", token_text, typename(stypes[token_value]), slines[token_value]);
+ panic_mode_error_recovery();
+ return;
+ }
}
/* Each class also creates a modest object representing itself: */
full_object_g.propdata[0].marker = OBJECT_MV;
}
- class_symbol = token_value;
-
if (!metaclass_flag)
{ get_next_token();
if ((token_type == SEP_TT) && (token_value == OPENB_SEP))
if (token_type == DQ_TT) textual_name = token_text;
else
- { if ((token_type != SYMBOL_TT)
- || (!(sflags[token_value] & UNKNOWN_SFLAG)))
+ { if (token_type != SYMBOL_TT) {
ebf_error("name for new object or its textual short name",
token_text);
+ }
+ else if (!(sflags[token_value] & UNKNOWN_SFLAG)) {
+ ebf_symbol_error("new object", token_text, typename(stypes[token_value]), slines[token_value]);
+ }
else
{ internal_name_symbol = token_value;
strcpy(internal_name, token_text);