title: Syntax error in Bison after one token is processed
body: <p>I am trying to come up to speed on Flex and Bison.  I can parse one token with a very simple "language" but it fails on the second, even though the token is legitimate.</p>
  
  <p>test.l:</p>
  
  <pre><code>%{
  #include &lt;stdio.h&gt;
  #include "test.hpp"
  %}
  
  %%
  [0-9]+ {printf("Number entered\n"); return INTEGER_NUMBER;}
  [a-zA-Z]+ {printf("plain text entered: '%s'\n",yytext); return PLAIN_TEXT;}
  [ \t]   ;
  .       ;
  %%
  </code></pre>
  
  <p>test.y</p>
  
  <pre><code>%{
  #include &lt;stdio.h&gt;
  
  extern "C" {
    int yyparse(void);
    int yylex(void);
    int yywrap() { return 1; }
    extern int yylineno;
    extern char* yytext;
    extern int yylval;
  }
  
  /* #define YYSTYPE char * */
  
  void yyerror(const char *message)
  {
    fprintf(stderr, "%d: error: '%s' at '%s', yylval=%u\n", yylineno, message, yytext, yylval);
  }
  
  main()
  {
    yyparse();
  }
  
  %}
  
  %token PLAIN_TEXT INTEGER_NUMBER
  
  %%
  test : text | number;
  
  text : PLAIN_TEXT
          {
            /*printf("plain text\n");*/
          };
  
  number : INTEGER_NUMBER
          {
            /*printf("number\n");*/
          };
  
  %%
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>$ ./test
  cat
  plain text entered: 'cat'
  
  dog
  plain text entered: 'dog'
  1: error: 'syntax error' at 'dog', yylval=0
  
  $ ./test
  34
  Number entered
  
  34
  Number entered
  1: error: 'syntax error' at '34', yylval=0
  </code></pre>
  
  <p>Why am I getting this syntax error?</p>