Как передать yytext из файла lex в yacc?

Пожалуйста, я столкнулся с простой проблемой ... вот проблема, В моем файле lex есть что-то похожее на:

char *ptr_String;

"name = "  { BEGIN sName; }

<sName>.+   {
          ptr_String = (char *)calloc(strlen(yytext)+1, sizeof(char));
              strcpy(ptr_String, yytext);
              yylval.sValue = ptr_String;
              return NAME;
    }

Теперь в моем файле Yacc есть что-то похожее на:

stmt_Name:
    NAME
    {
        /*Now here i need to get the matched string of <sName>.+ and measure it's length. */
        /*The aim is simply outputing the name to the screen and storing the length in a global variable.
    }
    ;

Пожалуйста, какие-нибудь предложения? Большое спасибо за ваше время и помощь.

6
задан CompilingCyborg 22 December 2010 в 22:32
поделиться