help-flex
[Top][All Lists]
Advanced

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

Segmetation fault in yylex at YY_CURRENT_BUFFER_LVALUE = yy_create_buffe


From: henrik . sorensen
Subject: Segmetation fault in yylex at YY_CURRENT_BUFFER_LVALUE = yy_create_buffer
Date: Wed, 5 Jul 2006 20:34:14 +0000
User-agent: KMail/1.9.1

Hi List,

I have trace an error down to this part of yylex, that is called before the 
reading starts.

                if ( ! YY_CURRENT_BUFFER ) {
                        yyensure_buffer_stack (yyscanner);
                        YY_CURRENT_BUFFER_LVALUE = 
                                yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
                }

The yyensure_buffer_stack(yyscanner) completes OK,
The yy_create_buffer( ... ) completes OK.
But the assignment to YY_CURRENT_BUFFER_LVALUE fails .

I can send the whole lex input and the generated output.
Anything else I can do to trace this ?

I have converted the scanner and parser into a reentrant model.

My bison parser gets started like this:
int pl1_parser(struct Pl1ParserParms *ppp)
{ 
#include "PL1Parser.h"

  int rc;

  if(ppp==NULL) printf("Parameter structure is not allocated");

  /* set debug flags as needed */

  /* initialize the reentrant scanner */
  yyscan_t scanner;
  rc=yylex_init( &scanner ); printf("yylex_init returned %i\n",rc);
  yyset_in(ppp->inputFile,scanner); 
  yyset_debug(ppp->debugScanner,scanner); 
  yyset_extra((void *)ppp, scanner); 

  yydebug=ppp->debugParser;
  //pl1pp_yydebug=ppp->debugScannerPreprocessor;
  printf("pl11.c: starting parse. yydebug:%i, yy_flex_debug:
%i\n",yydebug,yyget_debug(scanner));
  int option_debug_level=0;

    /* do the parse */
    rc=yyparse (scanner);
    yylex_destroy( scanner );
  
  return rc;
}

anything else I need to setup before calling yyparse ?

Thanks for your help

Henrik




reply via email to

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