/tutorial/backtracking/expand_expression/abstract/expand_alternative.e

http://github.com/tybor/Liberty · Specman e · 51 lines · 27 code · 6 blank · 18 comment · 1 complexity · 0da6b9a6fe2bb02e3f4b31c6e15cb89f MD5 · raw file

  1. -- See the Copyright notice at the end of this file.
  2. --
  3. class EXPAND_ALTERNATIVE
  4. inherit
  5. ABSTRACT_BACKTRACKING_ALTERNATIVE
  6. EXPRESSION_ITEM_GLOBALS
  7. feature {ABSTRACT_BACKTRACKING}
  8. next_alternative (explorer: EXPAND_EXPRESSION) is
  9. do
  10. explorer.stack.resize(count)
  11. if Iterate and then item.type = Or_item then
  12. explorer.goto_item(item.first)
  13. item := item.second
  14. explorer.continue_alternative
  15. else
  16. explorer.goto_item(item)
  17. explorer.pop_alternative
  18. end
  19. end
  20. feature {}
  21. item: EXPRESSION_ITEM
  22. count: INTEGER
  23. feature {EXPAND_EXPRESSION}
  24. make (itm: EXPRESSION_ITEM; cnt: INTEGER) is
  25. do
  26. count := cnt
  27. item := itm
  28. end
  29. end -- class EXPAND_ALTERNATIVE
  30. --
  31. -- ------------------------------------------------------------------------------------------------------------------------------
  32. -- Copyright notice below. Please read.
  33. --
  34. -- This file is free software, which comes along with SmartEiffel. This software is distributed in the hope that it will be
  35. -- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  36. -- You can modify it as you want, provided this footer is kept unaltered, and a notification of the changes is added.
  37. -- You are allowed to redistribute it and sell it, alone or as a part of another product.
  38. --
  39. -- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P. - University of Nancy 1 - FRANCE
  40. -- Copyright(C) 2003-2005: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
  41. --
  42. -- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
  43. --
  44. -- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
  45. -- ------------------------------------------------------------------------------------------------------------------------------