title: Repetitive lexical analyser, error segmentation fault
body: <p>I am working on a interpreter, but I have some problems. </p>
  
  <p>In my lex:</p>
  
  <pre><code>&lt;INITIAL&gt;\{                 {BEGIN(BLOC);}
  &lt;BLOC&gt;[^}]*\}               {BEGIN(INITIAL);strncpy(yylval.sval, yytext, MAXVARSIZE);
                              temp = strlen(yylval.sval);
                              yylval.sval[temp-1] = '\0';
                              return BLOCK;}
  </code></pre>
  
  <p>lex returned a block between <code>{}</code>, and in my bison parser, I set the flex buffer:</p>
  
  <pre><code>ifs:
      IF PAREOPEN condition PARECLOSE BLOCK {if($3 &gt; 0){scan_string($5);}}
  
  ;
  [...]
  
  void scan_string(const char* str)
  {
      yy_switch_to_buffer(yy_scan_string(str));
  
  }
  
  int main(int argc, char *argv[]) {
      yyin = stdin;
              do { 
          printf("aqui2\n");
          yyparse();
  
      } while(!feof(yyin));
  
  }
  </code></pre>
  
  <p>But bison later produces a segmentation fault. I want to restore the buffer to <code>yyin</code> as it was originally.</p>