+ -
当前位置:首页 → 问答吧 → 着急死了,lex文件编译不过。。郁闷死了。高手拜托帮忙指点下

着急死了,lex文件编译不过。。郁闷死了。高手拜托帮忙指点下

时间:2010-06-23

来源:互联网

lex chk.l
cc -g -c lex.yy.c
lex.yy.c:567:24: 错误:宏input传递了 1个参数,但只需要 0 个


%{
#include "y.tab.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

extern int yylval;
extern char *chkexpstr;
extern int opt;
extern int parentheses;

#ifdef USE_FLEX
    #undef YY_INPUT
    #define YY_INPUT(buf,result,max_size) \
                { \
                int c = '*', n; \
                for ( n = 0; n < max_size && \
                             (c = toupper(*(chkexpstr++))) != '\0'; ++n ) \
                        buf[n] = (char) c; \
                result = n; \
                }
#else
    #undef input
    #undef unput
    #define input() (toupper(*(chkexpstr++)))
    #define unput(c) (*(--chkexpstr)=c)
#endif

%}

%%
A[0-9]+    {
              yylval = atoi (yytext+1);
              return NUMBER;
          }

\!       {
              opt = NOT;
              return NOT;
          }

\&\&       {
              opt = AND;
              return AND;
          }

\|\|        {
              opt = OR;
              return OR;
          }

\(         {
              parentheses += 1;
              return '(';
          }

\)         {
              parentheses -= 1;
              return ')';
          }

[ \t] ;
.         {
             return (yytext[0]);
          }
%%

作者: powaer   发布时间: 2010-06-23

补充下在suse linux系统

作者: powaer   发布时间: 2010-06-23

今天换了个系统,我在scounix上编译又是成功的。哎。

作者: powaer   发布时间: 2010-06-24