/[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.4 by ra, Wed Feb 6 15:17:57 2002 UTC revision 1.5 by ra, Thu Feb 7 11:35:40 2002 UTC
# Line 80  namespace yy Line 80  namespace yy
80    
81    private:    private:
82    
83        virtual void error_ ();
84    
85      /* Call to lexical analyser.  */      /* Call to lexical analyser.  */
86      virtual      virtual
87      void      void
88      lex ()      lex ()
89      {      {
90        looka = yylex (&value, &location);        looka = yylex (&value, &location);
91      }      }
92    
# Line 124  namespace yy Line 126  namespace yy
126      int len;      int len;
127      int debug_;      int debug_;
128      int state;      int state;
129        
130      /* Lookahead.  */      /* Lookahead.  */
131      int looka;      int looka;
132      int ilooka;      int ilooka;
133        
134        /* Message.  */
135        std::string message;
136    
137      /* @$ and $$.  */      /* @$ and $$.  */
138      SemanticType value;      SemanticType value;
139      LocationType location;      LocationType location;
# Line 169  b4_tokendef Line 174  b4_tokendef
174  int  int
175  yy::b4_name::parse ()  yy::b4_name::parse ()
176  {  {
177      int nerrs = 0;
178      int errstatus = 0;
179    
180    /* Initialize stack.  */    /* Initialize stack.  */
181    state_stack = StateStack (0);    state_stack = StateStack (0);
182    semantic_stack = SemanticStack (1);    semantic_stack = SemanticStack (1);
# Line 333  yy::b4_name::parse () Line 341  yy::b4_name::parse ()
341    
342    /* Report and recover from errors.  This is very incomplete.  */    /* Report and recover from errors.  This is very incomplete.  */
343   yyerrlab:   yyerrlab:
344    std::cerr << "Parse error." << std::endl; // FIXME: Need something like yyerror?    /* If not already recovering from an error, report this error.  */
345      if (!errstatus)
346        {
347          ++nerrs;
348          
349          // FIXME: Should be #if YYERROR_VERBOSE from here...
350          n = pact_[[state]];
351          if (n > b4_flag && n < b4_last)
352            {
353              message = "parse error, unexpected ";
354              message += name_[[ilooka]];
355              {
356                int count = 0;
357                for (int x = (n < 0 ? -n : 0); x < b4_ntokens + b4_nnts; ++x)
358                  if (check_[[x + n]] == x)
359                    ++count;
360                if (count < 5)
361                  {
362                    count = 0;
363                    for (int x = (n < 0 ? -n : 0); x < b4_ntokens + b4_nnts; ++x)
364                      if (check_[[x + n]] == x)
365                        {
366                          message += (!count++) ? ", expecting " : " or ";
367                          message += name_[[x]];
368                        }
369                  }
370              }
371            }
372          else
373          // FIXME: to there...
374            message = "parse error";
375        }
376      error_ ();
377    return 1;    return 1;
378        
379    /* Accept.  */    /* Accept.  */

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

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