/[bison]/bison/data/bison.c++
ViewVC logotype

Diff of /bison/data/bison.c++

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by ra, Thu Feb 7 11:35:40 2002 UTC revision 1.6 by ra, Thu Feb 7 13:02:40 2002 UTC
# Line 116  namespace yy Line 116  namespace yy
116      /* Even more tables.  */      /* Even more tables.  */
117      static inline char translate (int token);      static inline char translate (int token);
118    
119      /* Eof and empty.  */      /* Constants.  */
120      static const int eof_;      static const int eof_;
121      static const int empty_;      static const int empty_;
122        static const int terror_;
123        static const int errcode_;
124      static const int ntokens_;      static const int ntokens_;
125    
126      /* State.  */      /* State.  */
# Line 374  yy::b4_name::parse () Line 376  yy::b4_name::parse ()
376          message = "parse error";          message = "parse error";
377      }      }
378    error_ ();    error_ ();
379    return 1;    goto yyerrlab1;
380        
381      /* Error raised explicitly by an action.  */
382     yyerrlab1:
383      if (errstatus == 3)
384        {
385          /* If just tried and failed to reuse lookahead token after an
386             error, discard it.  */
387    
388          /* Return failure if at end of input.  */
389          if (looka == eof_)
390            goto yyabortlab;
391          YYDPRINTF ((stderr, "Discarding token %d (%s).\n", looka, name_[[ilooka]]));
392          looka = empty_;
393        }
394    
395      /* Else will try to reuse lookahead token after shifting the error
396         token.  */
397    
398      errstatus = 3;
399      goto yyerrhandle;
400    
401      /* Pop the current state because it cannot handle the error token.  */
402     yyerrdefault:
403     yyerrpop:
404      if (!state_stack.height ())
405        goto yyabortlab;
406      state = (state_stack.pop (), state_stack[[0]]);
407      semantic_stack.pop ();
408      location_stack.pop ();;
409    
410    #if YYDEBUG
411      if (debug_)
412        {
413          YYFPRINTF (stderr, "Error: state stack now");
414          for (StateStack::ConstIterator i = state_stack.begin ();
415               i != state_stack.end (); ++i)
416            YYFPRINTF (stderr, " %d", *i);
417          YYFPRINTF (stderr, "\n");
418        }
419    #endif
420    
421     yyerrhandle:
422      n = pact_[[state]];
423      if (n == b4_flag)
424        goto yyerrdefault;
425    
426      n += terror_;
427      if (n < 0 || n > b4_last || check_[[n]] != terror_)
428        goto yyerrdefault;
429    
430      n = table_[[n]];
431      if (n < 0)
432        {
433          if (n == b4_flag)
434            goto yyerrpop;
435          n = -n;
436          goto yyreduce;
437        }
438      else if (!n)
439        goto yyerrpop;
440    
441      if (n == b4_final)
442        goto yyacceptlab;
443    
444      YYDPRINTF ((stderr, "Shifting error token, "));
445    
446      semantic_stack.push (value);
447      location_stack.push (location);
448    
449      state = n;
450      goto yynewstate;
451    
452    /* Accept.  */    /* Accept.  */
453   yyacceptlab:   yyacceptlab:
454    return 0;    return 0;
455    
456      /* Abort.  */
457     yyabortlab:
458      return 1;
459  }  }
460    
461  /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing  /* YYPACT[[STATE-NUM]] -- Index in YYTABLE of the portion describing
# Line 487  yy::b4_name::translate (int token) Line 564  yy::b4_name::translate (int token)
564    
565  const int yy::b4_name::eof_ = 0;  const int yy::b4_name::eof_ = 0;
566  const int yy::b4_name::empty_ = -2;  const int yy::b4_name::empty_ = -2;
567    const int yy::b4_name::terror_ = 1;
568    const int yy::b4_name::errcode_ = 256;
569  const int yy::b4_name::ntokens_ = b4_ntokens;  const int yy::b4_name::ntokens_ = b4_ntokens;
570    
571  b4_epilogue  b4_epilogue
# Line 551  namespace yy Line 630  namespace yy
630        seq_.reserve (n);        seq_.reserve (n);
631      }      }
632    
633        inline
634        unsigned
635        height () const
636        {
637          return seq_.size ();
638        }
639    
640      inline ConstIterator begin () const { return seq_.begin (); }      inline ConstIterator begin () const { return seq_.begin (); }
641      inline ConstIterator end () const { return seq_.end (); }      inline ConstIterator end () const { return seq_.end (); }
642    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26