assoc.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Associativity information.
  2. Copyright (C) 2002, 2005-2006, 2008-2015, 2018-2019 Free Software
  3. Foundation, Inc.
  4. This file is part of Bison, the GNU Compiler Compiler.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. #include <config.h>
  16. #include "system.h"
  17. #include "assoc.h"
  18. const char *
  19. assoc_to_string (assoc a)
  20. {
  21. switch (a)
  22. {
  23. default:
  24. abort ();
  25. case undef_assoc:
  26. return "undefined associativity";
  27. case right_assoc:
  28. return "%right";
  29. case left_assoc:
  30. return "%left";
  31. case non_assoc:
  32. return "%nonassoc";
  33. case precedence_assoc:
  34. return "%precedence";
  35. }
  36. }