Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1003 B

  1. // Copyright (c) 1993-1999 Microsoft Corporation
  2. #include "y3.h"
  3. void
  4. precftn(SSIZE_T r,int t,int s)
  5. {
  6. /* decide a shift/reduce conflict by precedence.*/
  7. /* r is a rule number, t a token number */
  8. /* the conflict is in state s */
  9. /* temp1[t] is changed to reflect the action */
  10. int lt, action;
  11. SSIZE_T lp;
  12. lp = levprd[r];
  13. lt = toklev[t];
  14. if( PLEVEL(lt) == 0 || PLEVEL(lp) == 0 )
  15. {
  16. /* conflict */
  17. if( foutput != NULL ) fprintf( foutput, "\n%d: shift/reduce conflict (shift %d, red'n %d) on %s",
  18. s, temp1[t], r, symnam(t) );
  19. ++zzsrconf;
  20. return;
  21. }
  22. if( PLEVEL(lt) == PLEVEL(lp) ) action = ASSOC(lt);
  23. else if( PLEVEL(lt) > PLEVEL(lp) ) action = RASC; /* shift */
  24. else action = LASC; /* reduce */
  25. switch( action )
  26. {
  27. case BASC: /* error action */
  28. temp1[t] = ERRCODE;
  29. return;
  30. case LASC: /* reduce */
  31. temp1[t] = -r;
  32. return;
  33. }
  34. }