* 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:
rliebscher 2012-01-31 19:28:01 +00:00
parent 2f9a27cd3f
commit ff577a6fed
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> 2012-01-31 Rene Liebscher <R.Liebscher@gmx.de>
patch #7437 modifications to Bus Pirate module patch #7437 modifications to Bus Pirate module

View File

@ -115,9 +115,8 @@ TOKEN * new_token(int primary)
void free_token(TOKEN * tkn) void free_token(TOKEN * tkn)
{ {
if (tkn) { if (tkn) {
switch (tkn->primary) { switch (tkn->value.type) {
case TKN_STRING: case V_STR:
case TKN_ID:
if (tkn->value.string) if (tkn->value.string)
free(tkn->value.string); free(tkn->value.string);
tkn->value.string = NULL; 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) TOKEN * keyword(int primary)
{ {
struct token_t * tkn; struct token_t * tkn;
@ -248,19 +222,15 @@ void print_token(TOKEN * tkn)
return; return;
fprintf(stderr, "token = %d = ", tkn->primary); fprintf(stderr, "token = %d = ", tkn->primary);
switch (tkn->primary) { switch (tkn->value.type) {
case TKN_NUMBER: case V_NUM:
fprintf(stderr, "NUMBER, value=%g", tkn->value.number); fprintf(stderr, "NUMBER, value=%g", tkn->value.number);
break; break;
case TKN_STRING: case V_STR:
fprintf(stderr, "STRING, value=%s", tkn->value.string); fprintf(stderr, "STRING, value=%s", tkn->value.string);
break; break;
case TKN_ID:
fprintf(stderr, "ID, value=%s", tkn->value.string);
break;
default: default:
fprintf(stderr, "<other>"); fprintf(stderr, "<other>");
break; break;

View File

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

View File

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

View File

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