parse_attribute_name (struct lexer *lexer, const char *dict_encoding,
size_t *index)
{
- char *name;
-
- if (!lex_force_id (lexer)
- || !id_is_valid (lex_tokcstr (lexer), dict_encoding, true))
+ if (!lex_force_id (lexer))
return NULL;
- name = xstrdup (lex_tokcstr (lexer));
+ char *error = id_is_valid__ (lex_tokcstr (lexer), dict_encoding);
+ if (error)
+ {
+ lex_error (lexer, "%s", error);
+ free (error);
+ return NULL;
+ }
+ char *name = xstrdup (lex_tokcstr (lexer));
lex_get (lexer);
if (lex_match (lexer, T_LBRACK))
{
- if (!lex_force_int (lexer))
+ if (!lex_force_int_range (lexer, NULL, 1, 65535))
goto error;
- if (lex_integer (lexer) < 1 || lex_integer (lexer) > 65535)
- {
- msg (SE, _("Attribute array index must be between 1 and 65535."));
- goto error;
- }
*index = lex_integer (lexer);
lex_get (lexer);
if (!lex_force_match (lexer, T_RBRACK))
command = DELETE;
else if (command == UNKNOWN)
{
- lex_error_expecting (lexer, "ATTRIBUTE=", "DELETE=", NULL_SENTINEL);
+ lex_error_expecting (lexer, "ATTRIBUTE=", "DELETE=");
return CMD_FAILURE;
}