help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Upgrading from 1.35 to 1.875 breaks things...?


From: Nikolai Devereaux
Subject: Upgrading from 1.35 to 1.875 breaks things...?
Date: Thu, 27 Feb 2003 14:54:31 -0800

Hello bison users,

I just upgraded bison to 1.875 from 1.35 (cygwin/Win2k).  I had a project
that compiled just fine, but now I get these errors in VC++:

xpath.tab.c(1286) : warning C4065: switch statement contains
                   'default' but no 'case' labels

xpath.tab.c(1313) : warning C4065: switch statement contains
                   'default' but no 'case' labels

xpath.tab.c(1981) : warning C4102: 'yyerrlab1' : unreferenced label

xpath.l(105) : error C2065: 'yytoknum' : undeclared identifier


This is really strange to me.  I read in the Bison manual online that you
can lookup values in the token table here:

http://www.gnu.org/manual/bison-1.35/html_node/Calling-Convention.html#Calli
ng%20Convention

  (tiny version: http://tinyurl.com/6kpf)



I used this code in a function to get the token number of multicharacter
tokens from within some of my lexer rules:

int check_token_table(char *token_buffer, int token_length)
{
    int i;
    for (i = 0; i < YYNTOKENS; i++)
    {
        if (yytname[i] != 0
            && yytname[i][0] == '"'
            && (strncmp (yytname[i] + 1, token_buffer, token_length) == 0)
            && yytname[i][token_length + 1] == '"'
            && yytname[i][token_length + 2] == 0)
            break;
   }
   return (i < YYNTOKENS) ? yytoknum[i] : -1;
}



Now it doesn't work... Can anyone suggest a workaround?  I can't just return
i, since i != yytoknum[i], and it's the token number that I need to return
from the lexical rules.


Thanks in advance,

Nik





reply via email to

[Prev in Thread] Current Thread [Next in Thread]