* config_gram.y, lexer.l: removed unused ID/TKN_ID definitions

* config.[hc]: removed unused function id(), use value.type to select
               values


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1053 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Rene Liebscher 2012-01-31 19:28:01 +00:00
parent fa5e2bb849
commit 058a3b9dab
5 changed files with 12 additions and 40 deletions

View File

@ -1,3 +1,9 @@
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
* config_gram.y, lexer.l: removed unused ID/TKN_ID definitions
* config.[hc]: removed unused function id(), use value.type to select
values
2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
patch #7437 modifications to Bus Pirate module

View File

@ -115,9 +115,8 @@ TOKEN * new_token(int primary)
void free_token(TOKEN * tkn)
{
if (tkn) {
switch (tkn->primary) {
case TKN_STRING:
case TKN_ID:
switch (tkn->value.type) {
case V_STR:
if (tkn->value.string)
free(tkn->value.string);
tkn->value.string = NULL;
@ -207,31 +206,6 @@ TOKEN * string(char * text)
}
TOKEN * id(char * text)
{
struct token_t * tkn;
int len;
tkn = new_token(TKN_ID);
len = strlen(text);
tkn->value.type = V_STR;
tkn->value.string = (char *) malloc(len+1);
if (tkn->value.string == NULL) {
fprintf(stderr, "id(): out of memory\n");
exit(1);
}
strcpy(tkn->value.string, text);
#if DEBUG
fprintf(stderr, "ID(%s)\n", tkn->value.string);
#endif
return tkn;
}
TOKEN * keyword(int primary)
{
struct token_t * tkn;
@ -248,20 +222,16 @@ void print_token(TOKEN * tkn)
return;
fprintf(stderr, "token = %d = ", tkn->primary);
switch (tkn->primary) {
case TKN_NUMBER:
switch (tkn->value.type) {
case V_NUM:
fprintf(stderr, "NUMBER, value=%g", tkn->value.number);
break;
case TKN_STRING:
case V_STR:
fprintf(stderr, "STRING, value=%s", tkn->value.string);
break;
case TKN_ID:
fprintf(stderr, "ID, value=%s", tkn->value.string);
break;
default:
default:
fprintf(stderr, "<other>");
break;
}

View File

@ -95,8 +95,6 @@ TOKEN * hexnumber(char * text);
TOKEN * string(char * text);
TOKEN * id(char * text);
TOKEN * keyword(int primary);
void print_token(TOKEN * tkn);

View File

@ -200,7 +200,6 @@ static int pin_name;
%token TKN_TILDE
%token TKN_NUMBER
%token TKN_STRING
%token TKN_ID
%start configuration

View File

@ -43,7 +43,6 @@
DIGIT [0-9]
HEXDIGIT [0-9a-fA-F]
ID [_a-zA-Z][_a-zA-Z0-9]*
SIGN [+-]
%x strng