Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

LEX / YACC



Hello,

       I have a question regrading the change of state in lex using
BEGIN().
In my code the state is not getting changed from one to another. I
dont know
what is the error in that code, and why the change of state is not
happening
eventhough I used BEGIN(DATA) to change the state from HEADER to DATA.

My code:

numbers        [0-9]
alpha          [A-Za-z\/:.\[\]\{\},=;[EMAIL PROTECTED]&*()_+|\\\{\}\"\'?<>-]
newline        [\r\n\t ]
any            .\n
delimiters     [\300\200]
%x HEADER DATA
%%
     BEGIN(HEADER);
<HEADER>{
"MZ"+(.|\n){16} {
              yylval.header_data = yytext;
              printf("\nyytext = %s, yyleng = %d",yytext, yyleng);
              return TOKEN_HEADER;
              }
}
<HEADER>{
[(0-9)]+    {
              yylval.param_id   = yytext;
              BEGIN(DATA);
              printf("\nReturning PARAM ID (yytext = %s) (yyleng =
%d)", yytext, yyleng);
              return TOKEN_PARAM_ID;

              }
}
<DATA>[.]+ {
              yylval.param_value = yytext;
              BEGIN(HEADER);
              return TOKEN_PARAM_VALUE;
}
<*>(\300\200)* {
              return TOKEN_PARAM_SEPARATOR;
}




Regards,

Bhanu Gogineni.



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.