Skip to content

yy_set_interactive is undefined #290

@rmccullagh

Description

@rmccullagh

Running master and trying to use yy_set_interactive(1); and I receive a undefined reference when compiling on Ubuntu 16.04

Here is my .l file options:

%option warn nodefault
%option reentrant never-interactive
%option bison-bridge bison-locations yylineno
%option nounput noinput noyywrap unistd

A workaround I found is:

#define YY_USER_INIT \
  yy_set_interactive(yyin == stdin); \

Since the symbol is undefined in the generated header file, but defined in compilation unit. (the .c file). Calling the function from YY_USER_INIT works.

My use case for this was to call the lexer like so:

  yyscan_t scanner;
  int retval;

  if(yylex_init_extra(mycustomdata, &scanner)) 
    retval = 1;  
  else {
    yyset_in(fp, scanner);
    if(fp == stdin)
        yy_set_interactive(1);
    retval = yyparse(mycustomdata, scanner);
    yylex_destroy(scanner);
  }


Would you be welcome to me submitting a patch?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions